]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Display allowed oper modes, commands, and permissions in /CHECK
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 1 Feb 2010 01:30:39 +0000 (01:30 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 1 Feb 2010 01:30:39 +0000 (01:30 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12344 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_check.cpp

index 231064431c8a6752398318acb1b317f10ae83c1a..c1af8ead2070a3f07b5055c4384ec9666b5a277f 100644 (file)
@@ -97,8 +97,40 @@ class CommandCheck : public Command
 
                        if (IS_OPER(targuser))
                        {
+                               OperInfo* oper = targuser->oper;
                                /* user is an oper of type ____ */
-                               user->SendText(checkstr + " opertype " + targuser->oper->NameStr());
+                               user->SendText(checkstr + " opertype " + oper->NameStr());
+                               if (IS_LOCAL(targuser))
+                               {
+                                       std::string umodes;
+                                       std::string cmodes;
+                                       for(char c='A'; c < 'z'; c++)
+                                       {
+                                               ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER);
+                                               if (mh && mh->NeedsOper() && oper->AllowedUserModes[c])
+                                                       umodes.push_back(c);
+                                               mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL);
+                                               if (mh && mh->NeedsOper() && oper->AllowedChanModes[c])
+                                                       cmodes.push_back(c);
+                                       }
+                                       user->SendText(checkstr + " modeperms user=" + umodes + " channel=" + cmodes);
+                                       std::string opcmds;
+                                       for(std::set<std::string>::iterator i = oper->AllowedOperCommands.begin(); i != oper->AllowedOperCommands.end(); i++)
+                                       {
+                                               opcmds.push_back(' ');
+                                               opcmds.append(*i);
+                                       }
+                                       std::stringstream opcmddump(opcmds);
+                                       user->SendText(checkstr + " commandperms", opcmddump);
+                                       std::string privs;
+                                       for(std::set<std::string>::iterator i = oper->AllowedPrivs.begin(); i != oper->AllowedPrivs.end(); i++)
+                                       {
+                                               privs.push_back(' ');
+                                               privs.append(*i);
+                                       }
+                                       std::stringstream privdump(privs);
+                                       user->SendText(checkstr + " permissions", privdump);
+                               }
                        }
 
                        LocalUser* loctarg = IS_LOCAL(targuser);