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

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

#include <Modules.h>

+ Inheritance diagram for CModule:
+ 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)
 
virtual ~CModule ()
 
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 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 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. More...
 
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 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 OnQuit (const CNick &Nick, const CString &sMessage, const std::vector< CChan * > &vChans)
 Called when a nick quit from IRC. More...
 
virtual void OnNick (const CNick &Nick, const CString &sNewNick, const std::vector< CChan * > &vChans)
 Called when a nickname change occurs. More...
 
virtual void OnKick (const CNick &OpNick, const CString &sKickedNick, CChan &Channel, const CString &sMessage)
 Called when a nick is kicked from a channel. More...
 
virtual void OnJoin (const CNick &Nick, CChan &Channel)
 Called when a nick joins a channel. More...
 
virtual void OnPart (const CNick &Nick, CChan &Channel, const CString &sMessage)
 Called when a nick parts a channel. More...
 
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 OnChanBufferPlayLine (CChan &Chan, CClient &Client, CString &sLine)
 Called when for each line during a channel's buffer play back. More...
 
virtual EModRet OnPrivBufferPlayLine (CClient &Client, CString &sLine)
 Called when a line from the query buffer is played back. More...
 
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 OnUserCTCPReply (CString &sTarget, CString &sMessage)
 This module hook is called when a client sends a CTCP reply. More...
 
virtual EModRet OnUserCTCP (CString &sTarget, CString &sMessage)
 This module hook is called when a client sends a CTCP request. More...
 
virtual EModRet OnUserAction (CString &sTarget, CString &sMessage)
 Called when a client sends a CTCP ACTION request ("/me"). More...
 
virtual EModRet OnUserMsg (CString &sTarget, CString &sMessage)
 This module hook is called when a user sends a normal IRC message. More...
 
virtual EModRet OnUserNotice (CString &sTarget, CString &sMessage)
 This module hook is called when a user sends a notice message. More...
 
virtual EModRet OnUserJoin (CString &sChannel, CString &sKey)
 This hooks is called when a user sends a JOIN message. More...
 
virtual EModRet OnUserPart (CString &sChannel, CString &sMessage)
 This hooks is called when a user sends a PART message. More...
 
virtual EModRet OnUserTopic (CString &sChannel, CString &sTopic)
 This module hook is called when a user wants to change a channel topic. More...
 
virtual EModRet OnUserTopicRequest (CString &sChannel)
 This hook is called when a user requests a channel's topic. More...
 
virtual EModRet OnCTCPReply (CNick &Nick, CString &sMessage)
 Called when we receive a CTCP reply from IRC. More...
 
virtual EModRet OnPrivCTCP (CNick &Nick, CString &sMessage)
 Called when we receive a private CTCP request from IRC. More...
 
virtual EModRet OnChanCTCP (CNick &Nick, CChan &Channel, CString &sMessage)
 Called when we receive a channel CTCP request from IRC. More...
 
virtual EModRet OnPrivAction (CNick &Nick, CString &sMessage)
 Called when we receive a private CTCP ACTION ("/me" in query) from IRC. More...
 
virtual EModRet OnChanAction (CNick &Nick, CChan &Channel, CString &sMessage)
 Called when we receive a channel CTCP ACTION ("/me" in a channel) from IRC. More...
 
virtual EModRet OnPrivMsg (CNick &Nick, CString &sMessage)
 Called when we receive a private message from IRC. More...
 
virtual EModRet OnChanMsg (CNick &Nick, CChan &Channel, CString &sMessage)
 Called when we receive a channel message from IRC. More...
 
virtual EModRet OnPrivNotice (CNick &Nick, CString &sMessage)
 Called when we receive a private notice. More...
 
virtual EModRet OnChanNotice (CNick &Nick, CChan &Channel, CString &sMessage)
 Called when we receive a channel notice. More...
 
virtual EModRet OnTopic (CNick &Nick, CChan &Channel, CString &sTopic)
 Called when we receive a channel topic change from IRC. More...
 
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 OnSendToClient (CString &sLine, CClient &Client)
 Called when ZNC sends a raw traffic line to a client. More...
 
virtual EModRet OnSendToIRC (CString &sLine)
 Called when ZNC sends a raw traffic line to the IRC server. More...
 
ModHandle GetDLL ()
 
virtual bool PutIRC (const CString &sLine)
 This function sends a given raw IRC line 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 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 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 SetNV (const CString &sName, const CString &sValue, bool bWriteToDisk=true)
 
