1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
22 /* $ModDesc: Provides support for unreal-style channel mode +c */
24 class ModuleBlockColor : public Module
32 Srv->AddExtendedMode('c',MT_CHANNEL,false,0,0);
35 virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text)
37 if (target_type == TYPE_CHANNEL)
39 chanrec* c = (chanrec*)dest;
41 snprintf(ctext,MAXBUF,"%s",text.c_str());
42 if (c->IsCustomModeSet('c'))
44 if ((strchr(ctext,'\2')) || (strchr(ctext,'\3')) || (strchr(ctext,31)))
46 WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name);
54 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
56 if (target_type == TYPE_CHANNEL)
58 chanrec* c = (chanrec*)dest;
60 snprintf(ctext,MAXBUF,"%s",text.c_str());
61 if (c->IsCustomModeSet('c'))
63 if ((strchr(ctext,'\2')) || (strchr(ctext,'\3')) || (strchr(ctext,31)))
65 WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name);
73 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
75 // check if this is our mode character...
76 if ((modechar == 'c') && (type == MT_CHANNEL))
86 virtual ~ModuleBlockColor()
91 virtual Version GetVersion()
93 return Version(1,0,0,0);
98 class ModuleBlockColorFactory : public ModuleFactory
101 ModuleBlockColorFactory()
105 ~ModuleBlockColorFactory()
109 virtual Module * CreateModule()
111 return new ModuleBlockColor;
117 extern "C" void * init_module( void )
119 return new ModuleBlockColorFactory;