X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_serverban.cpp;h=bd512f58bb23e3d7de5228137f878d9d29dc5b30;hb=e59cb85871f75b7603c63c6cd274d57536cf6794;hp=3b3bcc320916ae4c07720a999e4e42a29ad9fec3;hpb=8de87c2a9b5f5e68caac1ca06b1021ed69cb3d6a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp index 3b3bcc320..bd512f58b 100644 --- a/src/modules/m_serverban.cpp +++ b/src/modules/m_serverban.cpp @@ -1,62 +1,46 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/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(InspIRCd* Me) : Module(Me) - { - Implementation eventlist[] = { I_OnUserPreJoin, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, 2); - } - - virtual ~ModuleServerBan() - { - } - - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { - return Version("$Id$",VF_VENDOR,API_VERSION); + return Version("Provides extban 's' to ban users connected to a specified server", VF_OPTCOMMON|VF_VENDOR); } - virtual int OnUserPreJoin(User *user, Channel *c, const char *cname, std::string &privs, const std::string &key) + ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) CXX11_OVERRIDE { - if (!IS_LOCAL(user)) - return 0; - - if (!c) - return 0; - - if (c->IsExtBanned(user->server, 's')) + if ((mask.length() > 2) && (mask[0] == 's') && (mask[1] == ':')) { - user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Cannot join channel (You're banned)", user->nick.c_str(), c->name.c_str()); - return 1; + if (InspIRCd::Match(user->server->GetName(), mask.substr(2))) + return MOD_RES_DENY; } - - return 0; + return MOD_RES_PASSTHRU; } - virtual void On005Numeric(std::string &output) + void On005Numeric(std::map& tokens) CXX11_OVERRIDE { - ServerInstance->AddExtBanChar('s'); + tokens["EXTBAN"].push_back('s'); } }; - MODULE_INIT(ModuleServerBan) -