]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_hideoper.cpp
Replace OnAccessCheck with OnPreMode to remove a number of redundant checks
[user/henk/code/inspircd.git] / src / modules / m_hideoper.cpp
index 51d1259ed4e4f9399447abd69cff39a31c463a8d..757f2d9af0083e0cbf66d1ed9dffcac616848505 100644 (file)
@@ -22,7 +22,7 @@ class HideOper : public ModeHandler
  public:
        HideOper(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'H', 0, 0, false, MODETYPE_USER, true) { }
 
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
                if (adding)
                {
@@ -70,21 +70,32 @@ class ModuleHideOper : public Module
                return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 
-       int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
+       ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
        {
                /* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the
                 * person doing the WHOIS is not an oper
                 */
                if (numeric != 313)
-                       return 0;
+                       return MOD_RES_PASSTHRU;
 
                if (!dest->IsModeSet('H'))
-                       return 0;
+                       return MOD_RES_PASSTHRU;
 
                if (!user->HasPrivPermission("users/auspex"))
-                       return 1;
+                       return MOD_RES_DENY;
 
-               return 0;
+               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);
+               }
        }
 };