CString GetNV (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 ()
 
CIRCNetworkGetNetwork ()
 
CClientGetClient ()
 
CSockManagerGetManager ()
 
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 (CSmartPtr< 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::OnRaw(), but is also called before the client successfully logged in to ZNC. More...
 
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...
 

Static Public Member Functions

static double GetCoreVersion ()
 

Protected Attributes

CModInfo::EModuleType m_eType
 
CString m_sDescription
 
std::set< CTimer * > m_sTimers
 
std::set< CSocket * > m_sSockets
 
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
 

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 
)
virtual CModule::~CModule ( )
virtual

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.
void CModule::AddHelpCommand ( )

Register the "Help" command.

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.

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

Referenced by MCString_iter::is_end().

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 NULL 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 ( )
inline

References m_pClient.

static double CModule::GetCoreVersion ( )
inlinestatic

References VERSION.

const CString& CModule::GetDescription ( ) const
inline

References m_sDescription.

ModHandle CModule::GetDLL ( )
inline

References m_pDLL.

CSockManager* CModule::GetManager ( )
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 ( )
inline
Returns
NULL 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_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.

Reimplemented in CPyModule, and CPerlModule.

CModInfo::EModuleType CModule::GetType ( ) const
inline

References m_eType.

CUser* CModule::GetUser ( )
inline
Returns
For user modules this returns the user for which this module was loaded. For global modules this returns NULL, 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.

Reimplemented in CPyModule, and CPerlModule.

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.
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.

Reimplemented in CPyModule.

virtual void CModule::ListSockets ( )
virtual
virtual void CModule::ListTimers ( )
virtual
bool CModule::LoadRegistry ( )
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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnChanAction ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual

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

This is called after CModule::OnChanCTCP().

Parameters
NickThe nick the action came from.
ChannelThe channel the action was sent to.
sMessageThe action message
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnChanBufferPlayLine ( CChan Chan,
CClient Client,
CString sLine 
)
virtual

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

Parameters
ChanThe channel this playback is from.
ClientThe client the buffer is played back to.
sLineThe current line of buffer playback. This is a raw IRC traffic line!
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnChanCTCP ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual

Called when we receive a channel CTCP request from IRC.

Parameters
NickThe nick the CTCP request is from.
ChannelThe channel to which the request was sent.
sMessageThe CTCP request message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnChanMsg ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual

Called when we receive a channel message from IRC.

Parameters
NickThe nick which sent the message.
ChannelThe channel to which the message was sent.
sMessageThe message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnChanNotice ( CNick Nick,
CChan Channel,
CString sMessage 
)
virtual

Called when we receive a channel notice.

Parameters
NickThe nick which sent the notice.
ChannelThe channel to which the notice was sent.
sMessageThe notice message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnChanPermission ( const CNick OpNick,
const CNick Nick,
CChan Channel,
unsigned char  uMode,
bool  bAdded,
bool  bNoChange 
)
virtual
virtual void CModule::OnChanPermission2 ( const CNick pOpNick,
const CNick Nick,
CChan Channel,
unsigned char  uMode,
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 NULL if set by server.
NickThe nick whose channel mode changes.
ChannelThe channel on which the user mode is changed.
uModeThe 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).

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule.

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.

Parameters
pClientThe client which requested the capability.
sCapname of wanted capability.
bStateOn or off, depending on which case client needs.

Reimplemented in CPyModule.

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.

Reimplemented in CPyModule.

virtual void CModule::OnClientDisconnect ( )
virtual

Called when a client disconnected from ZNC.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnClientLogin ( )
virtual

Called when a client successfully logged in to ZNC.

Reimplemented in CPyModule, and CPerlModule.

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

Called when we receive a CTCP reply from IRC.

Parameters
NickThe nick the CTCP reply is from.
sMessageThe CTCP reply message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule.

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.

Reimplemented in CPyModule.

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.

Reimplemented in CPyModule.

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.
virtual void CModule::OnIRCConnected ( )
virtual

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

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnIRCDisconnected ( )
virtual

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

Reimplemented in CPyModule, and CPerlModule.

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 transfered via e.g. oidentd!
sRealNameThe real name that will be used.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnJoin ( const CNick Nick,
CChan Channel 
)
virtual

Called when a nick joins a channel.

Parameters
NickThe nick who joined.
ChannelThe channel which was joined.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnKick ( const CNick OpNick,
const CString sKickedNick,
CChan Channel,
const CString sMessage 
)
virtual

Called when a nick is kicked from a channel.

Parameters
OpNickThe nick which generated the kick.
sKickedNickThe nick which was kicked.
ChannelThe channel on which this kick occurs.
sMessageThe kick message.

Reimplemented in CPyModule, and CPerlModule.

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 ( CSmartPtr< 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.

Reimplemented in CPyModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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 NULL 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.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnModNotice ( const CString sMessage)
virtual

Called when a your module nick was sent a notice.

Parameters
sMessageThe message which was sent.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule.

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.

Reimplemented in CPyModule.

virtual void CModule::OnNick ( const CNick Nick,
const CString sNewNick,
const std::vector< CChan * > &  vChans 
)
virtual

Called when a nickname change occurs.

If we are changing our nick, sNewNick will equal m_pIRCSock->GetNick().

Parameters
NickThe nick which changed its nickname
sNewNickThe new nickname.
vChansChannels which we and nick share.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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

Called when a nick parts a channel.

Parameters
NickThe nick who parted.
ChannelThe channel which was parted.
sMessageThe part message.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnPostRehash ( )
virtual

This module hook is called after a successful rehash.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnPreRehash ( )
virtual

Called just before znc.conf is rehashed.

Reimplemented in CPyModule, and CPerlModule.

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

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

This is called after CModule::OnPrivCTCP().

Parameters
NickThe nick the action came from.
sMessageThe action message
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnPrivBufferPlayLine ( CClient Client,
CString sLine 
)
virtual

Called when a line from the query buffer is played back.

Parameters
ClientThe client this line will go to.
sLineThe raw IRC traffic line from the buffer.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnPrivCTCP ( CNick Nick,
CString sMessage 
)
virtual

Called when we receive a private CTCP request from IRC.

Parameters
NickThe nick the CTCP request is from.
sMessageThe CTCP request message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnPrivMsg ( CNick Nick,
CString sMessage 
)
virtual

Called when we receive a private message from IRC.

Parameters
NickThe nick which sent the message.
sMessageThe message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnPrivNotice ( CNick Nick,
CString sMessage 
)
virtual

Called when we receive a private notice.

Parameters
NickThe nick which sent the notice.
sMessageThe notice message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual void CModule::OnQuit ( const CNick Nick,
const CString sMessage,
const std::vector< CChan * > &  vChans 
)
virtual

Called when a nick quit from IRC.

Parameters
NickThe nick which quit.
sMessageThe quit message.
vChansList of channels which you and nick share.

Reimplemented in CPyModule, and CPerlModule.

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.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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 NULL 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.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnSendToClient ( CString sLine,
CClient Client 
)
virtual

Called when ZNC sends a raw traffic line to a client.

Parameters
sLineThe raw traffic line sent.
ClientThe client this line is sent to.
Warning
Calling PutUser() from within this hook leads to infinite recursion.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnSendToIRC ( CString sLine)
virtual

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

Parameters
sLineThe raw traffic line sent.
Warning
Calling PutIRC() from within this hook leads to infinite recursion.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnStatusCommand ( CString sCommand)
virtual

Called when a command to *status is sent.

Parameters
sCommandThe command sent.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnTopic ( CNick Nick,
CChan Channel,
CString sTopic 
)
virtual

Called when we receive a channel topic change from IRC.

Parameters
NickThe nick which changed the topic.
ChannelThe channel whose topic was changed.
sTopicThe new topic.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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::OnRaw(), but is also called before the client successfully logged in to ZNC.

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

Parameters
pClientThe client which send this line.
sLineThe raw traffic line which the client sent.

Reimplemented in CPyModule.

virtual EModRet CModule::OnUserAction ( CString sTarget,
CString sMessage 
)
virtual

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

Parameters
sTargetThe target for the CTCP ACTION. Could be a channel name or a nick name.
sMessageThe action message.
Returns
See CModule::EModRet.
Note
CModule::OnUserCTCP() will not be called for this message.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnUserCTCP ( CString sTarget,
CString sMessage 
)
virtual

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

Parameters
sTargetThe target for the CTCP request. Could be a channel name or a nick name.
sMessageThe CTCP request message.
Returns
See CModule::EModRet.
Note
This is not called for CTCP ACTION messages, use CModule::OnUserAction() instead.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnUserCTCPReply ( CString sTarget,
CString sMessage 
)
virtual

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

Parameters
sTargetThe target for the CTCP reply. Could be a channel name or a nick name.
sMessageThe CTCP reply message.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnUserJoin ( CString sChannel,
CString sKey 
)
virtual

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

Parameters
sChannelThe channel name the join is for.
sKeyThe key for the channel.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnUserMsg ( CString sTarget,
CString sMessage 
)
virtual

This module hook is called when a user sends a normal IRC message.

Parameters
sTargetThe target of the message. Could be a channel name or a nick name.
sMessageThe message which was sent.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnUserNotice ( CString sTarget,
CString sMessage 
)
virtual

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

Parameters
sTargetThe target of the message. Could be a channel name or a nick name.
sMessageThe message which was sent.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnUserPart ( CString sChannel,
CString sMessage 
)
virtual

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

Parameters
sChannelThe channel name the part is for.
sMessageThe part message the client sent.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

virtual EModRet CModule::OnUserTopic ( CString sChannel,
CString sTopic 
)
virtual

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

Parameters
sChannelThe channel.
sTopicThe new topic which the user sent.
Returns
See CModule::EModRet.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

virtual bool CModule::PutIRC ( const CString sLine)
virtual

This function sends a given raw 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::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)
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::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.

Reimplemented in CPyModule, and CPerlModule.

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.

Reimplemented in CPyModule, and CPerlModule.

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().

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().


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