ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
CModule Class Reference

The base class for your own ZNC modules. More...

#include <Modules.h>

+ Collaboration diagram for CModule:

Public Types

enum  EModRet { CONTINUE = 1, HALT = 2, HALTMODS = 3, HALTCORE = 4 }
 This enum is just used for return from module hooks. More...
 
enum  EModException { UNLOAD }
 

Public Member Functions

 CModule (ModHandle pDLL, CUser *pUser, CIRCNetwork *pNetwork, const CString &sModName, const CString &sDataDir, CModInfo::EModuleType eType=CModInfo::NetworkModule)
 
virtual ~CModule ()
 
 CModule (const CModule &)=delete
 
CModuleoperator= (const CModule &)=delete
 
void SetUser (CUser *pUser)
 
void SetNetwork (CIRCNetwork *pNetwork)
 
void SetClient (CClient *pClient)
 
void Unload ()
 This function throws CModule::UNLOAD which causes this module to be unloaded. More...
 
virtual bool OnLoad (const CString &sArgsi, CString &sMessage)
 This module hook is called when a module is loaded. More...
 
virtual bool OnBoot ()
 This module hook is called during ZNC startup. More...
 
virtual bool WebRequiresLogin ()
 Modules which can only be used with an active user session have to return true here. More...
 
virtual bool WebRequiresAdmin ()
 Return true if this module should only be usable for admins on the web. More...
 
virtual CString GetWebMenuTitle ()
 Return the title of the module's section in the web interface's side bar. More...
 
virtual CString GetWebPath ()
 
virtual CString GetWebFilesPath ()
 
virtual bool OnWebPreRequest (CWebSock &WebSock, const CString &sPageName)
 For WebMods: Called before the list of registered SubPages will be checked. More...
 
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. More...
 
virtual bool ValidateWebRequestCSRFCheck (CWebSock &WebSock, const CString &sPageName)
 If ValidateWebRequestCSRFCheck returned false, a CSRF error will be printed. More...
 
virtual void AddSubPage (TWebSubPage spSubPage)
 Registers a sub page for the sidebar. More...
 
