virtual int ProcessMessages(userrec* user,chanrec* chan,std::string &text) { if (!IS_LOCAL(user) || CHANOPS_EXEMPT(ServerInstance, 'g') && chan->GetStatus(user) == STATUS_OP) return 0; // Create a copy of the string in irc::string irc::string line = text.c_str(); modelist* list; chan->GetExt(cf->GetInfoKey(), list); if (list) { for (modelist::iterator i = list->begin(); i != list->end(); i++) { if (line.find(i->mask.c_str()) != std::string::npos) { user->WriteServ("936 %s %s %s :Your message contained a censored word, and was blocked",user->nick, chan->name, i->mask.c_str()); return 1; } } } return 0; }
void init() { ServerInstance->Modules->AddService(cf); cf.DoImplements(this); Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); }
virtual void OnRehash(userrec* user, const std::string ¶meter) { cf->DoRehash(); }
virtual void OnChannelDelete(chanrec* chan) { cf->DoChannelDelete(chan); }
void Implements(char* List) { cf->DoImplements(List); List[I_OnCleanup] = List[I_OnChannelDelete] = List[I_OnRehash] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnSyncChannel] = 1; }
virtual void OnSyncChannel(chanrec* chan, Module* proto, void* opaque) { cf->DoSyncChannel(chan, proto, opaque); }
virtual void OnCleanup(int target_type, void* item) { cf->DoCleanup(target_type, item); }
virtual void OnRehash(User* user) { hidemask = ServerInstance->Config->ConfValue("chanfilter")->getBool("hidemask"); cf.DoRehash(); }
virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque) { cf.DoSyncChannel(chan, proto, opaque); }