From e336f4047eacfd09d4c57d61b348c9178d4573af Mon Sep 17 00:00:00 2001 From: danieldg Date: Mon, 1 Feb 2010 01:30:39 +0000 Subject: 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 --- src/modules/m_check.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src') 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::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::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); -- cgit v1.2.3