2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2004-2006, 2008 Craig Edwards <craigedwards@brainbox.cc>
5 * Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
6 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
7 * Copyright (C) 2005, 2007 Robin Burchell <robin+git@viroteck.net>
8 * Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
10 * This file is part of InspIRCd. InspIRCd is free software: you can
11 * redistribute it and/or modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation, version 2.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 /** Handles the +c channel mode
28 class BlockColor : public SimpleChannelModeHandler
31 BlockColor(Module* Creator) : SimpleChannelModeHandler(Creator, "blockcolor", 'c') { }
34 class ModuleBlockColor : public Module
39 ModuleBlockColor() : bc(this)
43 void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
45 tokens["EXTBAN"].push_back('c');
48 ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE
50 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
52 Channel* c = (Channel*)dest;
53 ModResult res = ServerInstance->OnCheckExemption(user,c,"blockcolor");
55 if (res == MOD_RES_ALLOW)
56 return MOD_RES_PASSTHRU;
58 if (!c->GetExtBanStatus(user, 'c').check(!c->IsModeSet(bc)))
60 for (std::string::iterator i = text.begin(); i != text.end(); i++)
70 user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Can't send colors to channel (+c set)", c->name.c_str());
77 return MOD_RES_PASSTHRU;
80 Version GetVersion() CXX11_OVERRIDE
82 return Version("Provides channel mode +c to block color",VF_VENDOR);
86 MODULE_INIT(ModuleBlockColor)