diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:51:56 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:51:56 +0000 |
commit | 1b3dabf0ba0088bf7a8493fe89e478731ad0d307 (patch) | |
tree | 2a30c405eef3f4c97e08950d95d2203be87b1aca /src/modules | |
parent | 0155dd1e97f323668442d3fc07b927e8f9004dbe (diff) |
Add OnSendWhoLine hook, and use it in the oper hiding modules
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11650 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_hideoper.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_invisible.cpp | 26 |
2 files changed, 28 insertions, 9 deletions
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index b19ecb97c..757f2d9af 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -86,6 +86,17 @@ class ModuleHideOper : public Module return MOD_RES_PASSTHRU; } + + void OnSendWhoLine(User* source, User* user, Channel* channel, std::string& line) + { + if (user->IsModeSet('H') && !source->HasPrivPermission("users/auspex")) + { + // hide the "*" that marks the user as an oper from the /WHO line + std::string::size_type pos = line.find("* "); + if (pos != std::string::npos) + line.erase(pos); + } + } }; diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 1d8c8a385..678b9cc49 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -117,8 +117,11 @@ class ModuleInvisible : public Module /* Yeah i know people can take this out. I'm not about to obfuscate code just to be a pain in the ass. */ ServerInstance->Users->ServerNoticeAll("*** m_invisible.so has just been loaded on this network. For more information, please visit http://inspircd.org/wiki/Modules/invisible"); - Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserJoin, I_OnUserPart, I_OnUserQuit, I_OnRehash, I_OnHostCycle }; - ServerInstance->Modules->Attach(eventlist, this, 7); + Implementation eventlist[] = { + I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserJoin, I_OnUserPart, I_OnUserQuit, + I_OnRehash, I_OnHostCycle, I_OnSendWhoLine + }; + ServerInstance->Modules->Attach(eventlist, this, 8); }; virtual ~ModuleInvisible() @@ -128,17 +131,16 @@ class ModuleInvisible : public Module delete conf; }; - virtual Version GetVersion(); - virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created); - virtual void OnRehash(User* user); + Version GetVersion(); + void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created); + void OnRehash(User* user); void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent); void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message); ModResult OnHostCycle(User* user); - /* No privmsg response when hiding - submitted by Eric at neowin */ - virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); - virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); - /* Fix by Eric @ neowin.net, thanks :) -- Brain */ + ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); + ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); void WriteCommonFrom(User *user, Channel* channel, const char* text, ...) CUSTOM_PRINTF(4, 5); + void OnSendWhoLine(User* source, User* user, Channel* channel, std::string& line); }; Version ModuleInvisible::GetVersion() @@ -246,4 +248,10 @@ void ModuleInvisible::WriteCommonFrom(User *user, Channel* channel, const char* } } +void ModuleInvisible::OnSendWhoLine(User* source, User* user, Channel* channel, std::string& line) +{ + if (user->IsModeSet('Q') && !IS_OPER(source)) + line.clear(); +} + MODULE_INIT(ModuleInvisible) |