1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style channel mode +c */
18 /** Handles the +c channel mode
20 class BlockColor : public SimpleChannelModeHandler
23 BlockColor(Module* Creator) : SimpleChannelModeHandler(Creator, "blockcolor", 'c') { }
26 class ModuleBlockColor : public Module
32 ModuleBlockColor() : bc(this)
34 if (!ServerInstance->Modes->AddMode(&bc))
35 throw ModuleException("Could not add new modes!");
36 Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
37 ServerInstance->Modules->Attach(eventlist, this, 3);
40 virtual void On005Numeric(std::string &output)
42 ServerInstance->AddExtBanChar('c');
45 virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
47 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
49 Channel* c = (Channel*)dest;
50 ModResult res = ServerInstance->OnCheckExemption(user,c,"blockcolor");
52 if (res == MOD_RES_ALLOW)
53 return MOD_RES_PASSTHRU;
55 if (!c->GetExtBanStatus(user, 'c').check(!c->IsModeSet('c')))
57 for (std::string::iterator i = text.begin(); i != text.end(); i++)
67 user->WriteNumeric(404, "%s %s :Can't send colors to channel (+c set)",user->nick.c_str(), c->name.c_str());
74 return MOD_RES_PASSTHRU;
77 virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
79 return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
82 virtual ~ModuleBlockColor()
86 virtual Version GetVersion()
88 return Version("Provides support for unreal-style channel mode +c",VF_VENDOR);
92 MODULE_INIT(ModuleBlockColor)