X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_check.cpp;h=cabfd02bcfe782f2128f4ceb57b93427820e95b0;hb=553a8da754c8cd308bad2008018849714e70f9b7;hp=231064431c8a6752398318acb1b317f10ae83c1a;hpb=cd712c40e1b352c05e7ae0f72e0a5e84cdf64323;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 231064431..cabfd02bc 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -1,16 +1,25 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006-2007 Robin Burchell + * Copyright (C) 2006 Craig Edwards * - * This program is free but copyrighted software; see - * the file COPYING for details. + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + #include "inspircd.h" /* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */ @@ -75,6 +84,7 @@ class CommandCheck : public Command if (targuser) { + LocalUser* loctarg = IS_LOCAL(targuser); /* /check on a user */ user->SendText(checkstr + " nuh " + targuser->GetFullHost()); user->SendText(checkstr + " realnuh " + targuser->GetFullRealHost()); @@ -85,7 +95,7 @@ class CommandCheck : public Command user->SendText(checkstr + " uid " + targuser->uuid); user->SendText(checkstr + " signon " + timestring(targuser->signon)); user->SendText(checkstr + " nickts " + timestring(targuser->age)); - if (IS_LOCAL(targuser)) + if (loctarg) user->SendText(checkstr + " lastmsg " + timestring(targuser->idle_lastmsg)); if (IS_AWAY(targuser)) @@ -97,11 +107,42 @@ 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 (loctarg) + { + 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() && loctarg->HasModePermission(c, MODETYPE_USER)) + umodes.push_back(c); + mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL); + if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_CHANNEL)) + 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); if (loctarg) { user->SendText(checkstr + " clientaddr " + irc::sockets::satouser(loctarg->client_sa)); @@ -218,7 +259,11 @@ class ModuleCheck : public Module public: ModuleCheck() : mycommand(this) { - ServerInstance->AddCommand(&mycommand); + } + + void init() + { + ServerInstance->Modules->AddService(mycommand); } ~ModuleCheck()