Add OnSendToIRCMessage and OnSendToClientMessage

This also alters PutClient such that the CMessage variant handles
sending messages, rather than the CString variant. As a side bonus, this
gives callers better information on whether the message was sent to the
client. Additionally, it eliminates the need for a hook to let modules
set the tags sent to a client, as that can now be done inside
OnSendToClientMessage.
This commit is contained in:
Eli Young
2017-04-11 13:03:38 -07:00
parent f37aa308e1
commit 823ac07240
13 changed files with 123 additions and 26 deletions
+13 -5
View File
@@ -1026,18 +1026,24 @@ class CModule {
*/
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.
/** Called immediately before ZNC sends a raw traffic line to a client.
* @since 1.7.0
* @param Message The message being sent to the client.
* @warning Calling PutUser() from within this hook leads to infinite recursion.
* @return See CModule::EModRet.
*/
virtual EModRet OnSendToClientMessage(CMessage& Message);
/// @deprecated Use OnSendToClientMessage() instead.
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.
/** Called immediately before ZNC sends a raw traffic line to the IRC server.
* @since 1.7.0
* @param Message The message being sent to the IRC server.
* @warning Calling PutIRC() from within this hook leads to infinite recursion.
* @return See CModule::EModRet.
*/
virtual EModRet OnSendToIRCMessage(CMessage& Message);
/// @deprecated Use OnSendToIRCMessage() instead.
virtual EModRet OnSendToIRC(CString& sLine);
ModHandle GetDLL() { return m_pDLL; }
@@ -1515,7 +1521,9 @@ class CModules : public std::vector<CModule*> {
bool OnDeleteNetwork(CIRCNetwork& Network);
bool OnSendToClient(CString& sLine, CClient& Client);
bool OnSendToClientMessage(CMessage& Message);
bool OnSendToIRC(CString& sLine);
bool OnSendToIRCMessage(CMessage& Message);
bool OnServerCapAvailable(const CString& sCap);
bool OnServerCapResult(const CString& sCap, bool bSuccess);