ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
modpython/module.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004-2014 ZNC, see the NOTICE file for details.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 class String {
20 public:
22 };
23 
24 class CModPython;
25 
26 #if HAVE_VISIBILITY
27 #pragma GCC visibility push(default)
28 #endif
29 class CPyModule : public CModule {
30  PyObject* m_pyObj;
31  CModPython* m_pModPython;
32  VWebSubPages* _GetSubPages();
33 public:
34  CPyModule(CUser* pUser, CIRCNetwork* pNetwork, const CString& sModName, const CString& sDataPath,
35  PyObject* pyObj, CModPython* pModPython)
36  : CModule(NULL, pUser, pNetwork, sModName, sDataPath) {
37  m_pyObj = pyObj;
38  Py_INCREF(pyObj);
39  m_pModPython = pModPython;
40  }
41  PyObject* GetPyObj() { // borrows
42  return m_pyObj;
43  }
44  PyObject* GetNewPyObj() {
45  Py_INCREF(m_pyObj);
46  return m_pyObj;
47  }
48  void DeletePyModule() {
49  Py_CLEAR(m_pyObj);
50  delete this;
51  }
53  CModPython* GetModPython() {
54  return m_pModPython;
55  }
56 
57  virtual bool OnBoot();
58  virtual bool WebRequiresLogin();
59  virtual bool WebRequiresAdmin();
60  virtual CString GetWebMenuTitle();
61  virtual bool OnWebPreRequest(CWebSock& WebSock, const CString& sPageName);
62  virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl);
63  virtual VWebSubPages& GetSubPages();
64  virtual void OnPreRehash();
65  virtual void OnPostRehash();
66  virtual void OnIRCDisconnected();
67  virtual void OnIRCConnected();
68  virtual EModRet OnIRCConnecting(CIRCSock *pIRCSock);
69  virtual void OnIRCConnectionError(CIRCSock *pIRCSock);
70  virtual EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName);
71  virtual EModRet OnBroadcast(CString& sMessage);
72  virtual void OnChanPermission2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, unsigned char uMode, bool bAdded, bool bNoChange);
73  virtual void OnOp2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange);
74  virtual void OnDeop2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange);
75  virtual void OnVoice2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange);
76  virtual void OnDevoice2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange);
77  virtual void OnMode2(const CNick* pOpNick, CChan& Channel, char uMode, const CString& sArg, bool bAdded, bool bNoChange);
78  virtual void OnRawMode2(const CNick* pOpNick, CChan& Channel, const CString& sModes, const CString& sArgs);
79  virtual EModRet OnRaw(CString& sLine);
80  virtual EModRet OnStatusCommand(CString& sCommand);
81  virtual void OnModCommand(const CString& sCommand);
82  virtual void OnModNotice(const CString& sMessage);
83  virtual void OnModCTCP(const CString& sMessage);
84  virtual void OnQuit(const CNick& Nick, const CString& sMessage, const std::vector<CChan*>& vChans);
85  virtual void OnNick(const CNick& Nick, const CString& sNewNick, const std::vector<CChan*>& vChans);
86  virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage);
87  virtual void OnJoin(const CNick& Nick, CChan& Channel);
88  virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
89  virtual EModRet OnChanBufferStarting(CChan& Chan, CClient& Client);
90  virtual EModRet OnChanBufferEnding(CChan& Chan, CClient& Client);
91  virtual EModRet OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine);
92  virtual EModRet OnPrivBufferPlayLine(CClient& Client, CString& sLine);
93  virtual void OnClientLogin();
94  virtual void OnClientDisconnect();
95  virtual EModRet OnUserRaw(CString& sLine);
96  virtual EModRet OnUserCTCPReply(CString& sTarget, CString& sMessage);
97  virtual EModRet OnUserCTCP(CString& sTarget, CString& sMessage);
98  virtual EModRet OnUserAction(CString& sTarget, CString& sMessage);
99  virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage);
100  virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage);
101  virtual EModRet OnUserJoin(CString& sChannel, CString& sKey);
102  virtual EModRet OnUserPart(CString& sChannel, CString& sMessage);
103  virtual EModRet OnUserTopic(CString& sChannel, CString& sTopic);
104  virtual EModRet OnUserTopicRequest(CString& sChannel);
105  virtual EModRet OnCTCPReply(CNick& Nick, CString& sMessage);
106  virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage);
107  virtual EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage);
108  virtual EModRet OnPrivAction(CNick& Nick, CString& sMessage);
109  virtual EModRet OnChanAction(CNick& Nick, CChan& Channel, CString& sMessage);
110  virtual EModRet OnPrivMsg(CNick& Nick, CString& sMessage);
111  virtual EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage);
112  virtual EModRet OnPrivNotice(CNick& Nick, CString& sMessage);
113  virtual EModRet OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage);
114  virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic);
115  virtual bool OnServerCapAvailable(const CString& sCap);
116  virtual void OnServerCapResult(const CString& sCap, bool bSuccess);
117  virtual EModRet OnTimerAutoJoin(CChan& Channel);
118  virtual bool OnEmbeddedWebRequest(CWebSock&, const CString&, CTemplate&);
119  virtual EModRet OnAddNetwork(CIRCNetwork& Network, CString& sErrorRet);
120  virtual EModRet OnDeleteNetwork(CIRCNetwork& Network);
121  virtual EModRet OnSendToClient(CString& sLine, CClient& Client);
122  virtual EModRet OnSendToIRC(CString& sLine);
123 
124  // Global Modules
125  virtual EModRet OnAddUser(CUser& User, CString& sErrorRet);
126  virtual EModRet OnDeleteUser(CUser& User);
127  virtual void OnClientConnect(CZNCSock* pSock, const CString& sHost, unsigned short uPort);
128  virtual void OnFailedLogin(const CString& sUsername, const CString& sRemoteIP);
129  virtual EModRet OnUnknownUserRaw(CClient* pClient, CString& sLine);
130  virtual bool IsClientCapSupported(CClient* pClient, const CString& sCap, bool bState);
131  virtual void OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState);
132  virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
133  CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg);
134  virtual EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg);
135  virtual EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
136  bool& bSuccess, CString& sRetMsg);
137  virtual void OnGetAvailableMods(std::set<CModInfo>& ssMods, CModInfo::EModuleType eType);
138  virtual void OnClientCapLs(CClient* pClient, SCString& ssCaps);
140 };
141 
142 static inline CPyModule* AsPyModule(CModule* p) {
143  return dynamic_cast<CPyModule*>(p);
144 }
145 
146 inline CPyModule* CreatePyModule(CUser* pUser, CIRCNetwork* pNetwork, const CString& sModName, const CString& sDataPath, PyObject* pyObj, CModPython* pModPython) {
147  return new CPyModule(pUser, pNetwork, sModName, sDataPath, pyObj, pModPython);
148 }
149 
150 class CPyTimer : public CTimer {
151  PyObject* m_pyObj;
152  CModPython* m_pModPython;
153 public:
154  CPyTimer(CPyModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription, PyObject* pyObj)
155  : CTimer (pModule, uInterval, uCycles, sLabel, sDescription), m_pyObj(pyObj) {
156  Py_INCREF(pyObj);
157  pModule->AddTimer(this);
158  m_pModPython = pModule->GetModPython();
159  }
160  virtual void RunJob();
161  PyObject* GetPyObj() { return m_pyObj; }
162  PyObject* GetNewPyObj() {
163  Py_INCREF(m_pyObj);
164  return m_pyObj;
165  }
166  ~CPyTimer();
167 };
168 
169 inline CPyTimer* CreatePyTimer(CPyModule* pModule, unsigned int uInterval, unsigned int uCycles,
170  const CString& sLabel, const CString& sDescription, PyObject* pyObj) {
171  return new CPyTimer(pModule, uInterval, uCycles, sLabel, sDescription, pyObj);
172 }
173 
174 class CPySocket : public CSocket {
175  PyObject* m_pyObj;
176  CModPython* m_pModPython;
177 public:
178  CPySocket(CPyModule* pModule, PyObject* pyObj) : CSocket(pModule), m_pyObj(pyObj) {
179  Py_INCREF(pyObj);
180  m_pModPython = pModule->GetModPython();
181  }
182  PyObject* GetPyObj() { return m_pyObj; }
183  PyObject* GetNewPyObj() {
184  Py_INCREF(m_pyObj);
185  return m_pyObj;
186  }
187  ~CPySocket();
188  virtual void Connected();
189  virtual void Disconnected();
190  virtual void Timeout();
191  virtual void ConnectionRefused();
192  virtual void ReadData(const char *data, size_t len);
193  virtual void ReadLine(const CString& sLine);
194  virtual Csock* GetSockObj(const CString& sHost, unsigned short uPort);
195 };
196 
197 inline CPySocket* CreatePySocket(CPyModule* pModule, PyObject* pyObj) {
198  return new CPySocket(pModule, pyObj);
199 }
200 
201 inline bool HaveIPv6_() {
202 #ifdef HAVE_IPV6
203  return true;
204 #endif
205  return false;
206 }
207 
208 inline bool HaveSSL_() {
209 #ifdef HAVE_LIBSSL
210  return true;
211 #endif
212  return false;
213 }
214 
215 inline bool HaveCharset_() {
216 #ifdef HAVE_ICU
217  return true;
218 #endif
219  return false;
220 }
221 
222 inline int GetSOMAXCONN() {
223  return SOMAXCONN;
224 }
225 
226 inline int GetVersionMajor() {
227  return VERSION_MAJOR;
228 }
229 
230 inline int GetVersionMinor() {
231  return VERSION_MINOR;
232 }
233 
234 inline double GetVersion() {
235  return VERSION;
236 }
237 
239  return ZNC_VERSION_EXTRA;
240 }
241 
243 public:
245  MCString::iterator x;
246  MCString_iter(MCString::iterator z) : x(z) {}
247  void plusplus() {
248  ++x;
249  }
250  CString get() {
251  return x->first;
252  }
253  bool is_end(CModule* m) {
254  return m->EndNV() == x;
255  }
256 };
257 
259 public:
260  CModulesIter(CModules *pModules) {
261  m_pModules = pModules;
262  m_it = pModules->begin();
263  }
264 
265  void plusplus() {
266  ++m_it;
267  }
268 
269  const CModule* get() const {
270  return *m_it;
271  }
272 
273  bool is_end() const {
274  return m_pModules->end() == m_it;
275  }
276 
278  CModules::const_iterator m_it;
279 };
280 
281 #if HAVE_VISIBILITY
282 #pragma GCC visibility pop
283 #endif
virtual void OnIRCConnectionError(CIRCSock *pIRCSock)
This module hook is called when a CIRCSock fails to connect or a module returned HALTCORE from OnIRCC...
CPyTimer(CPyModule *pModule, unsigned int uInterval, unsigned int uCycles, const CString &sLabel, const CString &sDescription, PyObject *pyObj)
Definition: modpython/module.h:154
virtual void OnPreRehash()
Called just before znc.conf is rehashed.
const char * ZNC_VERSION_EXTRA
Definition: User.h:37
virtual void OnDevoice2(const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
Called when a nick is devoiced on a channel.
virtual bool OnEmbeddedWebRequest(CWebSock &, const CString &, CTemplate &)
Using this hook, module can embed web stuff directly to different places.
CPyTimer * CreatePyTimer(CPyModule *pModule, unsigned int uInterval, unsigned int uCycles, const CString &sLabel, const CString &sDescription, PyObject *pyObj)
Definition: modpython/module.h:169
virtual void Connected()
Override these functions for an easy interface when using the Socket Manager Don&#39;t bother using these...
#define VERSION
Definition: version.h:8
virtual void OnDeop2(const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
Called when a nick is deopped on a channel.
virtual void OnGetAvailableMods(std::set< CModInfo > &ssMods, CModInfo::EModuleType eType)
Called when list of available mods is requested.
virtual EModRet OnGetModInfo(CModInfo &ModInfo, const CString &sModule, bool &bSuccess, CString &sRetMsg)
Called when info about a module is needed.
CModules * m_pModules
Definition: modpython/module.h:277
virtual void OnClientDisconnect()
Called when a client disconnected from ZNC.
virtual EModRet OnUnknownUserRaw(CClient *pClient, CString &sLine)
This function behaves like CModule::OnRaw(), but is also called before the client successfully logged...
EModuleType
Definition: Modules.h:184
virtual EModRet OnUserRaw(CString &sLine)
This module hook is called when a client sends a raw traffic line to ZNC.
virtual EModRet OnLoginAttempt(CSmartPtr< CAuthBase > Auth)
This module hook is called when a client tries to login.
virtual void OnClientLogin()
Called when a client successfully logged in to ZNC.
virtual void OnClientConnect(CZNCSock *pSock, const CString &sHost, unsigned short uPort)
This module hook is called when there is an incoming connection on any of ZNC&#39;s listening sockets...
Definition: modpython/module.h:242
CModPython * GetModPython()
Definition: modpython/module.h:53
CPyModule * CreatePyModule(CUser *pUser, CIRCNetwork *pNetwork, const CString &sModName, const CString &sDataPath, PyObject *pyObj, CModPython *pModPython)
Definition: modpython/module.h:146
virtual void ReadData(const char *data, size_t len)
Override these functions for an easy interface when using the Socket Manager Don&#39;t bother using these...
double GetVersion()
Definition: modperl/module.h:192
virtual EModRet OnAddUser(CUser &User, CString &sErrorRet)
This module hook is called when a user is being added.
virtual EModRet OnUserAction(CString &sTarget, CString &sMessage)
Called when a client sends a CTCP ACTION request (&quot;/me&quot;).
Definition: Client.h:84
virtual EModRet OnPrivMsg(CNick &Nick, CString &sMessage)
Called when we receive a private message from IRC.
bool HaveCharset_()
Definition: modpython/module.h:215
virtual CString GetWebMenuTitle()
Return the title of the module&#39;s section in the web interface&#39;s side bar.
CString GetPyExceptionStr()
virtual void Timeout()
Override these functions for an easy interface when using the Socket Manager Don&#39;t bother using these...
virtual bool OnWebRequest(CWebSock &WebSock, const CString &sPageName, CTemplate &Tmpl)
If OnWebPreRequest returned false, and the RequiresAdmin/IsAdmin check has been passed, this method will be called with the page name.
virtual Csock * GetSockObj(const CString &sHost, unsigned short uPort)
bool is_end() const
Definition: modpython/module.h:273
virtual EModRet OnChanBufferPlayLine(CChan &Chan, CClient &Client, CString &sLine)
Called when for each line during a channel&#39;s buffer play back.
virtual EModRet OnUserPart(CString &sChannel, CString &sMessage)
This hooks is called when a user sends a PART message.
PyObject * GetNewPyObj()
Definition: modpython/module.h:183
virtual void ConnectionRefused()
Override these functions for an easy interface when using the Socket Manager Don&#39;t bother using these...
CModules::const_iterator m_it
Definition: modpython/module.h:278
virtual void OnMode2(const CNick *pOpNick, CChan &Channel, char uMode, const CString &sArg, bool bAdded, bool bNoChange)
Called on an individual channel mode change.
virtual bool OnBoot()
This module hook is called during ZNC startup.
virtual EModRet OnUserTopic(CString &sChannel, CString &sTopic)
This module hook is called when a user wants to change a channel topic.
Definition: modpython/module.h:174
bool HaveSSL_()
Definition: modpython/module.h:208
Definition: Modules.h:1066
virtual EModRet OnChanNotice(CNick &Nick, CChan &Channel, CString &sMessage)
Called when we receive a channel notice.
Definition: Nick.h:29
virtual EModRet OnTopic(CNick &Nick, CChan &Channel, CString &sTopic)
Called when we receive a channel topic change from IRC.
CPySocket(CPyModule *pModule, PyObject *pyObj)
Definition: modpython/module.h:178
Definition: modpython/module.h:19
Definition: modpython/module.h:150
Definition: modpython/module.h:29
std::vector< TWebSubPage > VWebSubPages
Definition: WebModules.h:31
virtual void OnModCTCP(const CString &sMessage)
Called when your module nick was sent a CTCP message.
std::set< CString > SCString
Definition: ZNCString.h:34
virtual void OnRawMode2(const CNick *pOpNick, CChan &Channel, const CString &sModes, const CString &sArgs)
Called on any channel mode change.
virtual void OnPostRehash()
This module hook is called after a successful rehash.
Definition: Socket.h:26
Base Csock implementation to be used by modules.
Definition: Socket.h:164
virtual EModRet OnStatusCommand(CString &sCommand)
Called when a command to *status is sent.
virtual void OnVoice2(const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
Called when a nick is voiced on a channel.
Definition: Modules.h:135
virtual void OnIRCConnected()
This module hook is called after a successful login to IRC.
CString GetVersionExtra()
Definition: modperl/module.h:196
virtual VWebSubPages & GetSubPages()
Returns a list of all registered SubPages.
bool AddTimer(CTimer *pTimer)
virtual bool IsClientCapSupported(CClient *pClient, const CString &sCap, bool bState)
Called only to check if your module supports turning on/off named capability.
virtual EModRet OnTimerAutoJoin(CChan &Channel)
This module hook is called just before ZNC tries to join a channel by itself because it&#39;s in the conf...
virtual EModRet OnBroadcast(CString &sMessage)
This module hook is called when a message is broadcasted to all users.
PyObject * GetNewPyObj()
Definition: modpython/module.h:44
void DeletePyModule()
Definition: modpython/module.h:48
CPySocket * CreatePySocket(CPyModule *pModule, PyObject *pyObj)
Definition: modpython/module.h:197
Basic socket class.
Definition: Csocket.h:537
Definition: Template.h:117
PyObject * GetNewPyObj()
Definition: modpython/module.h:162
virtual EModRet OnSendToClient(CString &sLine, CClient &Client)
Called when ZNC sends a raw traffic line to a client.
virtual EModRet OnAddNetwork(CIRCNetwork &Network, CString &sErrorRet)
This module hook is called when a network is being added.
Definition: IRCNetwork.h:36
virtual EModRet OnIRCRegistration(CString &sPass, CString &sNick, CString &sIdent, CString &sRealName)
This module hook is called before loging in to the IRC server.
virtual EModRet OnUserCTCP(CString &sTarget, CString &sMessage)
This module hook is called when a client sends a CTCP request.
virtual EModRet OnPrivNotice(CNick &Nick, CString &sMessage)
Called when we receive a private notice.
void plusplus()
Definition: modpython/module.h:265
virtual void OnKick(const CNick &OpNick, const CString &sKickedNick, CChan &Channel, const CString &sMessage)
Called when a nick is kicked from a channel.
PyObject * GetPyObj()
Definition: modpython/module.h:41
String class that is used inside ZNC.
Definition: ZNCString.h:67
virtual void OnOp2(const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
Called when a nick is opped on a channel.
virtual void OnModCommand(const CString &sCommand)
Called when a command to your module is sent, e.g.
virtual void Disconnected()
Override these functions for an easy interface when using the Socket Manager Don&#39;t bother using these...
virtual bool OnWebPreRequest(CWebSock &WebSock, const CString &sPageName)
For WebMods: Called before the list of registered SubPages will be checked.
EModRet
This enum is just used for return from module hooks.
Definition: Modules.h:332
virtual void OnServerCapResult(const CString &sCap, bool bSuccess)
Called for every CAP accepted or rejected by server (with CAP ACK or CAP NAK after our CAP REQ)...
int GetSOMAXCONN()
Definition: modpython/module.h:222
virtual void OnPart(const CNick &Nick, CChan &Channel, const CString &sMessage)
Called when a nick parts a channel.
Definition: Modules.h:180
MCString_iter()
Definition: modpython/module.h:244
virtual EModRet OnUserNotice(CString &sTarget, CString &sMessage)
This module hook is called when a user sends a notice message.
The base class for your own ZNC modules.
Definition: Modules.h:322
virtual bool OnServerCapAvailable(const CString &sCap)
Called for every CAP received via CAP LS from server.
#define VERSION_MINOR
Definition: version.h:6
virtual EModRet OnUserCTCPReply(CString &sTarget, CString &sMessage)
This module hook is called when a client sends a CTCP reply.
virtual EModRet OnDeleteUser(CUser &User)
This module hook is called when a user is deleted.
CModulesIter(CModules *pModules)
Definition: modpython/module.h:260
virtual void OnFailedLogin(const CString &sUsername, const CString &sRemoteIP)
Called after a client login was rejected.
CPyModule(CUser *pUser, CIRCNetwork *pNetwork, const CString &sModName, const CString &sDataPath, PyObject *pyObj, CModPython *pModPython)
Definition: modpython/module.h:34
virtual EModRet OnUserJoin(CString &sChannel, CString &sKey)
This hooks is called when a user sends a JOIN message.
virtual EModRet OnModuleUnloading(CModule *pModule, bool &bSuccess, CString &sRetMsg)
Called when a module is going to be unloaded.
MCString::iterator EndNV()
Definition: Modules.h:914
Definition: WebModules.h:111
virtual EModRet OnChanBufferEnding(CChan &Chan, CClient &Client)
Called after a channel buffer was played back to a client.
virtual bool WebRequiresAdmin()
Return true if this module should only be usable for admins on the web.
virtual EModRet OnPrivBufferPlayLine(CClient &Client, CString &sLine)
Called when a line from the query buffer is played back.
virtual EModRet OnChanAction(CNick &Nick, CChan &Channel, CString &sMessage)
Called when we receive a channel CTCP ACTION (&quot;/me&quot; in a channel) from IRC.
virtual void OnIRCDisconnected()
This module hook is called when a user gets disconnected from IRC.
virtual void OnNick(const CNick &Nick, const CString &sNewNick, const std::vector< CChan * > &vChans)
Called when a nickname change occurs.
virtual EModRet OnChanBufferStarting(CChan &Chan, CClient &Client)
Called before a channel buffer is played back to a client.
virtual void OnClientCapRequest(CClient *pClient, const CString &sCap, bool bState)
Called when we actually need to turn a capability on or off for a client.
virtual EModRet OnChanMsg(CNick &Nick, CChan &Channel, CString &sMessage)
Called when we receive a channel message from IRC.
void plusplus()
Definition: modpython/module.h:247
virtual EModRet OnModuleLoading(const CString &sModName, const CString &sArgs, CModInfo::EModuleType eType, bool &bSuccess, CString &sRetMsg)
Called when a module is going to be loaded.
virtual void OnQuit(const CNick &Nick, const CString &sMessage, const std::vector< CChan * > &vChans)
Called when a nick quit from IRC.
virtual void OnModNotice(const CString &sMessage)
Called when a your module nick was sent a notice.
virtual EModRet OnCTCPReply(CNick &Nick, CString &sMessage)
Called when we receive a CTCP reply from IRC.
int GetVersionMinor()
Definition: modperl/module.h:188
virtual EModRet OnUserMsg(CString &sTarget, CString &sMessage)
This module hook is called when a user sends a normal IRC message.
MCString::iterator x
Definition: modpython/module.h:245
CString s
Definition: modpython/module.h:21
virtual void OnChanPermission2(const CNick *pOpNick, const CNick &Nick, CChan &Channel, unsigned char uMode, bool bAdded, bool bNoChange)
This module hook is called when a user mode on a channel changes.
virtual void OnJoin(const CNick &Nick, CChan &Channel)
Called when a nick joins a channel.
int GetVersionMajor()
Definition: modperl/module.h:184
virtual EModRet OnRaw(CString &sLine)
Called on any raw IRC line received from the IRC server.
Definition: modpython/module.h:258
virtual EModRet OnSendToIRC(CString &sLine)
Called when ZNC sends a raw traffic line to the IRC server.
virtual bool WebRequiresLogin()
Modules which can only be used with an active user session have to return true here.
virtual void ReadLine(const CString &sLine)
virtual EModRet OnPrivAction(CNick &Nick, CString &sMessage)
Called when we receive a private CTCP ACTION (&quot;/me&quot; in query) from IRC.
virtual EModRet OnUserTopicRequest(CString &sChannel)
This hook is called when a user requests a channel&#39;s topic.
bool is_end(CModule *m)
Definition: modpython/module.h:253
virtual EModRet OnChanCTCP(CNick &Nick, CChan &Channel, CString &sMessage)
Called when we receive a channel CTCP request from IRC.
virtual void OnClientCapLs(CClient *pClient, SCString &ssCaps)
Called when a client told us CAP LS.
MCString_iter(MCString::iterator z)
Definition: modpython/module.h:246
virtual void RunJob()
this is the method you should override
virtual EModRet OnIRCConnecting(CIRCSock *pIRCSock)
This module hook is called just before ZNC tries to establish a connection to an IRC server...
PyObject * GetPyObj()
Definition: modpython/module.h:161
Definition: IRCSock.h:33
Definition: Chan.h:34
virtual EModRet OnPrivCTCP(CNick &Nick, CString &sMessage)
Called when we receive a private CTCP request from IRC.
virtual EModRet OnDeleteNetwork(CIRCNetwork &Network)
This module hook is called when a network is deleted.
#define VERSION_MAJOR
Definition: version.h:5
PyObject * GetPyObj()
Definition: modpython/module.h:182
bool HaveIPv6_()
Definition: modpython/module.h:201