1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/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(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'c') { }
26 class ModuleBlockColour : public Module
32 ModuleBlockColour(InspIRCd* Me) : Module(Me)
34 bc = new BlockColor(ServerInstance);
35 if (!ServerInstance->Modes->AddMode(bc))
36 throw ModuleException("Could not add new modes!");
37 Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
38 ServerInstance->Modules->Attach(eventlist, this, 2);
43 virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
45 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
47 Channel* c = (Channel*)dest;
49 if (CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) == STATUS_OP)
56 for (std::string::iterator i = text.begin(); i != text.end(); i++)
66 user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick.c_str(), c->name.c_str());
76 virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
78 return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
81 virtual ~ModuleBlockColour()
83 ServerInstance->Modes->DelMode(bc);
87 virtual Version GetVersion()
89 return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
93 MODULE_INIT(ModuleBlockColour)