]> 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 be4de8f8d8b5f727d964dd28667ea1bb40c4fca0..757f2d9af0083e0cbf66d1ed9dffcac616848505 100644 (file)
@@ -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);
+               }
        }
 };