X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_serverban.cpp;h=bd512f58bb23e3d7de5228137f878d9d29dc5b30;hb=e59cb85871f75b7603c63c6cd274d57536cf6794;hp=8103662495c6ad430f5b95815046f7c6441b2c05;hpb=6d03943426dcce76ba66567a9b18425a5ebb4c0c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp index 810366249..bd512f58b 100644 --- a/src/modules/m_serverban.cpp +++ b/src/modules/m_serverban.cpp @@ -1,54 +1,46 @@ -/* +------------------------------------+ - * | 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) 2008 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: Implements extban +b s: - server name bans */ +#include "inspircd.h" class ModuleServerBan : public Module { - private: public: - ModuleServerBan() { - Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, 2); - } - - ~ModuleServerBan() + Version GetVersion() CXX11_OVERRIDE { + return Version("Provides extban 's' to ban users connected to a specified server", VF_OPTCOMMON|VF_VENDOR); } - Version GetVersion() + ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) CXX11_OVERRIDE { - return Version("Extban 's' - server ban",VF_COMMON|VF_VENDOR); - } - - ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) - { - if (mask[0] == 's' && mask[1] == ':') + if ((mask.length() > 2) && (mask[0] == 's') && (mask[1] == ':')) { - if (InspIRCd::Match(user->server, mask.substr(2))) + if (InspIRCd::Match(user->server->GetName(), mask.substr(2))) return MOD_RES_DENY; } return MOD_RES_PASSTHRU; } - void On005Numeric(std::string &output) + void On005Numeric(std::map& tokens) CXX11_OVERRIDE { - ServerInstance->AddExtBanChar('s'); + tokens["EXTBAN"].push_back('s'); } }; - MODULE_INIT(ModuleServerBan) -