diff --git a/include/znc/Client.h b/include/znc/Client.h index 73c1dd11..958796ec 100644 --- a/include/znc/Client.h +++ b/include/znc/Client.h @@ -192,61 +192,61 @@ class CClient : public CIRCSocket { void PutIRC(const CString& sLine); /** Sends a raw data line to the client. - * @param sLine The line to be sent. - * - * The line is first passed \e unmodified to the \ref CModule::OnSendToClient() - * module hook. If no module halts the process, the line is then sent to the client. - * - * These lines appear in the debug output in the following syntax: - * \code [time] (user/network) ZNC -> CLI [line] \endcode - */ + * @param sLine The line to be sent. + * + * The line is first passed \e unmodified to the \ref CModule::OnSendToClient() + * module hook. If no module halts the process, the line is then sent to the client. + * + * These lines appear in the debug output in the following syntax: + * \code [time] (user/network) ZNC -> CLI [line] \endcode + */ void PutClient(const CString& sLine); /** Sends a message to the client. - * @param Message The message to be sent. - * @note Only known and compatible messages and tags are sent. - * @return \c true if the message was sent, or \c false if it was ignored. - * - * This method ensures that only messages and tags, that the client has - * explicitly requested, are sent. Not all IRC clients are capable of - * handling all messages and tags. For example, some older versions of - * popular clients were prepared to parse just one interesting tag, - * \c time, and would break if multiple tags were included. Furthermore, - * messages that are specific to a certain capability, should not be sent - * to a client that has not requested the respective capability. Thus, in - * order to stay compatible with a variety of IRC clients, ZNC has to - * filter out messages and tags that the client has not explicitly - * requested. - * - * ### Message types - * - * The following table documents which capabilities the client is required - * to have requested in order to receive certain types of messages. - * - * Message type | Capability - * ------------ | ---------- - * \c ACCOUNT | \l CClient::HasAccountNotify() (account-notify) - * \c AWAY | \l CClient::HasAwayNotify() (away-notify) - * - * ### Message tags - * - * The following table documents currently supported message tags, and - * which capabilities the client is required to have requested to receive - * the respective message tags. - * - * Message tag | Capability - * ----------- | ---------- - * \c time | \l CClient::HasServerTime() (server-time) - * \c batch | \l CClient::HasBatch() (batch) - * - * @warning Bypassing the filter may cause troubles to some older IRC clients. - * - * It is possible to bypass the filter by converting a message to a string - * using \l CMessage::ToString(), and passing the resulting raw line to the - * \l CClient::PutClient(const CString& sLine) overload: - * \code - * pClient->PutClient(Message.ToString()); - * \endcode - */ + * @param Message The message to be sent. + * @note Only known and compatible messages and tags are sent. + * @return \c true if the message was sent, or \c false if it was ignored. + * + * This method ensures that only messages and tags, that the client has + * explicitly requested, are sent. Not all IRC clients are capable of + * handling all messages and tags. For example, some older versions of + * popular clients were prepared to parse just one interesting tag, + * \c time, and would break if multiple tags were included. Furthermore, + * messages that are specific to a certain capability, should not be sent + * to a client that has not requested the respective capability. Thus, in + * order to stay compatible with a variety of IRC clients, ZNC has to + * filter out messages and tags that the client has not explicitly + * requested. + * + * ### Message types + * + * The following table documents which capabilities the client is required + * to have requested in order to receive certain types of messages. + * + * Message type | Capability + * ------------ | ---------- + * \c ACCOUNT | \l CClient::HasAccountNotify() (account-notify) + * \c AWAY | \l CClient::HasAwayNotify() (away-notify) + * + * ### Message tags + * + * The following table documents currently supported message tags, and + * which capabilities the client is required to have requested to receive + * the respective message tags. + * + * Message tag | Capability + * ----------- | ---------- + * \c time | \l CClient::HasServerTime() (server-time) + * \c batch | \l CClient::HasBatch() (batch) + * + * @warning Bypassing the filter may cause troubles to some older IRC clients. + * + * It is possible to bypass the filter by converting a message to a string + * using \l CMessage::ToString(), and passing the resulting raw line to the + * \l CClient::PutClient(const CString& sLine) overload: + * \code + * pClient->PutClient(Message.ToString()); + * \endcode + */ bool PutClient(const CMessage& Message); unsigned int PutStatus(const CTable& table); void PutStatus(const CString& sLine); diff --git a/include/znc/IRCNetwork.h b/include/znc/IRCNetwork.h index 26e866f7..f52a5aeb 100644 --- a/include/znc/IRCNetwork.h +++ b/include/znc/IRCNetwork.h @@ -55,8 +55,8 @@ class CIRCNetwork { /** Time between checks if PINGs need to be sent */ PING_SLACK = 30, /** Timeout after which IRC connections are closed. Must - * obviously be greater than PING_FREQUENCY + PING_SLACK. - */ + * obviously be greater than PING_FREQUENCY + PING_SLACK. + */ NO_TRAFFIC_TIMEOUT = 180 }; @@ -158,7 +158,7 @@ class CIRCNetwork { bool Connect(); /** This method will return whether the user is connected and authenticated to an IRC server. - */ + */ bool IsIRCConnected() const; void SetIRCSocket(CIRCSock* pIRCSock); void IRCConnected(); diff --git a/include/znc/IRCSock.h b/include/znc/IRCSock.h index 6bebe021..d7e209ae 100644 --- a/include/znc/IRCSock.h +++ b/include/znc/IRCSock.h @@ -63,13 +63,13 @@ class CIRCSock : public CIRCSocket { void Quit(const CString& sQuitMsg = ""); /** You can call this from CModule::OnServerCapResult to suspend - * sending other CAP requests and CAP END for a while. Each - * call to PauseCap should be balanced with a call to ResumeCap. - */ + * sending other CAP requests and CAP END for a while. Each + * call to PauseCap should be balanced with a call to ResumeCap. + */ void PauseCap(); /** If you used PauseCap, call this when CAP negotiation and logging in - * should be resumed again. - */ + * should be resumed again. + */ void ResumeCap(); // Setters diff --git a/include/znc/Modules.h b/include/znc/Modules.h index 06e955dc..5b4bed77 100644 --- a/include/znc/Modules.h +++ b/include/znc/Modules.h @@ -303,35 +303,35 @@ class CModCommand { CModCommand(); /** Construct a new CModCommand. - * @param sCmd The name of the command. - * @param func The command's callback function. - * @param sArgs Help text describing the arguments to this command. - * @param sDesc Help text describing what this command does. - */ + * @param sCmd The name of the command. + * @param func The command's callback function. + * @param sArgs Help text describing the arguments to this command. + * @param sDesc Help text describing what this command does. + */ CModCommand(const CString& sCmd, CModule* pMod, ModCmdFunc func, const CString& sArgs, const CString& sDesc); CModCommand(const CString& sCmd, CmdFunc func, const CString& sArgs, const CString& sDesc); /** Copy constructor, needed so that this can be saved in a std::map. - * @param other Object to copy from. - */ + * @param other Object to copy from. + */ CModCommand(const CModCommand& other); /** Assignment operator, needed so that this can be saved in a std::map. - * @param other Object to copy from. - */ + * @param other Object to copy from. + */ CModCommand& operator=(const CModCommand& other); /** Initialize a CTable so that it can be used with AddHelp(). - * @param Table The instance of CTable to initialize. - */ + * @param Table The instance of CTable to initialize. + */ static void InitHelp(CTable& Table); /** Add this command to the CTable instance. - * @param Table Instance of CTable to which this should be added. - * @warning The Table should be initialized via InitHelp(). - */ + * @param Table Instance of CTable to which this should be added. + * @warning The Table should be initialized via InitHelp(). + */ void AddHelp(CTable& Table) const; const CString& GetCommand() const { return m_sCmd; } @@ -374,33 +374,33 @@ class CModule { CModule& operator=(const CModule&) = delete; /** 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. - */ + * return, ZNC then decides what to do with the event which caused the + * module hook. + */ typedef enum { /** ZNC will continue event processing normally. This is what - * you should return normally. - */ + * you should return normally. + */ CONTINUE = 1, /** This is the same as both CModule::HALTMODS and - * CModule::HALTCORE together. - */ + * CModule::HALTCORE together. + */ HALT = 2, /** Stop sending this even to other modules which were not - * called yet. Internally, the event is handled normally. - */ + * called yet. Internally, the event is handled normally. + */ HALTMODS = 3, /** 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) - */ + * in the ZNC core. (For most module hooks this means that a + * given event won't be forwarded to the connected users) + */ HALTCORE = 4 } EModRet; typedef enum { /** Your module can throw this enum at any given time. When this - * is thrown, the module will be unloaded. - */ + * is thrown, the module will be unloaded. + */ UNLOAD } EModException; @@ -409,78 +409,78 @@ class CModule { void SetClient(CClient* pClient); /** This function throws CModule::UNLOAD which causes this module to be unloaded. - */ + */ void Unload() { throw UNLOAD; } /** This module hook is called when a module is loaded - * @param sArgsi The arguments for the modules. - * @param sMessage A message that may be displayed to the user after - * loading the module. Useful for returning error messages. - * @return true if the module loaded successfully, else false. - */ + * @param sArgsi The arguments for the modules. + * @param sMessage A message that may be displayed to the user after + * loading the module. Useful for returning error messages. + * @return true if the module loaded successfully, else false. + */ virtual bool OnLoad(const CString& sArgsi, CString& sMessage); /** This module hook is called during ZNC startup. Only modules loaded - * from znc.conf get this call. - * @return false to abort ZNC startup. - */ + * from znc.conf get this call. + * @return false to abort ZNC startup. + */ virtual bool OnBoot(); /** Modules which can only be used with an active user session have to return true here. - * @return false for modules that can do stuff for non-logged in web users as well. - */ + * @return false for modules that can do stuff for non-logged in web users as well. + */ virtual bool WebRequiresLogin() { return true; } /** Return true if this module should only be usable for admins on the web. - * @return false if normal users can use this module's web pages as well. - */ + * @return false if normal users can use this module's web pages as well. + */ virtual bool WebRequiresAdmin() { return false; } /** Return the title of the module's section in the web interface's side bar. - * @return The Title. - */ + * @return The Title. + */ virtual CString GetWebMenuTitle() { return ""; } virtual CString GetWebPath(); virtual CString GetWebFilesPath(); /** 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. - * @param WebSock The active request. - * @param sPageName The name of the page that has been requested. - * @return 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. - */ + * 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. + * @param WebSock The active request. + * @param sPageName The name of the page that has been requested. + * @return 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 OnWebPreRequest(CWebSock& WebSock, const CString& sPageName); /** 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. - * @param WebSock The active request. - * @param sPageName The name of the page that has been requested. - * @param Tmpl The active template. You can add variables, loops and stuff to it. - * @return 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. - */ + * this method will be called with the page name. It will also be called for pages that + * have NOT been specifically registered with AddSubPage. + * @param WebSock The active request. + * @param sPageName The name of the page that has been requested. + * @param Tmpl The active template. You can add variables, loops and stuff to it. + * @return 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. + */ virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl); /** Registers a sub page for the sidebar. - * @param spSubPage The SubPage instance. - */ + * @param spSubPage The SubPage instance. + */ virtual void AddSubPage(TWebSubPage spSubPage) { m_vSubPages.push_back(spSubPage); } /** Removes all registered (AddSubPage'd) SubPages. - */ + */ virtual void ClearSubPages() { m_vSubPages.clear(); } /** Returns a list of all registered SubPages. Don't mess with it too much. - * @return The List. - */ + * @return The List. + */ virtual VWebSubPages& GetSubPages() { return m_vSubPages; } /** 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. - * @param WebSock Socket for web connection, don't do bad things with it. - * @param sPageName Describes the place where web stuff is embedded to. - * @param Tmpl Template. Depending on context, you can do various stuff with it. - * @return 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. - */ + * This method is called whenever embededded modules I/O happens. + * Name of used .tmpl file (if any) is up to caller. + * @param WebSock Socket for web connection, don't do bad things with it. + * @param sPageName Describes the place where web stuff is embedded to. + * @param Tmpl Template. Depending on context, you can do various stuff with it. + * @return 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 bool OnEmbeddedWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl); @@ -494,45 +494,45 @@ class CModule { /** This module hook is called after a successful login to IRC. */ virtual void OnIRCConnected(); /** This module hook is called just before ZNC tries to establish a - * connection to an IRC server. - * @param pIRCSock The socket that will be used for the connection. - * @return See CModule::EModRet. - */ + * connection to an IRC server. + * @param pIRCSock The socket that will be used for the connection. + * @return See CModule::EModRet. + */ virtual EModRet OnIRCConnecting(CIRCSock* pIRCSock); /** This module hook is called when a CIRCSock fails to connect or - * a module returned HALTCORE from OnIRCConnecting. - * @param pIRCSock The socket that failed to connect. - */ + * a module returned HALTCORE from OnIRCConnecting. + * @param pIRCSock The socket that failed to connect. + */ virtual void OnIRCConnectionError(CIRCSock* pIRCSock); /** 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. - * @param sPass The server password that will be used. - * @param sNick The nick that will be used. - * @param sIdent The protocol identity that will be used. This is not - * the ident string that is transfered via e.g. oidentd! - * @param sRealName The real name that will be used. - * @return See CModule::EModRet. - */ + * low-level connection is established at this point, but SSL + * handshakes didn't necessarily finish yet. + * @param sPass The server password that will be used. + * @param sNick The nick that will be used. + * @param sIdent The protocol identity that will be used. This is not + * the ident string that is transfered via e.g. oidentd! + * @param sRealName The real name that will be used. + * @return See CModule::EModRet. + */ virtual EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName); /** This module hook is called when a message is broadcasted to all users. - * @param sMessage The message that is broadcasted. - * @return see CModule::EModRet - */ + * @param sMessage The message that is broadcasted. + * @return see CModule::EModRet + */ virtual EModRet OnBroadcast(CString& sMessage); /** This module hook is called when a user mode on a channel changes. - * @param pOpNick The nick who sent the mode change, or nullptr if set by server. - * @param Nick The nick whose channel mode changes. - * @param Channel The channel on which the user mode is changed. - * @param uMode The mode character that is changed, e.g. '@' for op. - * @param bAdded True if the mode is added, else false. - * @param bNoChange true if this mode change doesn't change anything - * because the nick already had this permission. - * @see CIRCSock::GetModeType() for converting uMode into a mode (e.g. - * 'o' for op). - */ + * @param pOpNick The nick who sent the mode change, or nullptr if set by server. + * @param Nick The nick whose channel mode changes. + * @param Channel The channel on which the user mode is changed. + * @param uMode The mode character that is changed, e.g. '@' for op. + * @param bAdded True if the mode is added, else false. + * @param bNoChange true if this mode change doesn't change anything + * because the nick already had this permission. + * @see CIRCSock::GetModeType() for converting uMode into a mode (e.g. + * 'o' for op). + */ virtual void OnChanPermission2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, unsigned char uMode, bool bAdded, bool bNoChange); @@ -560,80 +560,80 @@ class CModule { virtual void OnDevoice(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange); /** Called on an individual channel mode change. - * @param pOpNick The nick who changes the channel mode, or nullptr if set by server. - * @param Channel The channel whose mode is changed. - * @param uMode The mode character that is changed. - * @param sArg The argument to the mode character, if any. - * @param bAdded True if this mode is added ("+"), else false. - * @param bNoChange True if this mode was already effective before. - */ + * @param pOpNick The nick who changes the channel mode, or nullptr if set by server. + * @param Channel The channel whose mode is changed. + * @param uMode The mode character that is changed. + * @param sArg The argument to the mode character, if any. + * @param bAdded True if this mode is added ("+"), else false. + * @param bNoChange True if this mode was already effective before. + */ virtual void OnMode2(const CNick* pOpNick, CChan& Channel, char uMode, const CString& sArg, bool bAdded, bool bNoChange); virtual void OnMode(const CNick& OpNick, CChan& Channel, char uMode, const CString& sArg, bool bAdded, bool bNoChange); /** Called on any channel mode change. This is called before the more - * detailed mode hooks like e.g. OnOp() and OnMode(). - * @param pOpNick The nick who changes the channel mode, or nullptr if set by server. - * @param Channel The channel whose mode is changed. - * @param sModes The raw mode change, e.g. "+s-io". - * @param sArgs All arguments to the mode change from sModes. - */ + * detailed mode hooks like e.g. OnOp() and OnMode(). + * @param pOpNick The nick who changes the channel mode, or nullptr if set by server. + * @param Channel The channel whose mode is changed. + * @param sModes The raw mode change, e.g. "+s-io". + * @param sArgs All arguments to the mode change from sModes. + */ virtual void OnRawMode2(const CNick* pOpNick, CChan& Channel, const CString& sModes, const CString& sArgs); virtual void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs); /** Called on any raw IRC line received from the IRC server. - * @param sLine The line read from the server. - * @note The line does not include message tags. Use OnRawMessage() to access them. - * @return See CModule::EModRet. - */ + * @param sLine The line read from the server. + * @note The line does not include message tags. Use OnRawMessage() to access them. + * @return See CModule::EModRet. + */ virtual EModRet OnRaw(CString& sLine); /** Called on any raw message received from the IRC server. - * @since 1.7.0 - * @param Message The received message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The received message. + * @return See CModule::EModRet. + */ virtual EModRet OnRawMessage(CMessage& Message); /** Called when a numeric message is received from the IRC server. - * @since 1.7.0 - * @param Message The received message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The received message. + * @return See CModule::EModRet. + */ virtual EModRet OnNumericMessage(CNumericMessage& Message); /** Called when a command to *status is sent. - * @param sCommand The command sent. - * @return See CModule::EModRet. - */ + * @param sCommand The command sent. + * @return See CModule::EModRet. + */ virtual EModRet OnStatusCommand(CString& sCommand); /** Called when a command to your module is sent, e.g. query to *modname. - * @param sCommand The command that was sent. - */ + * @param sCommand The command that was sent. + */ virtual void OnModCommand(const CString& sCommand); /** 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(). - * @param sCommand The command that was sent. - */ + * 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(). + * @param sCommand The command that was sent. + */ virtual void OnUnknownModCommand(const CString& sCommand); /** Called when a your module nick was sent a notice. - * @param sMessage The message which was sent. - */ + * @param sMessage The message which was sent. + */ virtual void OnModNotice(const CString& sMessage); /** Called when your module nick was sent a CTCP message. OnModCommand() - * won't be called for this message. - * @param sMessage The message which was sent. - */ + * won't be called for this message. + * @param sMessage The message which was sent. + */ virtual void OnModCTCP(const CString& sMessage); /** Called when a nick quit from IRC. - * @since 1.7.0 - * @param Message The quit message. - * @param vChans List of channels which you and nick share. - */ + * @since 1.7.0 + * @param Message The quit message. + * @param vChans List of channels which you and nick share. + */ virtual void OnQuitMessage(CQuitMessage& Message, const std::vector& vChans); /// @deprecated Use OnQuitMessage() instead. @@ -641,10 +641,10 @@ class CModule { const std::vector& vChans); /** Called when a nickname change occurs. - * @since 1.7.0 - * @param Message The nick message. - * @param vChans Channels which we and nick share. - */ + * @since 1.7.0 + * @param Message The nick message. + * @param vChans Channels which we and nick share. + */ virtual void OnNickMessage(CNickMessage& Message, const std::vector& vChans); /// @deprecated Use OnNickMessage() instead. @@ -652,63 +652,63 @@ class CModule { const std::vector& vChans); /** Called when a nick is kicked from a channel. - * @since 1.7.0 - * @param Message The kick message. - */ + * @since 1.7.0 + * @param Message The kick message. + */ virtual void OnKickMessage(CKickMessage& Message); /// @deprecated Use OnKickMessage() instead. virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage); /** This module hook is called just before ZNC tries to join an IRC channel. - * @param Chan The channel which is about to get joined. - * @return See CModule::EModRet. - */ + * @param Chan The channel which is about to get joined. + * @return See CModule::EModRet. + */ virtual EModRet OnJoining(CChan& Channel); /** Called when a nick joins a channel. - * @since 1.7.0 - * @param Message The join message. - */ + * @since 1.7.0 + * @param Message The join message. + */ virtual void OnJoinMessage(CJoinMessage& Message); /// @deprecated Use OnJoinMessage() instead. virtual void OnJoin(const CNick& Nick, CChan& Channel); /** Called when a nick parts a channel. - * @since 1.7.0 - * @param Message The part message. - */ + * @since 1.7.0 + * @param Message The part message. + */ virtual void OnPartMessage(CPartMessage& Message); /// @deprecated Use OnPartMessage() instead. virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage); /** Called when user is invited into a channel - * @param Nick The nick who invited you. - * @param sChan The channel the user got invited into - * @return See CModule::EModRet. - * @todo Add OnInviteMessage() hook - */ + * @param Nick The nick who invited you. + * @param sChan The channel the user got invited into + * @return See CModule::EModRet. + * @todo Add OnInviteMessage() hook + */ virtual EModRet OnInvite(const CNick& Nick, const CString& sChan); /** Called before a channel buffer is played back to a client. - * @param Chan The channel which will be played back. - * @param Client The client the buffer will be played back to. - * @return See CModule::EModRet. - */ + * @param Chan The channel which will be played back. + * @param Client The client the buffer will be played back to. + * @return See CModule::EModRet. + */ virtual EModRet OnChanBufferStarting(CChan& Chan, CClient& Client); /** Called after a channel buffer was played back to a client. - * @param Chan The channel which was played back. - * @param Client The client the buffer was played back to. - * @return See CModule::EModRet. - */ + * @param Chan The channel which was played back. + * @param Client The client the buffer was played back to. + * @return See CModule::EModRet. + */ virtual EModRet OnChanBufferEnding(CChan& Chan, CClient& Client); /** Called for each message during a channel's buffer play back. - * @since 1.7.0 - * @param Message The playback message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The playback message. + * @return See CModule::EModRet. + */ virtual EModRet OnChanBufferPlayMessage(CMessage& Message); /// @deprecated Use OnChanBufferPlayMessage() instead. virtual EModRet OnChanBufferPlayLine2(CChan& Chan, CClient& Client, @@ -718,10 +718,10 @@ class CModule { CString& sLine); /** Called for each message during a query's buffer play back. - * @since 1.7.0 - * @param Message The playback message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The playback message. + * @return See CModule::EModRet. + */ virtual EModRet OnPrivBufferPlayMessage(CMessage& Message); /// @deprecated Use OnPrivBufferPlayMessage() instead. virtual EModRet OnPrivBufferPlayLine2(CClient& Client, CString& sLine, @@ -735,304 +735,304 @@ class CModule { virtual void OnClientDisconnect(); /** This module hook is called when a client sends a raw traffic line to ZNC. - * @param sLine The raw traffic line sent. - * @note The line does not include message tags. Use OnUserRawMessage() to access them. - * @return See CModule::EModRet. - */ + * @param sLine The raw traffic line sent. + * @note The line does not include message tags. Use OnUserRawMessage() to access them. + * @return See CModule::EModRet. + */ virtual EModRet OnUserRaw(CString& sLine); /** This module hook is called when a client sends any message to ZNC. - * @since 1.7.0 - * @param Message The message sent. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The message sent. + * @return See CModule::EModRet. + */ virtual EModRet OnUserRawMessage(CMessage& Message); /** This module hook is called when a client sends a CTCP reply. - * @since 1.7.0 - * @param Message The CTCP reply message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The CTCP reply message. + * @return See CModule::EModRet. + */ virtual EModRet OnUserCTCPReplyMessage(CCTCPMessage& Message); /// @deprecated Use OnUserCTCPReplyMessage() instead. virtual EModRet OnUserCTCPReply(CString& sTarget, CString& sMessage); /** This module hook is called when a client sends a CTCP request. - * @since 1.7.0 - * @param Message The CTCP request message. - * @return See CModule::EModRet. - * @note This is not called for CTCP ACTION messages, use - * CModule::OnUserActionMessage() instead. - */ + * @since 1.7.0 + * @param Message The CTCP request message. + * @return See CModule::EModRet. + * @note This is not called for CTCP ACTION messages, use + * CModule::OnUserActionMessage() instead. + */ virtual EModRet OnUserCTCPMessage(CCTCPMessage& Message); /// @deprecated Use OnUserCTCPMessage() instead. virtual EModRet OnUserCTCP(CString& sTarget, CString& sMessage); /** Called when a client sends a CTCP ACTION request ("/me"). - * @since 1.7.0 - * @param Message The action message. - * @return See CModule::EModRet. - * @note CModule::OnUserCTCPMessage() will not be called for this message. - */ + * @since 1.7.0 + * @param Message The action message. + * @return See CModule::EModRet. + * @note CModule::OnUserCTCPMessage() will not be called for this message. + */ virtual EModRet OnUserActionMessage(CActionMessage& Message); /// @deprecated Use OnUserActionMessage() instead. virtual EModRet OnUserAction(CString& sTarget, CString& sMessage); /** This module hook is called when a user sends a normal IRC message. - * @since 1.7.0 - * @param Message The message which was sent. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The message which was sent. + * @return See CModule::EModRet. + */ virtual EModRet OnUserTextMessage(CTextMessage& Message); /// @deprecated Use OnUserTextMessage() instead. virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage); /** This module hook is called when a user sends a notice message. - * @since 1.7.0 - * @param Message The message which was sent. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The message which was sent. + * @return See CModule::EModRet. + */ virtual EModRet OnUserNoticeMessage(CNoticeMessage& Message); /// @deprecated Use OnUserNoticeMessage() instead. virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage); /** This hooks is called when a user sends a JOIN message. - * @since 1.7.0 - * @param Message The join message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The join message. + * @return See CModule::EModRet. + */ virtual EModRet OnUserJoinMessage(CJoinMessage& Message); /// @deprecated Use OnUserJoinMessage() instead. virtual EModRet OnUserJoin(CString& sChannel, CString& sKey); /** This hooks is called when a user sends a PART message. - * @since 1.7.0 - * @param Message The part message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The part message. + * @return See CModule::EModRet. + */ virtual EModRet OnUserPartMessage(CPartMessage& Message); /// @deprecated Use OnUserPartMessage() instead. virtual EModRet OnUserPart(CString& sChannel, CString& sMessage); /** This module hook is called when a user wants to change a channel topic. - * @since 1.7.0 - * @param Message The topic message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The topic message. + * @return See CModule::EModRet. + */ virtual EModRet OnUserTopicMessage(CTopicMessage& Message); /// @deprecated Use OnUserTopicMessage() instead. virtual EModRet OnUserTopic(CString& sChannel, CString& sTopic); /** This hook is called when a user requests a channel's topic. - * @param sChannel The channel for which the request is. - * @return See CModule::EModRet. - */ + * @param sChannel The channel for which the request is. + * @return See CModule::EModRet. + */ virtual EModRet OnUserTopicRequest(CString& sChannel); /** This module hook is called when a user requests to quit from network. - * @since 1.7.0 - * @param Message The quit message the client sent. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The quit message the client sent. + * @return See CModule::EModRet. + */ virtual EModRet OnUserQuitMessage(CQuitMessage& Message); /// @deprecated Use OnUserQuitMessage() instead. virtual EModRet OnUserQuit(CString& sMessage); /** Called when we receive a CTCP reply from IRC. - * @since 1.7.0 - * @param Message The CTCP reply message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The CTCP reply message. + * @return See CModule::EModRet. + */ virtual EModRet OnCTCPReplyMessage(CCTCPMessage& Message); /// @deprecated Use OnCTCPReplyMessage() instead. virtual EModRet OnCTCPReply(CNick& Nick, CString& sMessage); /** Called when we receive a private CTCP request from IRC. - * @since 1.7.0 - * @param Message The CTCP request message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The CTCP request message. + * @return See CModule::EModRet. + */ virtual EModRet OnPrivCTCPMessage(CCTCPMessage& Message); /// @deprecated Use OnPrivCTCPMessage() instead. virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage); /** Called when we receive a channel CTCP request from IRC. - * @since 1.7.0 - * @param Message The CTCP request message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The CTCP request message. + * @return See CModule::EModRet. + */ virtual EModRet OnChanCTCPMessage(CCTCPMessage& Message); /// @deprecated Use OnChanCTCPMessage() instead. virtual EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage); /** Called when we receive a private CTCP ACTION ("/me" in query) from IRC. - * @since 1.7.0 - * @param Message The action message - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The action message + * @return See CModule::EModRet. + */ virtual EModRet OnPrivActionMessage(CActionMessage& Message); /// @deprecated Use OnPrivActionMessage() instead. virtual EModRet OnPrivAction(CNick& Nick, CString& sMessage); /** Called when we receive a channel CTCP ACTION ("/me" in a channel) from IRC. - * @since 1.7.0 - * @param Message The action message - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The action message + * @return See CModule::EModRet. + */ virtual EModRet OnChanActionMessage(CActionMessage& Message); /// @deprecated Use OnChanActionMessage() instead. virtual EModRet OnChanAction(CNick& Nick, CChan& Channel, CString& sMessage); /** Called when we receive a private message from IRC. - * @since 1.7.0 - * @param Message The private message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The private message. + * @return See CModule::EModRet. + */ virtual EModRet OnPrivMessage(CTextMessage& Message); /// @deprecated Use OnPrivMessage() instead. virtual EModRet OnPrivMsg(CNick& Nick, CString& sMessage); /** Called when we receive a channel message from IRC. - * @since 1.7.0 - * @param Message The channel message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The channel message. + * @return See CModule::EModRet. + */ virtual EModRet OnChanMessage(CTextMessage& Message); /// @deprecated Use OnChanMessage() instead. virtual EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage); /** Called when we receive a private notice. - * @since 1.7.0 - * @param Message The notice message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The notice message. + * @return See CModule::EModRet. + */ virtual EModRet OnPrivNoticeMessage(CNoticeMessage& Message); /// @deprecated Use OnPrivNoticeMessage() instead. virtual EModRet OnPrivNotice(CNick& Nick, CString& sMessage); /** Called when we receive a channel notice. - * @since 1.7.0 - * @param Message The notice message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The notice message. + * @return See CModule::EModRet. + */ virtual EModRet OnChanNoticeMessage(CNoticeMessage& Message); /// @deprecated Use OnChanNoticeMessage() instead. virtual EModRet OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage); /** Called when we receive a channel topic change from IRC. - * @since 1.7.0 - * @param Message The topic message. - * @return See CModule::EModRet. - */ + * @since 1.7.0 + * @param Message The topic message. + * @return See CModule::EModRet. + */ virtual EModRet OnTopicMessage(CTopicMessage& Message); /// @deprecated Use OnTopicMessage() instead. virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic); /** Called for every CAP received via CAP LS from server. - * @param sCap capability supported by server. - * @return true if your module supports this CAP and - * needs to turn it on with CAP REQ. - */ + * @param sCap capability supported by server. + * @return true if your module supports this CAP and + * needs to turn it on with CAP REQ. + */ virtual bool OnServerCapAvailable(const CString& sCap); /** Called for every CAP accepted or rejected by server - * (with CAP ACK or CAP NAK after our CAP REQ). - * @param sCap capability accepted/rejected by server. - * @param bSuccess true if capability was accepted, false if rejected. - */ + * (with CAP ACK or CAP NAK after our CAP REQ). + * @param sCap capability accepted/rejected by server. + * @param bSuccess true if capability was accepted, false if rejected. + */ virtual void OnServerCapResult(const CString& sCap, bool bSuccess); /** 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. - * @param Channel The channel which will be joined. - * @return See CModule::EModRet. - */ + * by itself because it's in the config but wasn't joined yet. + * @param Channel The channel which will be joined. + * @return See CModule::EModRet. + */ virtual EModRet OnTimerAutoJoin(CChan& Channel); /** This module hook is called when a network is being added. - * @param Network The new IRC network. - * @param sErrorRet A message that may be displayed to the user if - * the module stops adding the network. - * @return See CModule::EModRet. - */ + * @param Network The new IRC network. + * @param sErrorRet A message that may be displayed to the user if + * the module stops adding the network. + * @return See CModule::EModRet. + */ virtual EModRet OnAddNetwork(CIRCNetwork& Network, CString& sErrorRet); /** This module hook is called when a network is deleted. - * @param Network The IRC network which is going to be deleted. - * @return See CModule::EModRet. - */ + * @param Network The IRC network which is going to be deleted. + * @return See CModule::EModRet. + */ virtual EModRet OnDeleteNetwork(CIRCNetwork& Network); /** Called when ZNC sends a raw traffic line to a client. - * @param sLine The raw traffic line sent. - * @param Client The client this line is sent to. - * @warning Calling PutUser() from within this hook leads to infinite recursion. - * @return See CModule::EModRet. - */ + * @param sLine The raw traffic line sent. + * @param Client The client this line is sent to. + * @warning Calling PutUser() from within this hook leads to infinite recursion. + * @return See CModule::EModRet. + */ virtual EModRet OnSendToClient(CString& sLine, CClient& Client); /** Called when ZNC sends a raw traffic line to the IRC server. - * @param sLine The raw traffic line sent. - * @warning Calling PutIRC() from within this hook leads to infinite recursion. - * @return See CModule::EModRet. - */ + * @param sLine The raw traffic line sent. + * @warning Calling PutIRC() from within this hook leads to infinite recursion. + * @return See CModule::EModRet. + */ virtual EModRet OnSendToIRC(CString& sLine); ModHandle GetDLL() { return m_pDLL; } static double GetCoreVersion() { return VERSION; } /** This function sends a given raw IRC line to the IRC server, if we - * are connected to one. Else this line is discarded. - * @param sLine The line which should be sent. - * @return true if the line was queued for sending. - */ + * are connected to one. Else this line is discarded. + * @param sLine The line which should be sent. + * @return true if the line was queued for sending. + */ virtual bool PutIRC(const CString& sLine); /** 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. - * @param sLine The line which should be sent. - * @return true if the line was sent to at least one 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. + * @param sLine The line which should be sent. + * @return true if the line was sent to at least one client. + */ virtual bool PutUser(const CString& sLine); /** 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. - * @param sLine The message which should be sent from *status. - * @return true if the line was sent to at least one client. - */ + * hook for a specific client, only that client gets this message, else + * all connected clients will receive it. + * @param sLine The message which should be sent from *status. + * @return true if the line was sent to at least one client. + */ virtual bool PutStatus(const CString& sLine); /** 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. - * @param sLine The message which should be sent. - * @return true if the line was sent to at least one client. - */ + * module hook for a specific client, only that client gets this + * message, else all connected clients will receive it. + * @param sLine The message which should be sent. + * @return true if the line was sent to at least one client. + */ virtual bool PutModule(const CString& sLine); /** This function calls CModule::PutModule(const CString&, const - * CString&, const CString&) for each line in the table. - * @param table The table which should be send. - * @return The number of lines sent. - */ + * CString&, const CString&) for each line in the table. + * @param table The table which should be send. + * @return The number of lines sent. + */ virtual unsigned int PutModule(const CTable& table); /** 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. - * @param sLine The line which should be sent. - * @return true if the line was sent to at least one client. - */ + * a specific client, only that client gets this notice, else all + * clients will receive it. + * @param sLine The line which should be sent. + * @return true if the line was sent to at least one client. + */ virtual bool PutModNotice(const CString& sLine); /** @returns The name of the module. */ const CString& GetModName() const { return m_sModName; } /** @returns The nick of the module. This is just the module name - * prefixed by the status prefix. - */ + * prefixed by the status prefix. + */ CString GetModNick() const; /** 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. - */ + * Modules can be accompanied by static data, e.g. skins for webadmin. + * These function will return the path to that data. + */ const CString& GetModDataDir() const { return m_sDataDir; } // Timer stuff @@ -1094,16 +1094,16 @@ class CModule { /// @return The CModCommand instance or nullptr if none was found. const CModCommand* FindCommand(const CString& sCmd) const; /** 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. - * @param sLine The command line to handle. - * @return True if something was done, else false. - */ + * 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. + * @param sLine The command line to handle. + * @return True if something was done, else false. + */ bool HandleCommand(const CString& sLine); /** Send a description of all registered commands via PutModule(). - * @param sLine The help command that is being asked for. - */ + * @param sLine The help command that is being asked for. + */ void HandleHelpCommand(const CString& sLine = ""); // !Command stuff @@ -1143,122 +1143,122 @@ class CModule { const CString& GetModPath() const { return m_sModPath; } /** @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. - */ + * 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. + */ CUser* GetUser() const { return m_pUser; } /** @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. - */ + * which case this is the network for which the hook is called. + */ CIRCNetwork* GetNetwork() const { return m_pNetwork; } /** @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. - */ + * which case this is the client for which the hook is called. + */ CClient* GetClient() const { return m_pClient; } CSockManager* GetManager() const { return m_pManager; } // !Getters // Global Modules /** This module hook is called when a user is being added. - * @param User The user which will be added. - * @param sErrorRet A message that may be displayed to the user if - * the module stops adding the user. - * @return See CModule::EModRet. - */ + * @param User The user which will be added. + * @param sErrorRet A message that may be displayed to the user if + * the module stops adding the user. + * @return See CModule::EModRet. + */ virtual EModRet OnAddUser(CUser& User, CString& sErrorRet); /** This module hook is called when a user is deleted. - * @param User The user which will be deleted. - * @return See CModule::EModRet. - */ + * @param User The user which will be deleted. + * @return See CModule::EModRet. + */ virtual EModRet OnDeleteUser(CUser& User); /** This module hook is called when there is an incoming connection on - * any of ZNC's listening sockets. - * @param pSock The incoming client socket. - * @param sHost The IP the client is connecting from. - * @param uPort The port the client is connecting from. - */ + * any of ZNC's listening sockets. + * @param pSock The incoming client socket. + * @param sHost The IP the client is connecting from. + * @param uPort The port the client is connecting from. + */ virtual void OnClientConnect(CZNCSock* pSock, const CString& sHost, unsigned short uPort); /** 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; - * @param Auth The necessary authentication info for this login attempt. - * @return See CModule::EModRet. - */ + * module wants to handle the login attempt, it must return + * CModule::EModRet::HALT; + * @param Auth The necessary authentication info for this login attempt. + * @return See CModule::EModRet. + */ virtual EModRet OnLoginAttempt(std::shared_ptr Auth); /** Called after a client login was rejected. - * @param sUsername The username that tried to log in. - * @param sRemoteIP The IP address from which the client tried to login. - */ + * @param sUsername The username that tried to log in. + * @param sRemoteIP The IP address from which the client tried to login. + */ virtual void OnFailedLogin(const CString& sUsername, const CString& sRemoteIP); /** 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. - * @param pClient The client which send this line. - * @param sLine The raw traffic line which the client sent. - */ + * before the client successfully logged in to ZNC. You should always + * prefer to use CModule::OnUserRaw() if possible. + * @param pClient The client which send this line. + * @param sLine The raw traffic line which the client sent. + */ virtual EModRet OnUnknownUserRaw(CClient* pClient, CString& sLine); virtual EModRet OnUnknownUserRawMessage(CMessage& Message); /** Called when a client told us CAP LS. Use ssCaps.insert("cap-name") - * for announcing capabilities which your module supports. - * @param pClient The client which requested the list. - * @param ssCaps set of caps which will be sent to client. - */ + * for announcing capabilities which your module supports. + * @param pClient The client which requested the list. + * @param ssCaps set of caps which will be sent to client. + */ virtual void OnClientCapLs(CClient* pClient, SCString& ssCaps); /** Called only to check if your module supports turning on/off named capability. - * @param pClient The client which wants to enable/disable a capability. - * @param sCap name of capability. - * @param bState On or off, depending on which case is interesting for client. - * @return true if your module supports this capability in the specified state. - */ + * @param pClient The client which wants to enable/disable a capability. + * @param sCap name of capability. + * @param bState On or off, depending on which case is interesting for client. + * @return true if your module supports this capability in the specified state. + */ virtual bool IsClientCapSupported(CClient* pClient, const CString& sCap, bool bState); /** Called when we actually need to turn a capability on or off for a client. - * @param pClient The client which requested the capability. - * @param sCap name of wanted capability. - * @param bState On or off, depending on which case client needs. - */ + * @param pClient The client which requested the capability. + * @param sCap name of wanted capability. + * @param bState On or off, depending on which case client needs. + */ virtual void OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState); /** Called when a module is going to be loaded. - * @param sModName name of the module. - * @param eType wanted type of the module (user/global). - * @param sArgs arguments of the module. - * @param[out] bSuccess the module was loaded successfully - * as result of this module hook? - * @param[out] sRetMsg text about loading of the module. - * @return See CModule::EModRet. - */ + * @param sModName name of the module. + * @param eType wanted type of the module (user/global). + * @param sArgs arguments of the module. + * @param[out] bSuccess the module was loaded successfully + * as result of this module hook? + * @param[out] sRetMsg text about loading of the module. + * @return See CModule::EModRet. + */ virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs, CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg); /** Called when a module is going to be unloaded. - * @param pModule the module. - * @param[out] bSuccess the module was unloaded successfully - * as result of this module hook? - * @param[out] sRetMsg text about unloading of the module. - * @return See CModule::EModRet. - */ + * @param pModule the module. + * @param[out] bSuccess the module was unloaded successfully + * as result of this module hook? + * @param[out] sRetMsg text about unloading of the module. + * @return See CModule::EModRet. + */ virtual EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg); /** Called when info about a module is needed. - * @param[out] ModInfo put result here, if your module knows it. - * @param sModule name of the module. - * @param bSuccess this module provided info about the module. - * @param sRetMsg text describing possible issues. - * @return See CModule::EModRet. - */ + * @param[out] ModInfo put result here, if your module knows it. + * @param sModule name of the module. + * @param bSuccess this module provided info about the module. + * @param sRetMsg text describing possible issues. + * @return See CModule::EModRet. + */ virtual EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule, bool& bSuccess, CString& sRetMsg); /** Called when list of available mods is requested. - * @param ssMods put new modules here. - * @param bGlobal true if global modules are needed. - */ + * @param ssMods put new modules here. + * @param bGlobal true if global modules are needed. + */ virtual void OnGetAvailableMods(std::set& ssMods, CModInfo::EModuleType eType); // !Global Modules diff --git a/include/znc/Socket.h b/include/znc/Socket.h index d8a3449d..d24538e5 100644 --- a/include/znc/Socket.h +++ b/include/znc/Socket.h @@ -232,17 +232,17 @@ class CSockManager : public TSocketManager { class CSocket : public CZNCSock { public: /** - * @brief ctor - * @param pModule the module this sock instance is associated to - */ + * @brief ctor + * @param pModule the module this sock instance is associated to + */ CSocket(CModule* pModule); /** - * @brief ctor - * @param pModule the module this sock instance is associated to - * @param sHostname the hostname being connected to - * @param uPort the port being connected to - * @param iTimeout the timeout period for this specific sock - */ + * @brief ctor + * @param pModule the module this sock instance is associated to + * @param sHostname the hostname being connected to + * @param uPort the port being connected to + * @param iTimeout the timeout period for this specific sock + */ CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort, int iTimeout = 60); virtual ~CSocket(); @@ -283,15 +283,15 @@ class CIRCSocket : public CZNCSock { public: #ifdef HAVE_ICU /** - * @brief Allow IRC control characters to appear even if protocol encoding explicitly disallows them. - * - * E.g. ISO-2022-JP disallows 0x0F, which in IRC means "reset format", - * so by default it gets replaced with U+FFFD ("replacement character"). - * https://code.google.com/p/chromium/issues/detail?id=277062#c3 - * - * In case if protocol encoding uses these code points for something else, the encoding takes preference, - * and they are not IRC control characters anymore. - */ + * @brief Allow IRC control characters to appear even if protocol encoding explicitly disallows them. + * + * E.g. ISO-2022-JP disallows 0x0F, which in IRC means "reset format", + * so by default it gets replaced with U+FFFD ("replacement character"). + * https://code.google.com/p/chromium/issues/detail?id=277062#c3 + * + * In case if protocol encoding uses these code points for something else, the encoding takes preference, + * and they are not IRC control characters anymore. + */ void IcuExtToUCallback(UConverterToUnicodeArgs* toArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, diff --git a/include/znc/Utils.h b/include/znc/Utils.h index 06c6ce3a..92b4be61 100644 --- a/include/znc/Utils.h +++ b/include/znc/Utils.h @@ -135,41 +135,41 @@ class CException { class CTable : protected std::vector> { public: /** Constructor - * - * @param uPreferredWidth If width of table is bigger than this, text in cells will be wrapped to several lines, if possible - */ + * + * @param uPreferredWidth If width of table is bigger than this, text in cells will be wrapped to several lines, if possible + */ CTable() : m_vsHeaders(), m_vsOutput() {} virtual ~CTable() {} /** Adds a new column to the table. - * Please note that you should add all columns before starting to fill - * the table! - * @param sName The name of the column. - * @return false if a column by that name already existed. - */ + * Please note that you should add all columns before starting to fill + * the table! + * @param sName The name of the column. + * @return false if a column by that name already existed. + */ bool AddColumn(const CString& sName); /** Adds a new row to the table. - * After calling this you can fill the row with content. - * @return The index of this row - */ + * After calling this you can fill the row with content. + * @return The index of this row + */ size_type AddRow(); /** Sets a given cell in the table to a value. - * @param sColumn The name of the column you want to fill. - * @param sValue The value to write into that column. - * @param uRowIdx The index of the row to use as returned by AddRow(). - * If this is not given, the last row will be used. - * @return True if setting the cell was successful. - */ + * @param sColumn The name of the column you want to fill. + * @param sValue The value to write into that column. + * @param uRowIdx The index of the row to use as returned by AddRow(). + * If this is not given, the last row will be used. + * @return True if setting the cell was successful. + */ bool SetCell(const CString& sColumn, const CString& sValue, size_type uRowIdx = ~0); /** Get a line of the table's output - * @param uIdx The index of the line you want. - * @param sLine This string will receive the output. - * @return True unless uIdx is past the end of the table. - */ + * @param uIdx The index of the line you want. + * @param sLine This string will receive the output. + * @return True unless uIdx is past the end of the table. + */ bool GetLine(unsigned int uIdx, CString& sLine) const; /// Completely clear the table. @@ -199,10 +199,10 @@ class CTable : protected std::vector> { class CBlowfish { public: /** - * @param sPassword key to encrypt with - * @param iEncrypt encrypt method (BF_DECRYPT or BF_ENCRYPT) - * @param sIvec what to set the ivector to start with, default sets it all 0's - */ + * @param sPassword key to encrypt with + * @param iEncrypt encrypt method (BF_DECRYPT or BF_ENCRYPT) + * @param sIvec what to set the ivector to start with, default sets it all 0's + */ CBlowfish(const CString& sPassword, int iEncrypt, const CString& sIvec = ""); ~CBlowfish(); @@ -244,31 +244,31 @@ class TCacheMap { virtual ~TCacheMap() {} /** - * @brief This function adds an item to the cache using the default time-to-live value - * @param Item the item to add to the cache - */ + * @brief This function adds an item to the cache using the default time-to-live value + * @param Item the item to add to the cache + */ void AddItem(const K& Item) { AddItem(Item, m_uTTL); } /** - * @brief This function adds an item to the cache using a custom time-to-live value - * @param Item the item to add to the cache - * @param uTTL the time-to-live for this specific item - */ + * @brief This function adds an item to the cache using a custom time-to-live value + * @param Item the item to add to the cache + * @param uTTL the time-to-live for this specific item + */ void AddItem(const K& Item, unsigned int uTTL) { AddItem(Item, V(), uTTL); } /** - * @brief This function adds an item to the cache using the default time-to-live value - * @param Item the item to add to the cache - * @param Val The value associated with the key Item - */ + * @brief This function adds an item to the cache using the default time-to-live value + * @param Item the item to add to the cache + * @param Val The value associated with the key Item + */ void AddItem(const K& Item, const V& Val) { AddItem(Item, Val, m_uTTL); } /** - * @brief This function adds an item to the cache using a custom time-to-live value - * @param Item the item to add to the cache - * @param Val The value associated with the key Item - * @param uTTL the time-to-live for this specific item - */ + * @brief This function adds an item to the cache using a custom time-to-live value + * @param Item the item to add to the cache + * @param Val The value associated with the key Item + * @param uTTL the time-to-live for this specific item + */ void AddItem(const K& Item, const V& Val, unsigned int uTTL) { if (!uTTL) { // If time-to-live is zero we don't want to waste our time adding @@ -281,20 +281,20 @@ class TCacheMap { } /** - * @brief Performs a Cleanup() and then checks to see if your item exists - * @param Item The item to check for - * @return true if item exists - */ + * @brief Performs a Cleanup() and then checks to see if your item exists + * @param Item The item to check for + * @return true if item exists + */ bool HasItem(const K& Item) { Cleanup(); return (m_mItems.find(Item) != m_mItems.end()); } /** - * @brief Performs a Cleanup() and returns a pointer to the object, or nullptr - * @param Item The item to check for - * @return Pointer to the item or nullptr if there is no suitable one - */ + * @brief Performs a Cleanup() and returns a pointer to the object, or nullptr + * @param Item The item to check for + * @return Pointer to the item or nullptr if there is no suitable one + */ V* GetItem(const K& Item) { Cleanup(); iterator it = m_mItems.find(Item); @@ -303,15 +303,15 @@ class TCacheMap { } /** - * @brief Removes a specific item from the cache - * @param Item The item to be removed - * @return true if item existed and was removed, false if it never existed - */ + * @brief Removes a specific item from the cache + * @param Item The item to be removed + * @return true if item existed and was removed, false if it never existed + */ bool RemItem(const K& Item) { return (m_mItems.erase(Item) != 0); } /** - * @brief Cycles through the queue removing all of the stale entries - */ + * @brief Cycles through the queue removing all of the stale entries + */ void Cleanup() { iterator it = m_mItems.begin(); @@ -325,13 +325,13 @@ class TCacheMap { } /** - * @brief Clear all entries - */ + * @brief Clear all entries + */ void Clear() { m_mItems.clear(); } /** - * @brief Returns all entries - */ + * @brief Returns all entries + */ std::map GetItems() { Cleanup(); std::map mItems; diff --git a/include/znc/ZNCString.h b/include/znc/ZNCString.h index 79c2a48b..cd08b809 100644 --- a/include/znc/ZNCString.h +++ b/include/znc/ZNCString.h @@ -105,11 +105,11 @@ class CString : public std::string { ~CString() {} /** - * Casts a CString to another type. Implemented via std::stringstream, you use this - * for any class that has an operator<<(std::ostream, YourClass). - * @param target The object to cast into. If the cast fails, its state is unspecified. - * @return True if the cast succeeds, and false if it fails. - */ + * Casts a CString to another type. Implemented via std::stringstream, you use this + * for any class that has an operator<<(std::ostream, YourClass). + * @param target The object to cast into. If the cast fails, its state is unspecified. + * @return True if the cast succeeds, and false if it fails. + */ template bool Convert(T* target) const { std::stringstream ss(*this); @@ -118,12 +118,12 @@ class CString : public std::string { } /** - * Joins a collection of objects together, using 'this' as a delimiter. - * You can pass either pointers to arrays, or iterators to collections. - * @param i_begin An iterator pointing to the beginning of a group of objects. - * @param i_end An iterator pointing past the end of a group of objects. - * @return The joined string - */ + * Joins a collection of objects together, using 'this' as a delimiter. + * You can pass either pointers to arrays, or iterators to collections. + * @param i_begin An iterator pointing to the beginning of a group of objects. + * @param i_end An iterator pointing past the end of a group of objects. + * @return The joined string + */ template CString Join(Iterator i_start, const Iterator& i_end) const { if (i_start == i_end) return CString(""); @@ -138,80 +138,80 @@ class CString : public std::string { } /** - * Compare this string caselessly to some other string. - * @param s The string to compare to. - * @param uLen The number of characters to compare. - * @return An integer less than, equal to, or greater than zero if this - * string smaller, equal.... to the given string. - */ + * Compare this string caselessly to some other string. + * @param s The string to compare to. + * @param uLen The number of characters to compare. + * @return An integer less than, equal to, or greater than zero if this + * string smaller, equal.... to the given string. + */ int CaseCmp(const CString& s, CString::size_type uLen = CString::npos) const; /** - * Compare this string case sensitively to some other string. - * @param s The string to compare to. - * @param uLen The number of characters to compare. - * @return An integer less than, equal to, or greater than zero if this - * string smaller, equal.... to the given string. - */ + * Compare this string case sensitively to some other string. + * @param s The string to compare to. + * @param uLen The number of characters to compare. + * @return An integer less than, equal to, or greater than zero if this + * string smaller, equal.... to the given string. + */ int StrCmp(const CString& s, CString::size_type uLen = CString::npos) const; /** - * Check if this string is equal to some other string. - * @param s The string to compare to. - * @param cs CaseSensitive if you want the comparison to be case - * sensitive, CaseInsensitive (default) otherwise. - * @return True if the strings are equal. - */ + * Check if this string is equal to some other string. + * @param s The string to compare to. + * @param cs CaseSensitive if you want the comparison to be case + * sensitive, CaseInsensitive (default) otherwise. + * @return True if the strings are equal. + */ bool Equals(const CString& s, CaseSensitivity cs = CaseInsensitive) const; /** - * @deprecated - */ + * @deprecated + */ bool Equals(const CString& s, bool bCaseSensitive, CString::size_type uLen = CString::npos) const; /** - * Do a wildcard comparison between two strings. - * For example, the following returns true: - * WildCmp("*!?bar@foo", "I_am!~bar@foo"); - * @param sWild The wildcards used for the comparison. - * @param sString The string that is used for comparing. - * @param cs CaseSensitive (default) if you want the comparison - * to be case sensitive, CaseInsensitive otherwise. - * @todo Make cs CaseInsensitive by default. - * @return true if the wildcard matches. - */ + * Do a wildcard comparison between two strings. + * For example, the following returns true: + * WildCmp("*!?bar@foo", "I_am!~bar@foo"); + * @param sWild The wildcards used for the comparison. + * @param sString The string that is used for comparing. + * @param cs CaseSensitive (default) if you want the comparison + * to be case sensitive, CaseInsensitive otherwise. + * @todo Make cs CaseInsensitive by default. + * @return true if the wildcard matches. + */ static bool WildCmp(const CString& sWild, const CString& sString, CaseSensitivity cs = CaseSensitive); /** - * Do a wild compare on this string. - * @param sWild The wildcards used to for the comparison. - * @param cs CaseSensitive (default) if you want the comparison - * to be case sensitive, CaseInsensitive otherwise. - * @todo Make cs CaseInsensitive by default. - * @return The result of this->WildCmp(sWild, *this);. - */ + * Do a wild compare on this string. + * @param sWild The wildcards used to for the comparison. + * @param cs CaseSensitive (default) if you want the comparison + * to be case sensitive, CaseInsensitive otherwise. + * @todo Make cs CaseInsensitive by default. + * @return The result of this->WildCmp(sWild, *this);. + */ bool WildCmp(const CString& sWild, CaseSensitivity cs = CaseSensitive) const; /** - * Turn all characters in this string into their upper-case equivalent. - * @returns A reference to *this. - */ + * Turn all characters in this string into their upper-case equivalent. + * @returns A reference to *this. + */ CString& MakeUpper(); /** - * Turn all characters in this string into their lower-case equivalent. - * @returns A reference to *this. - */ + * Turn all characters in this string into their lower-case equivalent. + * @returns A reference to *this. + */ CString& MakeLower(); /** - * Return a copy of this string with all characters turned into - * upper-case. - * @return The new string. - */ + * Return a copy of this string with all characters turned into + * upper-case. + * @return The new string. + */ CString AsUpper() const; /** - * Return a copy of this string with all characters turned into - * lower-case. - * @return The new string. - */ + * Return a copy of this string with all characters turned into + * lower-case. + * @return The new string. + */ CString AsLower() const; static EEscape ToEscape(const CString& sEsc); @@ -221,100 +221,100 @@ class CString : public std::string { CString& Escape(EEscape eTo); /** Replace all occurrences in a string. - * - * You can specify a "safe zone" via sLeft and sRight. Anything inside - * of such a zone will not be replaced. This does not do recursion, so - * e.g. with Replace("(a()a)", "a", "b", "(", ")", true) - * you would get "a(b)" as result. The second opening brace and the - * second closing brace would not be seen as a delimitered and thus - * wouldn't be removed. The first a is inside a "safe zone" and thus is - * left alone, too. - * - * @param sStr The string to do the replacing on. This will also contain - * the result when this function returns. - * @param sReplace The string that should be replaced. - * @param sWith The replacement to use. - * @param sLeft The string that marks the begin of the "safe zone". - * @param sRight The string that marks the end of the "safe zone". - * @param bRemoveDelims If this is true, all matches for sLeft and - * sRight are removed. - * @returns The number of replacements done. - */ + * + * You can specify a "safe zone" via sLeft and sRight. Anything inside + * of such a zone will not be replaced. This does not do recursion, so + * e.g. with Replace("(a()a)", "a", "b", "(", ")", true) + * you would get "a(b)" as result. The second opening brace and the + * second closing brace would not be seen as a delimitered and thus + * wouldn't be removed. The first a is inside a "safe zone" and thus is + * left alone, too. + * + * @param sStr The string to do the replacing on. This will also contain + * the result when this function returns. + * @param sReplace The string that should be replaced. + * @param sWith The replacement to use. + * @param sLeft The string that marks the begin of the "safe zone". + * @param sRight The string that marks the end of the "safe zone". + * @param bRemoveDelims If this is true, all matches for sLeft and + * sRight are removed. + * @returns The number of replacements done. + */ static unsigned int Replace(CString& sStr, const CString& sReplace, const CString& sWith, const CString& sLeft = "", const CString& sRight = "", bool bRemoveDelims = false); /** Replace all occurrences in the current string. - * @see CString::Replace - * @param sReplace The string to look for. - * @param sWith The replacement to use. - * @param sLeft The delimiter at the beginning of a safe zone. - * @param sRight The delimiter at the end of a safe zone. - * @param bRemoveDelims If true, all matching delimiters are removed. - * @return The result of the replacing. The current string is left - * unchanged. - */ + * @see CString::Replace + * @param sReplace The string to look for. + * @param sWith The replacement to use. + * @param sLeft The delimiter at the beginning of a safe zone. + * @param sRight The delimiter at the end of a safe zone. + * @param bRemoveDelims If true, all matching delimiters are removed. + * @return The result of the replacing. The current string is left + * unchanged. + */ CString Replace_n(const CString& sReplace, const CString& sWith, const CString& sLeft = "", const CString& sRight = "", bool bRemoveDelims = false) const; /** Replace all occurrences in the current string. - * @see CString::Replace - * @param sReplace The string to look for. - * @param sWith The replacement to use. - * @param sLeft The delimiter at the beginning of a safe zone. - * @param sRight The delimiter at the end of a safe zone. - * @param bRemoveDelims If true, all matching delimiters are removed. - * @returns The number of replacements done. - */ + * @see CString::Replace + * @param sReplace The string to look for. + * @param sWith The replacement to use. + * @param sLeft The delimiter at the beginning of a safe zone. + * @param sRight The delimiter at the end of a safe zone. + * @param bRemoveDelims If true, all matching delimiters are removed. + * @returns The number of replacements done. + */ unsigned int Replace(const CString& sReplace, const CString& sWith, const CString& sLeft = "", const CString& sRight = "", bool bRemoveDelims = false); /** Ellipsize the current string. - * For example, ellipsizing "Hello, I'm Bob" to the length 9 would - * result in "Hello,...". - * @param uLen The length to ellipsize to. - * @return The ellipsized string. - */ + * For example, ellipsizing "Hello, I'm Bob" to the length 9 would + * result in "Hello,...". + * @param uLen The length to ellipsize to. + * @return The ellipsized string. + */ CString Ellipsize(unsigned int uLen) const; /** Return the left part of the string. - * @param uCount The number of characters to keep. - * @return The resulting string. - */ + * @param uCount The number of characters to keep. + * @return The resulting string. + */ CString Left(size_type uCount) const; /** Return the right part of the string. - * @param uCount The number of characters to keep. - * @return The resulting string. - */ + * @param uCount The number of characters to keep. + * @return The resulting string. + */ CString Right(size_type uCount) const; /** Get the first line of this string. - * @return The first line of text. - */ + * @return The first line of text. + */ CString FirstLine() const { return Token(0, false, "\n"); } /** Get a token out of this string. For example in the string "a bc d e", - * each of "a", "bc", "d" and "e" are tokens. - * @param uPos The number of the token you are interested. The first - * token has a position of 0. - * @param bRest If false, only the token you asked for is returned. Else - * you get the substring starting from the beginning of - * your token. - * @param sSep Seperator between tokens. - * @param bAllowEmpty If this is true, empty tokens are allowed. In the - * example from above this means that there is a - * token "" before the "e" token. - * @return The token you asked for and, if bRest is true, everything - * after it. - * @see Split() if you need a string split into all of its tokens. - */ + * each of "a", "bc", "d" and "e" are tokens. + * @param uPos The number of the token you are interested. The first + * token has a position of 0. + * @param bRest If false, only the token you asked for is returned. Else + * you get the substring starting from the beginning of + * your token. + * @param sSep Seperator between tokens. + * @param bAllowEmpty If this is true, empty tokens are allowed. In the + * example from above this means that there is a + * token "" before the "e" token. + * @return The token you asked for and, if bRest is true, everything + * after it. + * @see Split() if you need a string split into all of its tokens. + */ CString Token(size_t uPos, bool bRest = false, const CString& sSep = " ", bool bAllowEmpty = false) const; /** Get a token out of this string. This function behaves much like the - * other Token() function in this class. The extra arguments are - * handled similarly to Split(). - */ + * other Token() function in this class. The extra arguments are + * handled similarly to Split(). + */ CString Token(size_t uPos, bool bRest, const CString& sSep, bool bAllowEmpty, const CString& sLeft, const CString& sRight, bool bTrimQuotes = true) const; @@ -324,49 +324,49 @@ class CString : public std::string { size_type QuoteSplit(VCString& vsRet) const; /** Split up this string into tokens. - * Via sLeft and sRight you can define "markers" like with Replace(). - * Anything in such a marked section is treated as a single token. All - * occurences of sDelim in such a block are ignored. - * @param sDelim Delimiter between tokens. - * @param vsRet Vector for returning the result. - * @param bAllowEmpty Do empty tokens count as a valid token? - * @param sLeft Left delimiter like with Replace(). - * @param sRight Right delimiter like with Replace(). - * @param bTrimQuotes Should sLeft and sRight be removed from the token - * they mark? - * @param bTrimWhiteSpace If this is true, CString::Trim() is called on - * each token. - * @return The number of tokens found. - */ + * Via sLeft and sRight you can define "markers" like with Replace(). + * Anything in such a marked section is treated as a single token. All + * occurences of sDelim in such a block are ignored. + * @param sDelim Delimiter between tokens. + * @param vsRet Vector for returning the result. + * @param bAllowEmpty Do empty tokens count as a valid token? + * @param sLeft Left delimiter like with Replace(). + * @param sRight Right delimiter like with Replace(). + * @param bTrimQuotes Should sLeft and sRight be removed from the token + * they mark? + * @param bTrimWhiteSpace If this is true, CString::Trim() is called on + * each token. + * @return The number of tokens found. + */ size_type Split(const CString& sDelim, VCString& vsRet, bool bAllowEmpty = true, const CString& sLeft = "", const CString& sRight = "", bool bTrimQuotes = true, bool bTrimWhiteSpace = false) const; /** Split up this string into tokens. - * This function is identical to the other CString::Split(), except that - * the result is returned as a SCString instead of a VCString. - */ + * This function is identical to the other CString::Split(), except that + * the result is returned as a SCString instead of a VCString. + */ size_type Split(const CString& sDelim, SCString& ssRet, bool bAllowEmpty = true, const CString& sLeft = "", const CString& sRight = "", bool bTrimQuotes = true, bool bTrimWhiteSpace = false) const; /** Build a string from a format string, replacing values from a map. - * The format specification can contain simple named parameters that match - * keys in the given map. For example in the string "a {b} c", the key "b" - * is looked up in the map, and inserted for "{b}". - * @param sFormat The format specification. - * @param msValues A map of named parameters to their values. - * @return The string with named parameters replaced. - */ + * The format specification can contain simple named parameters that match + * keys in the given map. For example in the string "a {b} c", the key "b" + * is looked up in the map, and inserted for "{b}". + * @param sFormat The format specification. + * @param msValues A map of named parameters to their values. + * @return The string with named parameters replaced. + */ static CString NamedFormat(const CString& sFormat, const MCString& msValues); /** Produces a random string. - * @param uLength The length of the resulting string. - * @return A random string. - */ + * @param uLength The length of the resulting string. + * @return A random string. + */ static CString RandomString(unsigned int uLength); /** @return The MD5 hash of this string. */ @@ -375,37 +375,37 @@ class CString : public std::string { CString SHA256() const; /** Treat this string as base64-encoded data and decode it. - * @param sRet String to which the result of the decode is safed. - * @return The length of the resulting string. - */ + * @param sRet String to which the result of the decode is safed. + * @return The length of the resulting string. + */ unsigned long Base64Decode(CString& sRet) const; /** Treat this string as base64-encoded data and decode it. - * The result is saved in this CString instance. - * @return The length of the resulting string. - */ + * The result is saved in this CString instance. + * @return The length of the resulting string. + */ unsigned long Base64Decode(); /** Treat this string as base64-encoded data and decode it. - * @return The decoded string. - */ + * @return The decoded string. + */ CString Base64Decode_n() const; /** Base64-encode the current string. - * @param sRet String where the result is saved. - * @param uWrap A boolean(!?!) that decides if the result should be - * wrapped after everywhere 57 characters. - * @return true unless this code is buggy. - * @todo WTF @ uWrap. - * @todo This only returns false if some formula we use was wrong?! - */ + * @param sRet String where the result is saved. + * @param uWrap A boolean(!?!) that decides if the result should be + * wrapped after everywhere 57 characters. + * @return true unless this code is buggy. + * @todo WTF @ uWrap. + * @todo This only returns false if some formula we use was wrong?! + */ bool Base64Encode(CString& sRet, unsigned int uWrap = 0) const; /** Base64-encode the current string. - * This string is overwritten with the result of the encode. - * @todo return value and param are as with Base64Encode() from above. - */ + * This string is overwritten with the result of the encode. + * @todo return value and param are as with Base64Encode() from above. + */ bool Base64Encode(unsigned int uWrap = 0); /** Base64-encode the current string - * @todo uWrap is as broken as Base64Encode()'s uWrap. - * @return The encoded string. - */ + * @todo uWrap is as broken as Base64Encode()'s uWrap. + * @return The encoded string. + */ CString Base64Encode_n(unsigned int uWrap = 0) const; #ifdef HAVE_LIBSSL @@ -417,19 +417,19 @@ class CString : public std::string { #endif /** Pretty-print a percent value. - * @param d The percent value. This should be in range 0-100. - * @return The "pretty" string. - */ + * @param d The percent value. This should be in range 0-100. + * @return The "pretty" string. + */ static CString ToPercent(double d); /** Pretty-print a number of bytes. - * @param d The number of bytes. - * @return A string describing the number of bytes. - */ + * @param d The number of bytes. + * @return A string describing the number of bytes. + */ static CString ToByteStr(unsigned long long d); /** Pretty-print a time span. - * @param s Number of seconds to print. - * @return A string like "4w 6d 4h 3m 58s". - */ + * @param s Number of seconds to print. + * @return A string like "4w 6d 4h 3m 58s". + */ static CString ToTimeStr(unsigned long s); /** @return True if this string is not "false". */ @@ -454,128 +454,128 @@ class CString : public std::string { double ToDouble() const; /** Trim this string. All leading/trailing occurences of characters from - * s are removed. - * @param s A list of characters that should be trimmed. - * @return true if this string was modified. - */ + * s are removed. + * @param s A list of characters that should be trimmed. + * @return true if this string was modified. + */ bool Trim(const CString& s = " \t\r\n"); /** Trim this string. All leading occurences of characters from s are - * removed. - * @param s A list of characters that should be trimmed. - * @return true if this string was modified. - */ + * removed. + * @param s A list of characters that should be trimmed. + * @return true if this string was modified. + */ bool TrimLeft(const CString& s = " \t\r\n"); /** Trim this string. All trailing occurences of characters from s are - * removed. - * @param s A list of characters that should be trimmed. - * @return true if this string was modified. - */ + * removed. + * @param s A list of characters that should be trimmed. + * @return true if this string was modified. + */ bool TrimRight(const CString& s = " \t\r\n"); /** Trim this string. All leading/trailing occurences of characters from - * s are removed. This CString instance is not modified. - * @param s A list of characters that should be trimmed. - * @return The trimmed string. - */ + * s are removed. This CString instance is not modified. + * @param s A list of characters that should be trimmed. + * @return The trimmed string. + */ CString Trim_n(const CString& s = " \t\r\n") const; /** Trim this string. All leading occurences of characters from s are - * removed. This CString instance is not modified. - * @param s A list of characters that should be trimmed. - * @return The trimmed string. - */ + * removed. This CString instance is not modified. + * @param s A list of characters that should be trimmed. + * @return The trimmed string. + */ CString TrimLeft_n(const CString& s = " \t\r\n") const; /** Trim this string. All trailing occurences of characters from s are - * removed. This CString instance is not modified. - * @param s A list of characters that should be trimmed. - * @return The trimmed string. - */ + * removed. This CString instance is not modified. + * @param s A list of characters that should be trimmed. + * @return The trimmed string. + */ CString TrimRight_n(const CString& s = " \t\r\n") const; /** Trim a given prefix. - * @param sPrefix The prefix that should be removed. - * @return True if this string was modified. - */ + * @param sPrefix The prefix that should be removed. + * @return True if this string was modified. + */ bool TrimPrefix(const CString& sPrefix = ":"); /** Trim a given suffix. - * @param sSuffix The suffix that should be removed. - * @return True if this string was modified. - */ + * @param sSuffix The suffix that should be removed. + * @return True if this string was modified. + */ bool TrimSuffix(const CString& sSuffix); /** Trim a given prefix. - * @param sPrefix The prefix that should be removed. - * @return A copy of this string without the prefix. - */ + * @param sPrefix The prefix that should be removed. + * @return A copy of this string without the prefix. + */ CString TrimPrefix_n(const CString& sPrefix = ":") const; /** Trim a given suffix. - * @param sSuffix The suffix that should be removed. - * @return A copy of this string without the prefix. - */ + * @param sSuffix The suffix that should be removed. + * @return A copy of this string without the prefix. + */ CString TrimSuffix_n(const CString& sSuffix) const; /** Find the position of the given substring. - * @param s The substring to search for. - * @param cs CaseSensitive if you want the comparison to be case - * sensitive, CaseInsensitive (default) otherwise. - * @return The position of the substring if found, CString::npos otherwise. - */ + * @param s The substring to search for. + * @param cs CaseSensitive if you want the comparison to be case + * sensitive, CaseInsensitive (default) otherwise. + * @return The position of the substring if found, CString::npos otherwise. + */ size_t Find(const CString& s, CaseSensitivity cs = CaseInsensitive) const; /** Check whether the string starts with a given prefix. - * @param sPrefix The prefix. - * @param cs CaseSensitive if you want the comparison to be case - * sensitive, CaseInsensitive (default) otherwise. - * @return True if the string starts with prefix, false otherwise. - */ + * @param sPrefix The prefix. + * @param cs CaseSensitive if you want the comparison to be case + * sensitive, CaseInsensitive (default) otherwise. + * @return True if the string starts with prefix, false otherwise. + */ bool StartsWith(const CString& sPrefix, CaseSensitivity cs = CaseInsensitive) const; /** Check whether the string ends with a given suffix. - * @param sSuffix The suffix. - * @param cs CaseSensitive if you want the comparison to be case - * sensitive, CaseInsensitive (default) otherwise. - * @return True if the string ends with suffix, false otherwise. - */ + * @param sSuffix The suffix. + * @param cs CaseSensitive if you want the comparison to be case + * sensitive, CaseInsensitive (default) otherwise. + * @return True if the string ends with suffix, false otherwise. + */ bool EndsWith(const CString& sSuffix, CaseSensitivity cs = CaseInsensitive) const; /** - * Check whether the string contains a given string. - * @param s The string to search. - * @param bCaseSensitive Whether the search is case sensitive. - * @return True if this string contains the other string, falser otherwise. - */ + * Check whether the string contains a given string. + * @param s The string to search. + * @param bCaseSensitive Whether the search is case sensitive. + * @return True if this string contains the other string, falser otherwise. + */ bool Contains(const CString& s, CaseSensitivity cs = CaseInsensitive) const; /** Remove characters from the beginning of this string. - * @param uLen The number of characters to remove. - * @return true if this string was modified. - */ + * @param uLen The number of characters to remove. + * @return true if this string was modified. + */ bool LeftChomp(size_type uLen = 1); /** Remove characters from the end of this string. - * @param uLen The number of characters to remove. - * @return true if this string was modified. - */ + * @param uLen The number of characters to remove. + * @return true if this string was modified. + */ bool RightChomp(size_type uLen = 1); /** Remove characters from the beginning of this string. - * This string object isn't modified. - * @param uLen The number of characters to remove. - * @return The result of the conversion. - */ + * This string object isn't modified. + * @param uLen The number of characters to remove. + * @return The result of the conversion. + */ CString LeftChomp_n(size_type uLen = 1) const; /** Remove characters from the end of this string. - * This string object isn't modified. - * @param uLen The number of characters to remove. - * @return The result of the conversion. - */ + * This string object isn't modified. + * @param uLen The number of characters to remove. + * @return The result of the conversion. + */ CString RightChomp_n(size_type uLen = 1) const; /** Remove controls characters from this string. - * Controls characters are color codes, and those in C0 set - * See https://en.wikipedia.org/wiki/C0_and_C1_control_codes - * @return The result of the conversion. - */ + * Controls characters are color codes, and those in C0 set + * See https://en.wikipedia.org/wiki/C0_and_C1_control_codes + * @return The result of the conversion. + */ CString& StripControls(); /** Remove controls characters from this string. - * Controls characters are color codes, and those in C0 set - * See https://en.wikipedia.org/wiki/C0_and_C1_control_codes - * This string object isn't modified. - * @return The result of the conversion. - */ + * Controls characters are color codes, and those in C0 set + * See https://en.wikipedia.org/wiki/C0_and_C1_control_codes + * This string object isn't modified. + * @return The result of the conversion. + */ CString StripControls_n() const; private: @@ -606,7 +606,7 @@ class MCString : public std::map { static const MCString EmptyMap; /** Status codes that can be returned by WriteToDisk() and - * ReadFromDisk(). */ + * ReadFromDisk(). */ enum status_t { /// No errors. MCS_SUCCESS = 0, @@ -621,43 +621,43 @@ class MCString : public std::map { }; /** Write this map to a file. - * @param sPath The file name to write to. - * @param iMode The mode for the file. - * @return The result of the operation. - * @see WriteFilter. - */ + * @param sPath The file name to write to. + * @param iMode The mode for the file. + * @return The result of the operation. + * @see WriteFilter. + */ enum status_t WriteToDisk(const CString& sPath, mode_t iMode = 0644) const; /** Read a map from a file. - * @param sPath The file name to read from. - * @return The result of the operation. - * @see ReadFilter. - */ + * @param sPath The file name to read from. + * @return The result of the operation. + * @see ReadFilter. + */ enum status_t ReadFromDisk(const CString& sPath); /** Filter used while writing this map. This function is called by - * WriteToDisk() for each pair that is going to be written. This - * function has the chance to modify the data that will be written. - * @param sKey The key that will be written. Can be modified. - * @param sValue The value that will be written. Can be modified. - * @return true unless WriteToDisk() should fail with MCS_EWRITEFIL. - */ + * WriteToDisk() for each pair that is going to be written. This + * function has the chance to modify the data that will be written. + * @param sKey The key that will be written. Can be modified. + * @param sValue The value that will be written. Can be modified. + * @return true unless WriteToDisk() should fail with MCS_EWRITEFIL. + */ virtual bool WriteFilter(CString& sKey, CString& sValue) const { return true; } /** Filter used while reading this map. This function is called by - * ReadFromDisk() for each pair that is beging read. This function has - * the chance to modify the data that is being read. - * @param sKey The key that was read. Can be modified. - * @param sValue The value that was read. Can be modified. - * @return true unless ReadFromDisk() should fail with MCS_EWRITEFIL. - */ + * ReadFromDisk() for each pair that is beging read. This function has + * the chance to modify the data that is being read. + * @param sKey The key that was read. Can be modified. + * @param sValue The value that was read. Can be modified. + * @return true unless ReadFromDisk() should fail with MCS_EWRITEFIL. + */ virtual bool ReadFilter(CString& sKey, CString& sValue) const { return true; } /** Encode a value so that it can safely be parsed by ReadFromDisk(). - * This is an internal function. - */ + * This is an internal function. + */ virtual CString& Encode(CString& sValue) const; /** Undo the effects of Encode(). This is an internal function. */ virtual CString& Decode(CString& sValue) const; diff --git a/include/znc/znc.h b/include/znc/znc.h index 30a8b200..97e50ed6 100644 --- a/include/znc/znc.h +++ b/include/znc/znc.h @@ -180,12 +180,12 @@ class CZNC { CModule* FindModule(const CString& sModName, CUser* pUser); /** Reload a module everywhere - * - * This method will unload a module globally, for a user and for each - * network. It will then reload them all again. - * - * @param sModule The name of the module to reload - */ + * + * This method will unload a module globally, for a user and for each + * network. It will then reload them all again. + * + * @param sModule The name of the module to reload + */ bool UpdateModule(const CString& sModule); bool DeleteUser(const CString& sUsername); diff --git a/src/Template.cpp b/src/Template.cpp index 5f06bf1b..d22838bd 100644 --- a/src/Template.cpp +++ b/src/Template.cpp @@ -845,10 +845,10 @@ CString CTemplate::GetValue(const CString& sArgs, bool bFromIf) { } /* We have no CConfig in ZNC land - * Hmm... Actually, we do have it now. - if (msArgs.find("CONFIG") != msArgs.end()) { - sRet = CConfig::GetValue(sName); - } else*/ if (msArgs.find("ROWS") != msArgs.end()) { + * Hmm... Actually, we do have it now. + if (msArgs.find("CONFIG") != msArgs.end()) { + sRet = CConfig::GetValue(sName); + } else*/ if (msArgs.find("ROWS") != msArgs.end()) { vector* pLoop = GetLoop(sName); sRet = CString((pLoop) ? pLoop->size() : 0); } else if (msArgs.find("TOP") == msArgs.end() && pContext) {