From cb6917c48eceeaa0f9980d8efbec8b23fc91d3bf Mon Sep 17 00:00:00 2001 From: w00t Date: Fri, 22 Aug 2008 18:01:15 +0000 Subject: [PATCH] Add OnSendSnotice(char &, std::string &, const std::string &) to modify/block/notify about snotices being sent to users. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10221 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/modules.h | 11 ++++++++++- src/modules.cpp | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/modules.h b/include/modules.h index f527cb065..3aa7a94ac 100644 --- a/include/modules.h +++ b/include/modules.h @@ -384,7 +384,7 @@ enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFOR enum Implementation { I_BEGIN, - I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart, I_OnRehash, I_OnServerRaw, + I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart, I_OnRehash, I_OnServerRaw, I_OnSendSnotice, I_OnUserPreJoin, I_OnUserPreKick, I_OnUserKick, I_OnOper, I_OnInfo, I_OnWhois, I_OnUserPreInvite, I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode, I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData, @@ -527,6 +527,15 @@ class CoreExport Module : public Extensible */ virtual void OnServerRaw(std::string &raw, bool inbound, User* user); + /** Called whenever a snotice is about to be sent to a snomask. + * snomask and type may both be modified; the message may not. + * @param snomask The snomask the message is going to (e.g. 'A') + * @param type The textual description the snomask will go to (e.g. 'OPER') + * @param message The text message to be sent via snotice + * @return 1 to block the snotice from being sent entirely, 0 else. + */ + virtual int OnSendSnotice(char &snomask, std::string &type, const std::string &message); + /** Called whenever a user is about to join a channel, before any processing is done. * Returning a value of 1 from this function stops the process immediately, causing no * output to be sent to the user by the core. If you do this you must produce your own numerics, diff --git a/src/modules.cpp b/src/modules.cpp index bc72f9f97..c3c07216e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -103,8 +103,10 @@ std::string Event::GetEventID() // These declarations define the behavours of the base class Module (which does nothing at all) - Module::Module(InspIRCd* Me) : ServerInstance(Me) { } - Module::~Module() { } +Module::Module(InspIRCd* Me) : ServerInstance(Me) { } +Module::~Module() { } + +int Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return 0; } void Module::OnUserConnect(User*) { } void Module::OnUserQuit(User*, const std::string&, const std::string&) { } void Module::OnUserDisconnect(User*) { } -- 2.39.5