From 034f74a23b3d6aff177682c916e18382621f495a Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 28 Oct 2006 18:12:45 +0000 Subject: Add support for OnWhoisLine, which allows modules to change or drop any line of whois before its sent to a user git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5570 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 4 ++++ include/modules.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/inspircd.h b/include/inspircd.h index 16b42e50b..1aead5d5e 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -998,6 +998,10 @@ class InspIRCd : public classbase */ void Log(int level, const std::string &text); + void SendWhoisLine(userrec* user, int numeric, const std::string &text); + + void SendWhoisLine(userrec* user, int numeric, const char* format, ...); + /** Begin execution of the server. * NOTE: this function NEVER returns. Internally, * after performing some initialisation routines, diff --git a/include/modules.h b/include/modules.h index 18269e144..2d7e9f4ab 100644 --- a/include/modules.h +++ b/include/modules.h @@ -356,7 +356,8 @@ enum Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange, I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister, - I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList, I_OnPostCommand, I_OnPostJoin }; + I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList, + I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine }; /** Base class for all InspIRCd modules * This class is the base class for InspIRCd modules. All modules must inherit from this class, @@ -1286,6 +1287,18 @@ class Module : public Extensible * return 0. */ virtual int OnUserList(userrec* user, chanrec* Ptr); + + /** Called whenever a line of WHOIS output is sent to a user. + * You may change the numeric and the text of the output by changing + * the values numeric and text, but you cannot change the user the + * numeric is sent to. You may however change the user's userrec values. + * @param user The user the numeric is being sent to + * @param numeric The numeric of the line being sent + * @param text The text of the numeric, including any parameters + * @return nonzero to drop the line completely so that the user does not + * receive it, or zero to allow the line to be sent. + */ + virtual int OnWhoisLine(userrec* user, int &numeric, std::string &text); }; -- cgit v1.2.3