2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
5 * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
7 * This file is part of InspIRCd. InspIRCd is free software: you can
8 * redistribute it and/or modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation, version 2.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 class ModuleBadChannelExtban : public Module
26 Version GetVersion() CXX11_OVERRIDE
28 return Version("Extban 'j' - channel status/join ban", VF_OPTCOMMON|VF_VENDOR);
31 ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) CXX11_OVERRIDE
33 if ((mask.length() > 2) && (mask[0] == 'j') && (mask[1] == ':'))
35 std::string rm(mask, 2);
37 const PrefixMode* const mh = ServerInstance->Modes->FindPrefix(rm[0]);
40 rm.assign(mask, 3, std::string::npos);
41 status = mh->GetModeChar();
43 for (User::ChanList::iterator i = user->chans.begin(); i != user->chans.end(); i++)
45 if (InspIRCd::Match((*i)->chan->name, rm))
47 if ((!status) || ((*i)->HasMode(mh)))
52 return MOD_RES_PASSTHRU;
55 void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
57 tokens["EXTBAN"].push_back('j');
61 MODULE_INIT(ModuleBadChannelExtban)