summaryrefslogtreecommitdiff
path: root/src/modules/m_check.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-01 01:30:39 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-01 01:30:39 +0000
commite336f4047eacfd09d4c57d61b348c9178d4573af (patch)
treefb047690065dfd93b5a89430394f2081d9cafc6a /src/modules/m_check.cpp
parent490446040d80d144e64ddf8e52515df1f40f1fd7 (diff)
Display allowed oper modes, commands, and permissions in /CHECK
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12344 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_check.cpp')
-rw-r--r--src/modules/m_check.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 231064431..c1af8ead2 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -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);