To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.
QuitAway/Source: Difference between revisions
< QuitAway
>Efreak m oops, left out a tag. |
>Efreak m Added github link. |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
This is | This source is also available on [https://github.com/Efreak/ZNC-Modules/blob/master/quitaway.cpp GitHub]. | ||
<pre>/* | <pre>/* | ||
* Copyright (C) 2010 Efreak. | * Copyright (C) 2010 Efreak. | ||
Line 13: | Line 12: | ||
* and I'll ad you as a contributor on GitHub. | * and I'll ad you as a contributor on GitHub. | ||
* -Efreak | * -Efreak | ||
*/ | */ | ||
Line 60: | Line 58: | ||
*/ | */ | ||
</pre> | </pre> | ||
[[Category:Modules/Code]] |
Latest revision as of 18:51, 31 August 2012
This source is also available on GitHub.
/* * Copyright (C) 2010 Efreak. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * If any other changes are made, update the version number to the latest ZNC * version to reflect it, please. This makes things easier to know what * version it works with; If you want to contribute code, let me know via IRC * and I'll ad you as a contributor on GitHub. * -Efreak */ #include "Chan.h" #include "User.h" #include "Modules.h" class CQuitAway : public CModule { public: MODCONSTRUCTOR(CQuitAway) {} virtual ~CQuitAway() {} bool message; virtual bool OnLoad(const CString& sArgs, CString& sMessage) { if (sArgs.Token(0) == "+message") message=true; else message=false; return true; } virtual EModRet OnUserRaw(CString& sLiner) { if(sLiner.Token(0).AsLower()=="quit") { CString sLine=sLiner.Token(1,true); if(CString(sLine[0])==":") sLine=sLine.LeftChomp_n(1); PutIRC("AWAY :" + sLine); if(message) PutModule("You are now away: " + sLine); } return CONTINUE; } }; MODULEDEFS(CQuitAway, "Set away message on quit (from quit message). Version 0.01") /* on modulecall user raw { if we're quitting { new cstring for the reason if it begins with a :, { get rid of it } put away plus : plus reason notify the user } continue quitting, or w/e we're doing. } */