7 /* $ModDesc: Provides support for unreal-style channel mode +c */
9 class ModuleBlockColor : public Module
17 Srv->AddExtendedMode('c',MT_CHANNEL,false,0,0);
20 virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string text)
22 if (target_type == TYPE_CHANNEL)
24 chanrec* c = (chanrec*)dest;
26 snprintf(ctext,MAXBUF,"%s",text.c_str());
27 if (c->IsCustomModeSet('c'))
29 if ((strchr(ctext,'\2')) || (strchr(ctext,'\3')) || (strchr(ctext,31)))
31 WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name);
39 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
41 if (target_type == TYPE_CHANNEL)
43 chanrec* c = (chanrec*)dest;
45 snprintf(ctext,MAXBUF,"%s",text.c_str());
46 if (c->IsCustomModeSet('c'))
48 if ((strchr(ctext,'\2')) || (strchr(ctext,'\3')) || (strchr(ctext,31)))
50 WriteServ(user->fd,"404 %s %s :Can't send colors to channel (+c set)",user->nick, c->name);
58 virtual ~ModuleBlockColor()
63 virtual Version GetVersion()
65 return Version(1,0,0,0);
70 class ModuleBlockColorFactory : public ModuleFactory
73 ModuleBlockColorFactory()
77 ~ModuleBlockColorFactory()
81 virtual Module * CreateModule()
83 return new ModuleBlockColor;
89 extern "C" void * init_module( void )
91 return new ModuleBlockColorFactory;