virtual void ClearSubPages ()
 Removes all registered (AddSubPage'd) SubPages. More...
 
virtual VWebSubPagesGetSubPages ()
 Returns a list of all registered SubPages. More...
 
virtual bool OnEmbeddedWebRequest (CWebSock &WebSock, const CString &sPageName, CTemplate &Tmpl)
 Using this hook, module can embed web stuff directly to different places. More...
 
virtual void OnPreRehash ()
 Called just before znc.conf is rehashed. More...
 
virtual void OnPostRehash ()
 This module hook is called after a successful rehash. More...
 
virtual void OnIRCDisconnected ()
 This module hook is called when a user gets disconnected from IRC. More...
 
virtual void OnIRCConnected ()
 This module hook is called after a successful login to IRC. More...
 
virtual EModRet OnIRCConnecting (CIRCSock *pIRCSock)
 This module hook is called just before ZNC tries to establish a connection to an IRC server. More...
 
virtual void OnIRCConnectionError (CIRCSock *pIRCSock)
 This module hook is called when a CIRCSock fails to connect or a module returned HALTCORE from OnIRCConnecting. More...
 
virtual EModRet OnIRCRegistration (CString &sPass, CString &sNick, CString &sIdent, CString &sRealName)
 This module hook is called before loging in to the IRC server. More...
 
virtual EModRet OnBroadcast (CString &sMessage)
 This module hook is called when a message is broadcasted to all users. More...
 
virtual void OnChanPermission3 (const CNick *pOpNick, const CNick &Nick, CChan &Channel, char cMode, bool bAdded, bool bNoChange)
 This module hook is called when a user mode on a channel changes. More...
 
virtual void OnChanPermission2 (const CNick *pOpNick, const CNick &Nick, CChan &Channel, unsigned char uMode, bool bAdded, bool bNoChange)
 
virtual void OnChanPermission (const CNick &OpNick, const CNick &Nick, CChan &Channel, unsigned char uMode, bool bAdded, bool bNoChange)
 
virtual void OnOp2 (const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 Called when a nick is opped on a channel. More...
 
virtual void OnOp (const CNick &OpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 
virtual void OnDeop2 (const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 Called when a nick is deopped on a channel. More...
 
virtual void OnDeop (const CNick &OpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 
virtual void OnVoice2 (const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 Called when a nick is voiced on a channel. More...
 
virtual void OnVoice (const CNick &OpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 
virtual void OnDevoice2 (const CNick *pOpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 Called when a nick is devoiced on a channel. More...
 
virtual void OnDevoice (const CNick &OpNick, const CNick &Nick, CChan &Channel, bool bNoChange)
 
virtual void OnMode2 (const CNick *pOpNick, CChan &Channel, char uMode, const CString &sArg, bool bAdded, bool bNoChange)
 Called on an individual channel mode change. More...
 
virtual void OnMode (const CNick &OpNick, CChan &Channel, char uMode, const CString &sArg, bool bAdded, bool bNoChange)
 
virtual void OnRawMode2 (const CNick *pOpNick, CChan &Channel, const CString &sModes, const CString &sArgs)
 Called on any channel mode change. More...
 
virtual void OnRawMode (const CNick &OpNick, CChan &Channel, const CString &sModes, const CString &sArgs)
 
virtual EModRet OnRaw (CString &sLine)
 Called on any raw IRC line received from the IRC server. More...
 
virtual EModRet OnRawMessage (CMessage &Message)
 Called on any raw message received from the IRC server. More...
 
virtual EModRet OnNumericMessage (CNumericMessage &Message)
 Called when a numeric message is received from the IRC server. More...
 
virtual EModRet OnStatusCommand (CString &sCommand)
 Called when a command to *status is sent. More...
 
virtual void OnModCommand (const CString &sCommand)
 Called when a command to your module is sent, e.g. More...
 
virtual void OnUnknownModCommand (const CString &sCommand)
 This is similar to OnModCommand(), but it is only called if HandleCommand didn't find any that wants to handle this. More...
 
virtual void OnModNotice (const CString &sMessage)
 Called when a your module nick was sent a notice. More...
 
virtual void OnModCTCP (const CString &sMessage)
 Called when your module nick was sent a CTCP message. More...
 
virtual void OnQuitMessage (CQuitMessage &Message, const std::vector< CChan * > &vChans)
 Called when a nick quit from IRC. More...
 
virtual void OnQuit (const CNick &Nick, const CString &sMessage, const std::vector< CChan * > &vChans)
 
virtual void OnNickMessage (CNickMessage &Message, const std::vector< CChan * > &vChans)
 Called when a nickname change occurs. More...
 
virtual void OnNick (const CNick &Nick, const CString &sNewNick, const std::vector< CChan * > &vChans)
 
virtual void OnKickMessage (CKickMessage &Message)
 Called when a nick is kicked from a channel. More...
 
virtual void OnKick (const CNick &OpNick, const CString &sKickedNick, CChan &Channel, const CString &sMessage)
 
virtual EModRet OnJoining (CChan &Channel)
 This module hook is called just before ZNC tries to join an IRC channel. More...
 
virtual void OnJoinMessage (CJoinMessage &Message)
 Called when a nick joins a channel. More...
 
virtual void OnJoin (const CNick &Nick, CChan &Channel)
 
virtual void OnPartMessage (CPartMessage &Message)
 Called when a nick parts a channel. More...
 
virtual void OnPart (const CNick &Nick, CChan &Channel, const CString &sMessage)
 
virtual EModRet OnInvite (const CNick &Nick, const CString &sChan)
 Called when user is invited into a channel. More...
 
virtual EModRet OnChanBufferStarting (CChan &Chan, CClient &Client)
 Called before a channel buffer is played back to a client. More...
 
virtual EModRet OnChanBufferEnding (CChan &Chan, CClient &Client)
 Called after a channel buffer was played back to a client. More...
 
virtual EModRet OnChanBufferPlayMessage (CMessage &Message)
 Called for each message during a channel's buffer play back. More...
 
virtual EModRet OnChanBufferPlayLine2 (CChan &Chan, CClient &Client, CString &sLine, const timeval &tv)
 
virtual EModRet OnChanBufferPlayLine (CChan &Chan, CClient &Client, CString &sLine)
 
virtual EModRet OnPrivBufferStarting (CQuery &Query, CClient &Client)
 Called before a query buffer is played back to a client. More...
 
virtual EModRet OnPrivBufferEnding (CQuery &Query, CClient &Client)
 Called after a query buffer was played back to a client. More...
 
virtual EModRet OnPrivBufferPlayMessage (CMessage &Message)
 Called for each message during a query's buffer play back. More...
 
virtual EModRet OnPrivBufferPlayLine2 (CClient &Client, CString &sLine, const timeval &tv)
 
virtual EModRet OnPrivBufferPlayLine (CClient &Client, CString &sLine)
 
virtual void OnClientLogin ()
 Called when a client successfully logged in to ZNC. More...
 
virtual void OnClientDisconnect ()
 Called when a client disconnected from ZNC. More...
 
virtual EModRet OnUserRaw (CString &sLine)
 This module hook is called when a client sends a raw traffic line to ZNC. More...
 
virtual EModRet OnUserRawMessage (CMessage &Message)
 This module hook is called when a client sends any message to ZNC. More...
 
virtual EModRet OnUserCTCPReplyMessage (CCTCPMessage &Message)
 This module hook is called when a client sends a CTCP reply. More...
 
virtual EModRet OnUserCTCPReply (CString &sTarget, CString &sMessage)
 
virtual EModRet OnUserCTCPMessage (CCTCPMessage &Message)
 This module hook is called when a client sends a CTCP request. More...
 
virtual EModRet OnUserCTCP (CString &sTarget, CString &sMessage)
 
virtual EModRet OnUserActionMessage (CActionMessage &Message)
 Called when a client sends a CTCP ACTION request ("/me"). More...
 
virtual EModRet OnUserAction (CString &sTarget, CString &sMessage)
 
virtual EModRet OnUserTextMessage (CTextMessage &Message)
 This module hook is called when a user sends a PRIVMSG message. More...
 
virtual EModRet OnUserMsg (CString &sTarget, CString &sMessage)
 
virtual EModRet OnUserNoticeMessage (CNoticeMessage &Message)
 This module hook is called when a user sends a NOTICE message. More...
 
virtual EModRet OnUserNotice (CString &sTarget, CString &sMessage)
 
virtual EModRet OnUserJoinMessage (CJoinMessage &Message)
 This hooks is called when a user sends a JOIN message. More...
 
virtual EModRet OnUserJoin (CString &sChannel, CString &sKey)
 
virtual EModRet OnUserPartMessage (CPartMessage &Message)
 This hooks is called when a user sends a PART message. More...
 
virtual EModRet OnUserPart (CString &sChannel, CString &sMessage)
 
virtual EModRet OnUserTopicMessage (CTopicMessage &Message)
 This module hook is called when a user wants to change a channel topic. More...
 
virtual EModRet OnUserTopic (CString &sChannel, CString &sTopic)
 
virtual EModRet OnUserTopicRequest (CString &sChannel)
 This hook is called when a user requests a channel's topic. More...
 
virtual EModRet OnUserQuitMessage (CQuitMessage &Message)
 This module hook is called when a client quits ZNC. More...
 
virtual EModRet OnUserQuit (CString &sMessage)
 
virtual EModRet OnCTCPReplyMessage (CCTCPMessage &Message)
 Called when we receive a CTCP reply from IRC. More...
 
virtual EModRet OnCTCPReply (CNick &Nick, CString &sMessage)
 
virtual EModRet OnPrivCTCPMessage (CCTCPMessage &Message)
 Called when we receive a private CTCP request from IRC. More...
 
virtual EModRet OnPrivCTCP (CNick &Nick, CString &sMessage)
 
virtual EModRet OnChanCTCPMessage (CCTCPMessage &Message)
 Called when we receive a channel CTCP request from IRC. More...
 
virtual EModRet OnChanCTCP (CNick &Nick, CChan &Channel, CString &sMessage)
 
virtual EModRet OnPrivActionMessage (CActionMessage &Message)
 Called when we receive a private CTCP ACTION ("/me" in query) from IRC. More...
 
virtual EModRet OnPrivAction (CNick &Nick, CString &sMessage)
 
virtual EModRet OnChanActionMessage (CActionMessage &Message)
 Called when we receive a channel CTCP ACTION ("/me" in a channel) from IRC. More...
 
virtual EModRet OnChanAction (CNick &Nick, CChan &Channel, CString &sMessage)
 
virtual EModRet OnPrivTextMessage (CTextMessage &Message)
 Called when we receive a private PRIVMSG message from IRC. More...
 
virtual EModRet OnPrivMsg (CNick &Nick, CString &sMessage)
 
virtual EModRet OnChanTextMessage (CTextMessage &Message)
 Called when we receive a channel PRIVMSG message from IRC. More...
 
virtual EModRet OnChanMsg (CNick &Nick, CChan &Channel, CString &sMessage)
 
virtual EModRet OnPrivNoticeMessage (CNoticeMessage &Message)
 Called when we receive a private NOTICE message from IRC. More...
 
virtual EModRet OnPrivNotice (CNick &Nick, CString &sMessage)
 
virtual EModRet OnChanNoticeMessage (CNoticeMessage &Message)
 Called when we receive a channel NOTICE message from IRC. More...
 
virtual EModRet OnChanNotice (CNick &Nick, CChan &Channel, CString &sMessage)
 
virtual EModRet OnTopicMessage (CTopicMessage &Message)
 Called when we receive a channel topic change from IRC. More...
 
virtual EModRet OnTopic (CNick &Nick, CChan &Channel, CString &sTopic)
 
virtual bool OnServerCapAvailable (const CString &sCap)
 Called for every CAP received via CAP LS from server. More...
 
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). More...
 
virtual EModRet OnTimerAutoJoin (CChan &Channel)
 This module hook is called just before ZNC tries to join a channel by itself because it's in the config but wasn't joined yet. More...
 
virtual EModRet OnAddNetwork (CIRCNetwork &Network, CString &sErrorRet)
 This module hook is called when a network is being added. More...
 
virtual EModRet OnDeleteNetwork (CIRCNetwork &Network)
 This module hook is called when a network is deleted. More...
 
virtual EModRet OnSendToClientMessage (CMessage &Message)
 Called immediately before ZNC sends a raw traffic line to a client. More...
 
virtual EModRet OnSendToClient (CString &sLine, CClient &Client)
 
virtual EModRet OnSendToIRCMessage (CMessage &Message)
 Called immediately before ZNC sends a raw traffic line to the IRC server. More...
 
virtual EModRet OnSendToIRC (CString &sLine)
 
ModHandle GetDLL ()
 
virtual bool PutIRC (const CString &sLine)
 This function sends a given IRC line to the IRC server, if we are connected to one. More...
 
virtual bool PutIRC (const CMessage &Message)
 This function sends a given IRC message to the IRC server, if we are connected to one. More...
 
virtual bool PutUser (const CString &sLine)
 This function sends a given raw IRC line to a client. More...
 
virtual bool PutStatus (const CString &sLine)
 This function generates a query from *status. More...
 
virtual bool PutModule (const CString &sLine)
 This function sends a query from your module nick. More...
 
virtual unsigned int PutModule (const CTable &table)
 This function calls CModule::PutModule(const CString&, const CString&, const CString&) for each line in the table. More...
 
virtual bool PutModNotice (const CString &sLine)
 Send a notice from your module nick. More...
 
const CStringGetModName () const
 
CString GetModNick () const
 
const CStringGetModDataDir () const
 Get the module's data dir. More...
 
bool AddTimer (CTimer *pTimer)
 
bool AddTimer (FPTimer_t pFBCallback, const CString &sLabel, u_int uInterval, u_int uCycles=0, const CString &sDescription="")
 
bool RemTimer (CTimer *pTimer)
 
bool RemTimer (const CString &sLabel)
 
bool UnlinkTimer (CTimer *pTimer)
 
CTimerFindTimer (const CString &sLabel)
 
std::set< CTimer * >
::const_iterator 
BeginTimers () const
 
std::set< CTimer * >
::const_iterator 
EndTimers () const
 
virtual void ListTimers ()
 
bool AddSocket (CSocket *pSocket)
 
bool RemSocket (CSocket *pSocket)
 
bool RemSocket (const CString &sSockName)
 
bool UnlinkSocket (CSocket *pSocket)
 
CSocketFindSocket (const CString &sSockName)
 
std::set< CSocket * >
::const_iterator 
BeginSockets () const
 
std::set< CSocket * >
::const_iterator 
EndSockets () const
 
virtual void ListSockets ()
 
void AddJob (CModuleJob *pJob)
 
void CancelJob (CModuleJob *pJob)
 
bool CancelJob (const CString &sJobName)
 
void CancelJobs (const std::set< CModuleJob * > &sJobs)
 
bool UnlinkJob (CModuleJob *pJob)
 
void AddHelpCommand ()
 Register the "Help" command. More...
 
bool AddCommand (const CModCommand &Command)
 
bool AddCommand (const CString &sCmd, CModCommand::ModCmdFunc func, const CString &sArgs="", const CString &sDesc="")
 
bool AddCommand (const CString &sCmd, const COptionalTranslation &Args, const COptionalTranslation &Desc, std::function< void(const CString &sLine)> func)
 
bool RemCommand (const CString &sCmd)
 
const CModCommandFindCommand (const CString &sCmd) const
 
bool HandleCommand (const CString &sLine)
 This function tries to dispatch the given command via the correct instance of CModCommand. More...
 
void HandleHelpCommand (const CString &sLine="")
 Send a description of all registered commands via PutModule(). More...
 
bool LoadRegistry ()
 
bool SaveRegistry () const
 
bool MoveRegistry (const CString &sPath)
 
bool SetNV (const CString &sName, const CString &sValue, bool bWriteToDisk=true)
 
CString GetNV (const CString &sName) const
 
bool HasNV (const CString &sName) const
 
bool DelNV (const CString &sName, bool bWriteToDisk=true)
 
MCString::iterator FindNV (const CString &sName)
 
MCString::iterator EndNV ()
 
MCString::iterator BeginNV ()
 
void DelNV (MCString::iterator it)
 
bool ClearNV (bool bWriteToDisk=true)
 
const CStringGetSavePath () const
 
CString ExpandString (const CString &sStr) const
 
CStringExpandString (const CString &sStr, CString &sRet) const
 
void SetType (CModInfo::EModuleType eType)
 
void SetDescription (const CString &s)
 
void SetModPath (const CString &s)
 
void SetArgs (const CString &s)
 
CModInfo::EModuleType GetType () const
 
const CStringGetDescription () const
 
const CStringGetArgs () const
 
const CStringGetModPath () const
 
CUserGetUser () const
 
CIRCNetworkGetNetwork () const
 
CClientGetClient () const
 
CSockManagerGetManager () const
 
virtual EModRet OnAddUser (CUser &User, CString &sErrorRet)
 This module hook is called when a user is being added. More...
 
virtual EModRet OnDeleteUser (CUser &User)
 This module hook is called when a user is deleted. More...
 
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's listening sockets. More...
 
virtual EModRet OnLoginAttempt (std::shared_ptr< CAuthBase > Auth)
 This module hook is called when a client tries to login. More...
 
virtual void OnFailedLogin (const CString &sUsername, const CString &sRemoteIP)
 Called after a client login was rejected. More...
 
virtual EModRet OnUnknownUserRaw (CClient *pClient, CString &sLine)
 This function behaves like CModule::OnUserRaw(), but is also called before the client successfully logged in to ZNC. More...
 
virtual EModRet OnUnknownUserRawMessage (CMessage &Message)
 
virtual void OnClientCapLs (CClient *pClient, SCString &ssCaps)
 Called when a client told us CAP LS. More...
 
virtual bool IsClientCapSupported (CClient *pClient, const CString &sCap, bool bState)
 Called only to check if your module supports turning on/off named capability. More...
 
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. More...
 
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. More...
 
virtual EModRet OnModuleUnloading (CModule *pModule, bool &bSuccess, CString &sRetMsg)
 Called when a module is going to be unloaded. More...
 
virtual EModRet OnGetModInfo (CModInfo &ModInfo, const CString &sModule, bool &bSuccess, CString &sRetMsg)
 Called when info about a module is needed. More...
 
virtual void OnGetAvailableMods (std::set< CModInfo > &ssMods, CModInfo::EModuleType eType)
 Called when list of available mods is requested. More...
 
CString t_s (const CString &sEnglish, const CString &sContext="") const
 
CInlineFormatMessage t_f (const CString &sEnglish, const CString &sContext="") const
 
CInlineFormatMessage t_p (const CString &sEnglish, const CString &sEnglishes, int iNum, const CString &sContext="") const
 
CDelayedTranslation t_d (const CString &sEnglish, const CString &sContext="") const
 

Protected Attributes

CModInfo::EModuleType m_eType
 
CString m_sDescription
 
std::set< CTimer * > m_sTimers
 
std::set< CSocket * > m_sSockets
 
std::set< CModuleJob * > m_sJobs
 
ModHandle m_pDLL
 
CSockManagerm_pManager
 
CUserm_pUser
 
CIRCNetworkm_pNetwork
 
CClientm_pClient
 
CString m_sModName
 
CString m_sDataDir
 
CString m_sSavePath
 
CString m_sArgs
 
CString m_sModPath
 
CTranslationDomainRefHolder m_Translation
 

Detailed Description

The base class for your own ZNC modules.

If you want to write a module for ZNC, you will have to implement a class which inherits from this class. You should override some of the "On*" functions in this class. These function will then be called by ZNC when the associated event happens.

If such a module hook is called with a non-const reference to e.g. a CString, then it is free to modify that argument to influence ZNC's behavior.

See Also
MODCONSTRUCTOR and MODULEDEFS

Member Enumeration Documentation

Enumerator
UNLOAD 

Your module can throw this enum at any given time.

When this is thrown, the module will be unloaded.

This enum is just used for return from module hooks.

Based on this return, ZNC then decides what to do with the event which caused the module hook.

Enumerator
CONTINUE 

ZNC will continue event processing normally.

This is what you should return normally.

HALT 

This is the same as both CModule::HALTMODS and CModule::HALTCORE together.

HALTMODS 

Stop sending this even to other modules which were not called yet.

Internally, the event is handled normally.

HALTCORE 

Continue calling other modules.

When done, ignore the event in the ZNC core. (For most module hooks this means that a given event won't be forwarded to the connected users)

Constructor & Destructor Documentation

CModule::CModule ( ModHandle  pDLL,
CUser pUser,
CIRCNetwork pNetwork,
const CString sModName,
const CString sDataDir,
CModInfo::EModuleType  eType = CModInfo::NetworkModule 
)
virtual CModule::~CModule ( )
virtual
CModule::CModule ( const CModule )
delete

Member Function Documentation

bool CModule::AddCommand ( const CModCommand Command)
Returns
True if the command was successfully added.
bool CModule::AddCommand ( const CString sCmd,
CModCommand::ModCmdFunc  func,
const CString sArgs = "",
const CString sDesc = "" 
)
Returns
True if the command was successfully added.
Deprecated:
Use the variant with COptionalTranslation.
bool CModule::AddCommand ( const CString sCmd,
const COptionalTranslation Args,
const COptionalTranslation Desc,
std::function< void(const CString &sLine)>  func 
)
Parameters
dDescEither a string "", or the result of t_d()
Returns
True if the command was successfully added.
void CModule::AddHelpCommand ( )

Register the "Help" command.

void CModule::AddJob ( CModuleJob pJob)
bool CModule::AddSocket ( CSocket pSocket)
virtual void CModule::AddSubPage ( TWebSubPage  spSubPage)
inlinevirtual

Registers a sub page for the sidebar.

Parameters
spSubPageThe SubPage instance.
bool CModule::AddTimer ( CTimer pTimer)
bool CModule::AddTimer ( FPTimer_t  pFBCallback,
const CString sLabel,
u_int  uInterval,
u_int  uCycles = 0,
const CString sDescription = "" 
)
MCString::iterator CModule::BeginNV ( )
inline
std::set<CSocket*>::const_iterator CModule::BeginSockets ( ) const
inline

References m_sSockets.

std::set<CTimer*>::const_iterator CModule::BeginTimers ( ) const
inline

References m_sTimers.

void CModule::CancelJob ( CModuleJob pJob)
bool CModule::CancelJob ( const CString sJobName)
void CModule::CancelJobs ( const std::set< CModuleJob * > &  sJobs)
bool CModule::ClearNV ( bool  bWriteToDisk = true)
virtual void CModule::ClearSubPages ( )
inlinevirtual

Removes all registered (AddSubPage'd) SubPages.

bool CModule::DelNV ( const CString sName,
bool  bWriteToDisk = true 
)
void CModule::DelNV ( MCString::iterator  it)
inline
MCString::iterator CModule::EndNV ( )
inline
std::set<CSocket*>::const_iterator CModule::EndSockets ( ) const
inline

References m_sSockets.

std::set<CTimer*>::const_iterator CModule::EndTimers ( ) const
inline

References m_sTimers.

CString CModule::ExpandString ( const CString sStr) const
CString& CModule::ExpandString ( const CString sStr,
CString sRet 
) const
const CModCommand* CModule::FindCommand ( const CString sCmd) const
Returns
The CModCommand instance or nullptr if none was found.
MCString::iterator CModule::FindNV ( const CString sName)
inline
CSocket* CModule::FindSocket ( const CString sSockName)
CTimer* CModule::FindTimer ( const CString sLabel)
const CString& CModule::GetArgs ( ) const
inline

References m_sArgs.

CClient* CModule::GetClient ( ) const
inline
Returns
nullptr except when we are in a client-specific module hook in which case this is the client for which the hook is called.

References m_pClient.

const CString& CModule::GetDescription ( ) const
inline

References m_sDescription.

ModHandle CModule::GetDLL ( )
inline

References m_pDLL.

CSockManager* CModule::GetManager ( ) const
inline

References m_pManager.

const CString& CModule::GetModDataDir ( ) const
inline

Get the module's data dir.

Modules can be accompanied by static data, e.g. skins for webadmin. These function will return the path to that data.

References m_sDataDir.

const CString& CModule::GetModName ( ) const
inline
Returns
The name of the module.

References m_sModName.

CString CModule::GetModNick ( ) const
Returns
The nick of the module. This is just the module name prefixed by the status prefix.
const CString& CModule::GetModPath ( ) const
inline

References m_sModPath.

CIRCNetwork* CModule::GetNetwork ( ) const
inline
Returns
nullptr except when we are in a network-specific module hook in which case this is the network for which the hook is called.

References m_pNetwork.

CString CModule::GetNV ( const CString sName) const
const CString& CModule::GetSavePath ( ) const
virtual VWebSubPages& CModule::GetSubPages ( )
inlinevirtual

Returns a list of all registered SubPages.

Don't mess with it too much.

Returns
The List.
CModInfo::EModuleType CModule::GetType ( ) const
inline

References m_eType.

CUser* CModule::GetUser ( ) const
inline
Returns
For user modules this returns the user for which this module was loaded. For global modules this returns nullptr, except when we are in a user-specific module hook in which case this is the user pointer.

References m_pUser.

virtual CString CModule::GetWebFilesPath ( )
virtual
virtual CString CModule::GetWebMenuTitle ( )
inlinevirtual

Return the title of the module's section in the web interface's side bar.

Returns
The Title.
virtual CString CModule::GetWebPath ( )
virtual
bool CModule::HandleCommand ( const CString sLine)

This function tries to dispatch the given command via the correct instance of CModCommand.

Before this can be called, commands have to be added via AddCommand(). If no matching commands are found then OnUnknownModCommand will be called.

Parameters
sLineThe command line to handle.
Returns
True if something was done, else false.
void CModule::HandleHelpCommand ( const CString sLine = "")

Send a description of all registered commands via PutModule().

Parameters
sLineThe help command that is being asked for.
bool CModule::HasNV ( const CString sName) const
inline
virtual bool CModule::IsClientCapSupported ( CClient pClient,
const CString sCap,
bool  bState 
)
virtual

Called only to check if your module supports turning on/off named capability.

Parameters
pClientThe client which wants to enable/disable a capability.
sCapname of capability.
bStateOn or off, depending on which case is interesting for client.
Returns
true if your module supports this capability in the specified state.
virtual void CModule::ListSockets ( )
virtual
virtual void CModule::ListTimers ( )
virtual
bool CModule::LoadRegistry ( )
bool CModule::MoveRegistry ( const CString sPath)
virtual EModRet CModule::OnAddNetwork ( CIRCNetwork Network,
CString sErrorRet 
)
virtual

This module hook is called when a network is being added.

Parameters
NetworkThe new IRC network.
sErrorRetA message that may be displayed to the user if the module stops adding the network.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnAddUser ( CUser User,
CString sErrorRet 
)
virtual

This module hook is called when a user is being added.

Parameters
UserThe user which will be added.
sErrorRetA message that may be displayed to the user if the module stops adding the user.
Returns
See CModule::EModRet.
virtual bool CModule::OnBoot ( )
virtual

This module hook is called during ZNC startup.

Only modules loaded from znc.conf get this call.

Returns
false to abort ZNC startup.
virtual EModRet CModule::OnBroadcast ( CString sMessage)
virtual

This module hook is called when a message is broadcasted to all users.

Parameters
sMessageThe message that is broadcasted.
Returns
see CModule::EModRet
virtual EModRet CModule::OnChanAction ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual
virtual EModRet CModule::OnChanActionMessage ( CActionMessage Message)
virtual

Called when we receive a channel CTCP ACTION ("/me" in a channel) from IRC.

Since
1.7.0
Parameters
MessageThe action message
Returns
See CModule::EModRet.
virtual EModRet CModule::OnChanBufferEnding ( CChan Chan,
CClient Client 
)
virtual

Called after a channel buffer was played back to a client.

Parameters
ChanThe channel which was played back.
ClientThe client the buffer was played back to.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnChanBufferPlayLine ( CChan Chan,
CClient Client,
CString sLine 
)
virtual
virtual EModRet CModule::OnChanBufferPlayLine2 ( CChan Chan,
CClient Client,
CString sLine,
const timeval &  tv 
)
virtual
virtual EModRet CModule::OnChanBufferPlayMessage ( CMessage Message)
virtual

Called for each message during a channel's buffer play back.

Since
1.7.0
Parameters
MessageThe playback message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnChanBufferStarting ( CChan Chan,
CClient Client 
)
virtual

Called before a channel buffer is played back to a client.

Parameters
ChanThe channel which will be played back.
ClientThe client the buffer will be played back to.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnChanCTCP ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual
virtual EModRet CModule::OnChanCTCPMessage ( CCTCPMessage Message)
virtual

Called when we receive a channel CTCP request from IRC.

Since
1.7.0
Parameters
MessageThe CTCP request message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnChanMsg ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual
virtual EModRet CModule::OnChanNotice ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual
virtual EModRet CModule::OnChanNoticeMessage ( CNoticeMessage Message)
virtual

Called when we receive a channel NOTICE message from IRC.

Since
1.7.0
Parameters
MessageThe notice message.
Returns
See CModule::EModRet.
virtual void CModule::OnChanPermission ( const CNick OpNick,
const CNick Nick,
CChan Channel,
unsigned char  uMode,
bool  bAdded,
bool  bNoChange 
)
virtual
Deprecated:
. Use OnChanPermission3.
virtual void CModule::OnChanPermission2 ( const CNick pOpNick,
const CNick Nick,
CChan Channel,
unsigned char  uMode,
bool  bAdded,
bool  bNoChange 
)
virtual
Deprecated:
. Use OnChanPermission3.
virtual void CModule::OnChanPermission3 ( const CNick pOpNick,
const CNick Nick,
CChan Channel,
char  cMode,
bool  bAdded,
bool  bNoChange 
)
virtual

This module hook is called when a user mode on a channel changes.

Parameters
pOpNickThe nick who sent the mode change, or nullptr if set by server.
NickThe nick whose channel mode changes.
ChannelThe channel on which the user mode is changed.
cModeThe mode character that is changed, e.g. '@' for op.
bAddedTrue if the mode is added, else false.
bNoChangetrue if this mode change doesn't change anything because the nick already had this permission.
See Also
CIRCSock::GetModeType() for converting uMode into a mode (e.g. 'o' for op).
virtual EModRet CModule::OnChanTextMessage ( CTextMessage Message)
virtual

Called when we receive a channel PRIVMSG message from IRC.

Since
1.7.0
Parameters
MessageThe channel message.
Returns
See CModule::EModRet.
virtual void CModule::OnClientCapLs ( CClient pClient,
SCString ssCaps 
)
virtual

Called when a client told us CAP LS.

Use ssCaps.insert("cap-name") for announcing capabilities which your module supports.

Parameters
pClientThe client which requested the list.
ssCapsset of caps which will be sent to client.
virtual void CModule::OnClientCapRequest ( CClient pClient,
const CString sCap,
bool  bState 
)
virtual

Called when we actually need to turn a capability on or off for a client.

If implementing a custom capability, make sure to call pClient->SetTagSupport("tag-name", bState) for each tag that the capability provides.

Parameters
pClientThe client which requested the capability.
sCapname of wanted capability.
bStateOn or off, depending on which case client needs.
See Also
CClient::SetTagSupport()
virtual void CModule::OnClientConnect ( CZNCSock pSock,
const CString sHost,
unsigned short  uPort 
)
virtual

This module hook is called when there is an incoming connection on any of ZNC's listening sockets.

Parameters
pSockThe incoming client socket.
sHostThe IP the client is connecting from.
uPortThe port the client is connecting from.
virtual void CModule::OnClientDisconnect ( )
virtual

Called when a client disconnected from ZNC.

virtual void CModule::OnClientLogin ( )
virtual

Called when a client successfully logged in to ZNC.

virtual EModRet CModule::OnCTCPReply ( CNick Nick,
CString sMessage 
)
virtual
virtual EModRet CModule::OnCTCPReplyMessage ( CCTCPMessage Message)
virtual

Called when we receive a CTCP reply from IRC.

Since
1.7.0
Parameters
MessageThe CTCP reply message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnDeleteNetwork ( CIRCNetwork Network)
virtual

This module hook is called when a network is deleted.

Parameters
NetworkThe IRC network which is going to be deleted.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnDeleteUser ( CUser User)
virtual

This module hook is called when a user is deleted.

Parameters
UserThe user which will be deleted.
Returns
See CModule::EModRet.
virtual void CModule::OnDeop ( const CNick OpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual
virtual void CModule::OnDeop2 ( const CNick pOpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual

Called when a nick is deopped on a channel.

virtual void CModule::OnDevoice ( const CNick OpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual
virtual void CModule::OnDevoice2 ( const CNick pOpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual

Called when a nick is devoiced on a channel.

virtual bool CModule::OnEmbeddedWebRequest ( CWebSock WebSock,
const CString sPageName,
CTemplate Tmpl 
)
virtual

Using this hook, module can embed web stuff directly to different places.

This method is called whenever embededded modules I/O happens. Name of used .tmpl file (if any) is up to caller.

Parameters
WebSockSocket for web connection, don't do bad things with it.
sPageNameDescribes the place where web stuff is embedded to.
TmplTemplate. Depending on context, you can do various stuff with it.
Returns
If you don't need to embed web stuff to the specified place, just return false. Exact meaning of return value is up to caller, and depends on context.
virtual void CModule::OnFailedLogin ( const CString sUsername,
const CString sRemoteIP 
)
virtual

Called after a client login was rejected.

Parameters
sUsernameThe username that tried to log in.
sRemoteIPThe IP address from which the client tried to login.
virtual void CModule::OnGetAvailableMods ( std::set< CModInfo > &  ssMods,
CModInfo::EModuleType  eType 
)
virtual

Called when list of available mods is requested.

Parameters
ssModsput new modules here.
bGlobaltrue if global modules are needed.
virtual EModRet CModule::OnGetModInfo ( CModInfo ModInfo,
const CString sModule,
bool &  bSuccess,
CString sRetMsg 
)
virtual

Called when info about a module is needed.

Parameters
[out]ModInfoput result here, if your module knows it.
sModulename of the module.
bSuccessthis module provided info about the module.
sRetMsgtext describing possible issues.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnInvite ( const CNick Nick,
const CString sChan 
)
virtual

Called when user is invited into a channel.

Parameters
NickThe nick who invited you.
sChanThe channel the user got invited into
Returns
See CModule::EModRet.
Todo:
Add OnInviteMessage() hook
virtual void CModule::OnIRCConnected ( )
virtual

This module hook is called after a successful login to IRC.

virtual EModRet CModule::OnIRCConnecting ( CIRCSock pIRCSock)
virtual

This module hook is called just before ZNC tries to establish a connection to an IRC server.

Parameters
pIRCSockThe socket that will be used for the connection.
Returns
See CModule::EModRet.
virtual void CModule::OnIRCConnectionError ( CIRCSock pIRCSock)
virtual

This module hook is called when a CIRCSock fails to connect or a module returned HALTCORE from OnIRCConnecting.

Parameters
pIRCSockThe socket that failed to connect.
virtual void CModule::OnIRCDisconnected ( )
virtual

This module hook is called when a user gets disconnected from IRC.

virtual EModRet CModule::OnIRCRegistration ( CString sPass,
CString sNick,
CString sIdent,
CString sRealName 
)
virtual

This module hook is called before loging in to the IRC server.

The low-level connection is established at this point, but SSL handshakes didn't necessarily finish yet.

Parameters
sPassThe server password that will be used.
sNickThe nick that will be used.
sIdentThe protocol identity that will be used. This is not the ident string that is transferred via e.g. oidentd!
sRealNameThe real name that will be used.
Returns
See CModule::EModRet.
virtual void CModule::OnJoin ( const CNick Nick,
CChan Channel 
)
virtual
virtual EModRet CModule::OnJoining ( CChan Channel)
virtual

This module hook is called just before ZNC tries to join an IRC channel.

Parameters
ChanThe channel which is about to get joined.
Returns
See CModule::EModRet.
virtual void CModule::OnJoinMessage ( CJoinMessage Message)
virtual

Called when a nick joins a channel.

Since
1.7.0
Parameters
MessageThe join message.
virtual void CModule::OnKick ( const CNick OpNick,
const CString sKickedNick,
CChan Channel,
const CString sMessage 
)
virtual
virtual void CModule::OnKickMessage ( CKickMessage Message)
virtual

Called when a nick is kicked from a channel.

Since
1.7.0
Parameters
MessageThe kick message.
virtual bool CModule::OnLoad ( const CString sArgsi,
CString sMessage 
)
virtual

This module hook is called when a module is loaded.

Parameters
sArgsiThe arguments for the modules.
sMessageA message that may be displayed to the user after loading the module. Useful for returning error messages.
Returns
true if the module loaded successfully, else false.
virtual EModRet CModule::OnLoginAttempt ( std::shared_ptr< CAuthBase Auth)
virtual

This module hook is called when a client tries to login.

If your module wants to handle the login attempt, it must return CModule::EModRet::HALT;

Parameters
AuthThe necessary authentication info for this login attempt.
Returns
See CModule::EModRet.
virtual void CModule::OnModCommand ( const CString sCommand)
virtual

Called when a command to your module is sent, e.g.

query to *modname.

Parameters
sCommandThe command that was sent.
virtual void CModule::OnModCTCP ( const CString sMessage)
virtual

Called when your module nick was sent a CTCP message.

OnModCommand() won't be called for this message.

Parameters
sMessageThe message which was sent.
virtual void CModule::OnMode ( const CNick OpNick,
CChan Channel,
char  uMode,
const CString sArg,
bool  bAdded,
bool  bNoChange 
)
virtual
virtual void CModule::OnMode2 ( const CNick pOpNick,
CChan Channel,
char  uMode,
const CString sArg,
bool  bAdded,
bool  bNoChange 
)
virtual

Called on an individual channel mode change.

Parameters
pOpNickThe nick who changes the channel mode, or nullptr if set by server.
ChannelThe channel whose mode is changed.
uModeThe mode character that is changed.
sArgThe argument to the mode character, if any.
bAddedTrue if this mode is added ("+"), else false.
bNoChangeTrue if this mode was already effective before.
virtual void CModule::OnModNotice ( const CString sMessage)
virtual

Called when a your module nick was sent a notice.

Parameters
sMessageThe message which was sent.
virtual EModRet CModule::OnModuleLoading ( const CString sModName,
const CString sArgs,
CModInfo::EModuleType  eType,
bool &  bSuccess,
CString sRetMsg 
)
virtual

Called when a module is going to be loaded.

Parameters
sModNamename of the module.
eTypewanted type of the module (user/global).
sArgsarguments of the module.
[out]bSuccessthe module was loaded successfully as result of this module hook?
[out]sRetMsgtext about loading of the module.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnModuleUnloading ( CModule pModule,
bool &  bSuccess,
CString sRetMsg 
)
virtual

Called when a module is going to be unloaded.

Parameters
pModulethe module.
[out]bSuccessthe module was unloaded successfully as result of this module hook?
[out]sRetMsgtext about unloading of the module.
Returns
See CModule::EModRet.
virtual void CModule::OnNick ( const CNick Nick,
const CString sNewNick,
const std::vector< CChan * > &  vChans 
)
virtual
virtual void CModule::OnNickMessage ( CNickMessage Message,
const std::vector< CChan * > &  vChans 
)
virtual

Called when a nickname change occurs.

Since
1.7.0
Parameters
MessageThe nick message.
vChansChannels which we and nick share.
virtual EModRet CModule::OnNumericMessage ( CNumericMessage Message)
virtual

Called when a numeric message is received from the IRC server.

Since
1.7.0
Parameters
MessageThe received message.
Returns
See CModule::EModRet.
virtual void CModule::OnOp ( const CNick OpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual
virtual void CModule::OnOp2 ( const CNick pOpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual

Called when a nick is opped on a channel.

virtual void CModule::OnPart ( const CNick Nick,
CChan Channel,
const CString sMessage 
)
virtual
virtual void CModule::OnPartMessage ( CPartMessage Message)
virtual

Called when a nick parts a channel.

Since
1.7.0
Parameters
MessageThe part message.
virtual void CModule::OnPostRehash ( )
virtual

This module hook is called after a successful rehash.

virtual void CModule::OnPreRehash ( )
virtual

Called just before znc.conf is rehashed.

virtual EModRet CModule::OnPrivAction ( CNick Nick,
CString sMessage 
)
virtual
virtual EModRet CModule::OnPrivActionMessage ( CActionMessage Message)
virtual

Called when we receive a private CTCP ACTION ("/me" in query) from IRC.

Since
1.7.0
Parameters
MessageThe action message
Returns
See CModule::EModRet.
virtual EModRet CModule::OnPrivBufferEnding ( CQuery Query,
CClient Client 
)
virtual

Called after a query buffer was played back to a client.

Since
1.7.0
Parameters
QueryThe query which was played back.
ClientThe client the buffer was played back to.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnPrivBufferPlayLine ( CClient Client,
CString sLine 
)
virtual
virtual EModRet CModule::OnPrivBufferPlayLine2 ( CClient Client,
CString sLine,
const timeval &  tv 
)
virtual
virtual EModRet CModule::OnPrivBufferPlayMessage ( CMessage Message)
virtual

Called for each message during a query's buffer play back.

Since
1.7.0
Parameters
MessageThe playback message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnPrivBufferStarting ( CQuery Query,
CClient Client 
)
virtual

Called before a query buffer is played back to a client.

Since
1.7.0
Parameters
QueryThe query which will be played back.
ClientThe client the buffer will be played back to.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnPrivCTCP ( CNick Nick,
CString sMessage 
)
virtual
virtual EModRet CModule::OnPrivCTCPMessage ( CCTCPMessage Message)
virtual

Called when we receive a private CTCP request from IRC.

Since
1.7.0
Parameters
MessageThe CTCP request message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnPrivMsg ( CNick Nick,
CString sMessage 
)
virtual
virtual EModRet CModule::OnPrivNotice ( CNick Nick,
CString sMessage 
)
virtual
virtual EModRet CModule::OnPrivNoticeMessage ( CNoticeMessage Message)
virtual

Called when we receive a private NOTICE message from IRC.

Since
1.7.0
Parameters
MessageThe notice message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnPrivTextMessage ( CTextMessage Message)
virtual

Called when we receive a private PRIVMSG message from IRC.

Since
1.7.0
Parameters
MessageThe private message.
Returns
See CModule::EModRet.
virtual void CModule::OnQuit ( const CNick Nick,
const CString sMessage,
const std::vector< CChan * > &  vChans 
)
virtual
virtual void CModule::OnQuitMessage ( CQuitMessage Message,
const std::vector< CChan * > &  vChans 
)
virtual

Called when a nick quit from IRC.

Since
1.7.0
Parameters
MessageThe quit message.
vChansList of channels which you and nick share.
virtual EModRet CModule::OnRaw ( CString sLine)
virtual

Called on any raw IRC line received from the IRC server.

Parameters
sLineThe line read from the server.
Note
The line does not include message tags. Use OnRawMessage() to access them.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnRawMessage ( CMessage Message)
virtual

Called on any raw message received from the IRC server.

Since
1.7.0
Parameters
MessageThe received message.
Returns
See CModule::EModRet.
virtual void CModule::OnRawMode ( const CNick OpNick,
CChan Channel,
const CString sModes,
const CString sArgs 
)
virtual
virtual void CModule::OnRawMode2 ( const CNick pOpNick,
CChan Channel,
const CString sModes,
const CString sArgs 
)
virtual

Called on any channel mode change.

This is called before the more detailed mode hooks like e.g. OnOp() and OnMode().

Parameters
pOpNickThe nick who changes the channel mode, or nullptr if set by server.
ChannelThe channel whose mode is changed.
sModesThe raw mode change, e.g. "+s-io".
sArgsAll arguments to the mode change from sModes.
virtual EModRet CModule::OnSendToClient ( CString sLine,
CClient Client 
)
virtual
virtual EModRet CModule::OnSendToClientMessage ( CMessage Message)
virtual

Called immediately before ZNC sends a raw traffic line to a client.

Since
1.7.0
Parameters
MessageThe message being sent to the client.
Warning
Calling PutUser() from within this hook leads to infinite recursion.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnSendToIRC ( CString sLine)
virtual
virtual EModRet CModule::OnSendToIRCMessage ( CMessage Message)
virtual

Called immediately before ZNC sends a raw traffic line to the IRC server.

Since
1.7.0
Parameters
MessageThe message being sent to the IRC server.
Warning
Calling PutIRC() from within this hook leads to infinite recursion.
Returns
See CModule::EModRet.
virtual bool CModule::OnServerCapAvailable ( const CString sCap)
virtual

Called for every CAP received via CAP LS from server.

Parameters
sCapcapability supported by server.
Returns
true if your module supports this CAP and needs to turn it on with CAP REQ.
virtual void CModule::OnServerCapResult ( const CString sCap,
bool  bSuccess 
)
virtual

Called for every CAP accepted or rejected by server (with CAP ACK or CAP NAK after our CAP REQ).

Parameters
sCapcapability accepted/rejected by server.
bSuccesstrue if capability was accepted, false if rejected.
virtual EModRet CModule::OnStatusCommand ( CString sCommand)
virtual

Called when a command to *status is sent.

Parameters
sCommandThe command sent.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnTimerAutoJoin ( CChan Channel)
virtual

This module hook is called just before ZNC tries to join a channel by itself because it's in the config but wasn't joined yet.

Parameters
ChannelThe channel which will be joined.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnTopic ( CNick Nick,
CChan Channel,
CString sTopic 
)
virtual
virtual EModRet CModule::OnTopicMessage ( CTopicMessage Message)
virtual

Called when we receive a channel topic change from IRC.

Since
1.7.0
Parameters
MessageThe topic message.
Returns
See CModule::EModRet.
virtual void CModule::OnUnknownModCommand ( const CString sCommand)
virtual

This is similar to OnModCommand(), but it is only called if HandleCommand didn't find any that wants to handle this.

This is only called if HandleCommand() is called, which practically means that this is only called if you don't overload OnModCommand().

Parameters
sCommandThe command that was sent.
virtual EModRet CModule::OnUnknownUserRaw ( CClient pClient,
CString sLine 
)
virtual

This function behaves like CModule::OnUserRaw(), but is also called before the client successfully logged in to ZNC.

You should always prefer to use CModule::OnUserRaw() if possible.

Parameters
pClientThe client which send this line.
sLineThe raw traffic line which the client sent.
virtual EModRet CModule::OnUnknownUserRawMessage ( CMessage Message)
virtual
virtual EModRet CModule::OnUserAction ( CString sTarget,
CString sMessage 
)
virtual
virtual EModRet CModule::OnUserActionMessage ( CActionMessage Message)
virtual

Called when a client sends a CTCP ACTION request ("/me").

Since
1.7.0
Parameters
MessageThe action message.
Returns
See CModule::EModRet.
Note
CModule::OnUserCTCPMessage() will not be called for this message.
virtual EModRet CModule::OnUserCTCP ( CString sTarget,
CString sMessage 
)
virtual
virtual EModRet CModule::OnUserCTCPMessage ( CCTCPMessage Message)
virtual

This module hook is called when a client sends a CTCP request.

Since
1.7.0
Parameters
MessageThe CTCP request message.
Returns
See CModule::EModRet.
Note
This is not called for CTCP ACTION messages, use CModule::OnUserActionMessage() instead.
virtual EModRet CModule::OnUserCTCPReply ( CString sTarget,
CString sMessage 
)
virtual
virtual EModRet CModule::OnUserCTCPReplyMessage ( CCTCPMessage Message)
virtual

This module hook is called when a client sends a CTCP reply.

Since
1.7.0
Parameters
MessageThe CTCP reply message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserJoin ( CString sChannel,
CString sKey 
)
virtual
virtual EModRet CModule::OnUserJoinMessage ( CJoinMessage Message)
virtual

This hooks is called when a user sends a JOIN message.

Since
1.7.0
Parameters
MessageThe join message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserMsg ( CString sTarget,
CString sMessage 
)
virtual
virtual EModRet CModule::OnUserNotice ( CString sTarget,
CString sMessage 
)
virtual
virtual EModRet CModule::OnUserNoticeMessage ( CNoticeMessage Message)
virtual

This module hook is called when a user sends a NOTICE message.

Since
1.7.0
Parameters
MessageThe message which was sent.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserPart ( CString sChannel,
CString sMessage 
)
virtual
virtual EModRet CModule::OnUserPartMessage ( CPartMessage Message)
virtual

This hooks is called when a user sends a PART message.

Since
1.7.0
Parameters
MessageThe part message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserQuit ( CString sMessage)
virtual
virtual EModRet CModule::OnUserQuitMessage ( CQuitMessage Message)
virtual

This module hook is called when a client quits ZNC.

Since
1.7.0
Parameters
MessageThe quit message the client sent.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserRaw ( CString sLine)
virtual

This module hook is called when a client sends a raw traffic line to ZNC.

Parameters
sLineThe raw traffic line sent.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserRawMessage ( CMessage Message)
virtual

This module hook is called when a client sends any message to ZNC.

Since
1.7.0
Parameters
MessageThe message sent.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserTextMessage ( CTextMessage Message)
virtual

This module hook is called when a user sends a PRIVMSG message.

Since
1.7.0
Parameters
MessageThe message which was sent.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserTopic ( CString sChannel,
CString sTopic 
)
virtual
virtual EModRet CModule::OnUserTopicMessage ( CTopicMessage Message)
virtual

This module hook is called when a user wants to change a channel topic.

Since
1.7.0
Parameters
MessageThe topic message.
Returns
See CModule::EModRet.
virtual EModRet CModule::OnUserTopicRequest ( CString sChannel)
virtual

This hook is called when a user requests a channel's topic.

Parameters
sChannelThe channel for which the request is.
Returns
See CModule::EModRet.
virtual void CModule::OnVoice ( const CNick OpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual
virtual void CModule::OnVoice2 ( const CNick pOpNick,
const CNick Nick,
CChan Channel,
bool  bNoChange 
)
virtual

Called when a nick is voiced on a channel.

virtual bool CModule::OnWebPreRequest ( CWebSock WebSock,
const CString sPageName 
)
virtual

For WebMods: Called before the list of registered SubPages will be checked.

Important: If you return true, you need to take care of calling WebSock.Close! This allows for stuff like returning non-templated data, long-polling and other fun.

Parameters
WebSockThe active request.
sPageNameThe name of the page that has been requested.
Returns
true if you handled the page request or false if the name is to be checked against the list of registered SubPages and their permission settings.
virtual bool CModule::OnWebRequest ( CWebSock WebSock,
const CString sPageName,
CTemplate Tmpl 
)
virtual

If OnWebPreRequest returned false, and the RequiresAdmin/IsAdmin check has been passed, this method will be called with the page name.

It will also be called for pages that have NOT been specifically registered with AddSubPage.

Parameters
WebSockThe active request.
sPageNameThe name of the page that has been requested.
TmplThe active template. You can add variables, loops and stuff to it.
Returns
You MUST return true if you want the template to be evaluated and sent to the browser. Return false if you called Redirect() or PrintErrorPage(). If you didn't, a 404 page will be sent.
CModule& CModule::operator= ( const CModule )
delete
virtual bool CModule::PutIRC ( const CString sLine)
virtual

This function sends a given IRC line to the IRC server, if we are connected to one.

Else this line is discarded.

Parameters
sLineThe line which should be sent.
Returns
true if the line was queued for sending.
virtual bool CModule::PutIRC ( const CMessage Message)
virtual

This function sends a given IRC message to the IRC server, if we are connected to one.

Else this message is discarded.

Parameters
MessageThe message which should be sent.
Returns
true if the message was queued for sending.
virtual bool CModule::PutModNotice ( const CString sLine)
virtual

Send a notice from your module nick.

If we are in a module hook for a specific client, only that client gets this notice, else all clients will receive it.

Parameters
sLineThe line which should be sent.
Returns
true if the line was sent to at least one client.
virtual bool CModule::PutModule ( const CString sLine)
virtual

This function sends a query from your module nick.

If we are in a module hook for a specific client, only that client gets this message, else all connected clients will receive it.

Parameters
sLineThe message which should be sent.
Returns
true if the line was sent to at least one client.
virtual unsigned int CModule::PutModule ( const CTable table)
virtual

This function calls CModule::PutModule(const CString&, const CString&, const CString&) for each line in the table.

Parameters
tableThe table which should be send.
Returns
The number of lines sent.
virtual bool CModule::PutStatus ( const CString sLine)
virtual

This function generates a query from *status.

If we are in a module hook for a specific client, only that client gets this message, else all connected clients will receive it.

Parameters
sLineThe message which should be sent from *status.
Returns
true if the line was sent to at least one client.
virtual bool CModule::PutUser ( const CString sLine)
virtual

This function sends a given raw IRC line to a client.

If we are in a module hook which is called for a specific client, only that client will get the line, else all connected clients will receive this line.

Parameters
sLineThe line which should be sent.
Returns
true if the line was sent to at least one client.
bool CModule::RemCommand ( const CString sCmd)
Returns
True if the command was successfully removed.
bool CModule::RemSocket ( CSocket pSocket)
bool CModule::RemSocket ( const CString sSockName)
bool CModule::RemTimer ( CTimer pTimer)
bool CModule::RemTimer ( const CString sLabel)
bool CModule::SaveRegistry ( ) const
void CModule::SetArgs ( const CString s)
inline

References m_sArgs.

void CModule::SetClient ( CClient pClient)
void CModule::SetDescription ( const CString s)
inline

References m_sDescription.

void CModule::SetModPath ( const CString s)
inline

References m_sModPath.

void CModule::SetNetwork ( CIRCNetwork pNetwork)
bool CModule::SetNV ( const CString sName,
const CString sValue,
bool  bWriteToDisk = true 
)
void CModule::SetType ( CModInfo::EModuleType  eType)
inline

References m_eType.

void CModule::SetUser ( CUser pUser)
CDelayedTranslation CModule::t_d ( const CString sEnglish,
const CString sContext = "" 
) const
CInlineFormatMessage CModule::t_f ( const CString sEnglish,
const CString sContext = "" 
) const
CInlineFormatMessage CModule::t_p ( const CString sEnglish,
const CString sEnglishes,
int  iNum,
const CString sContext = "" 
) const
CString CModule::t_s ( const CString sEnglish,
const CString sContext = "" 
) const
bool CModule::UnlinkJob ( CModuleJob pJob)
bool CModule::UnlinkSocket ( CSocket pSocket)
bool CModule::UnlinkTimer ( CTimer pTimer)
void CModule::Unload ( )
inline

This function throws CModule::UNLOAD which causes this module to be unloaded.

References UNLOAD.

virtual bool CModule::ValidateWebRequestCSRFCheck ( CWebSock WebSock,
const CString sPageName 
)
virtual

If ValidateWebRequestCSRFCheck returned false, a CSRF error will be printed.

Parameters
WebSockThe active request.
sPageNameThe name of the page that has been requested.
Returns
You MUST return true if the CSRF token is valid.
virtual bool CModule::WebRequiresAdmin ( )
inlinevirtual

Return true if this module should only be usable for admins on the web.

Returns
false if normal users can use this module's web pages as well.
virtual bool CModule::WebRequiresLogin ( )
inlinevirtual

Modules which can only be used with an active user session have to return true here.

Returns
false for modules that can do stuff for non-logged in web users as well.

Member Data Documentation

CModInfo::EModuleType CModule::m_eType
protected

Referenced by GetType(), and SetType().

CClient* CModule::m_pClient
protected

Referenced by GetClient().

ModHandle CModule::m_pDLL
protected

Referenced by GetDLL().

CSockManager* CModule::m_pManager
protected

Referenced by GetManager().

CIRCNetwork* CModule::m_pNetwork
protected

Referenced by GetNetwork().

CUser* CModule::m_pUser
protected

Referenced by GetUser().

CString CModule::m_sArgs
protected

Referenced by GetArgs(), and SetArgs().

CString CModule::m_sDataDir
protected

Referenced by GetModDataDir().

CString CModule::m_sDescription
protected

Referenced by GetDescription(), and SetDescription().

std::set<CModuleJob*> CModule::m_sJobs
protected
CString CModule::m_sModName
protected

Referenced by GetModName().

CString CModule::m_sModPath
protected

Referenced by GetModPath(), and SetModPath().

CString CModule::m_sSavePath
protected
std::set<CSocket*> CModule::m_sSockets
protected

Referenced by BeginSockets(), and EndSockets().

std::set<CTimer*> CModule::m_sTimers
protected

Referenced by BeginTimers(), and EndTimers().

CTranslationDomainRefHolder CModule::m_Translation
protected

The documentation for this class was generated from the following file: