X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_servprotect.cpp;h=7df9effcc732d32ae5a59b18b55de5c38d5af8a9;hb=6c2edc2c5ab07a1fa8c32d3fa9abd6b9149b804c;hp=b38f18cc97744d4330e08caad4aaea7fb45f2fe8;hpb=9336468f5bfa60318cb57db5126047147b7a21cb;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index b38f18cc9..7df9effcc 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -1,16 +1,24 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2008 Craig Edwards + * Copyright (C) 2007 Robin Burchell * - * 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 support for Austhex style +k / UnrealIRCD +S services mode */ @@ -20,7 +28,7 @@ class ServProtectMode : public ModeHandler { public: - ServProtectMode(Module* Creator) : ModeHandler(Creator, 'k', PARAM_NONE, MODETYPE_USER) { oper = true; } + ServProtectMode(Module* Creator) : ModeHandler(Creator, "servprotect", 'k', PARAM_NONE, MODETYPE_USER) { oper = true; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -56,7 +64,7 @@ class ModuleServProtectMode : public Module Version GetVersion() { - return Version("Provides support for Austhex style +k / UnrealIRCD +S services mode", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("Provides support for Austhex style +k / UnrealIRCD +S services mode", VF_VENDOR); } void OnWhois(User* src, User* dst) @@ -79,11 +87,12 @@ class ModuleServProtectMode : public Module User *u = ServerInstance->FindNick(param); if (u) { + Membership* memb = chan->GetUser(u); /* The target user has +k set on themselves, and you are trying to remove a privilege mode the user has set on themselves. * This includes any prefix permission mode, even those registered in other modules, e.g. +qaohv. Using ::ModeString() * here means that the number of modes is restricted to only modes the user has, limiting it to as short a loop as possible. */ - if (u->IsModeSet('k') && ServerInstance->Modes->ModeString(u, chan, false).find(mode) != std::string::npos) + if (u->IsModeSet('k') && memb && memb->modes.find(mode) != std::string::npos) { /* BZZZT, Denied! */ user->WriteNumeric(482, "%s %s :You are not permitted to remove privileges from %s services", user->nick.c_str(), chan->name.c_str(), ServerInstance->Config->Network.c_str());