- virtual int ProcessMessages(userrec* user,chanrec* chan,std::string &text)
- {
- char buffer[MAXBUF];
- strlcpy(buffer,text.c_str(),MAXBUF);
- for (unsigned int j = 0; j < strlen(buffer); j++)
- buffer[j] = tolower(buffer[j]);
- SpamList* spamlist = (SpamList*)chan->GetExt("spam_list");
- if (spamlist)
- {
- for (SpamList::iterator i = spamlist->begin(); i != spamlist->end(); i++)
- {
- if (strstr(text.c_str(),i->c_str()))
- {
- WriteServ(user->fd,"936 %s %s :Your message contained a censored word, and was blocked",user->nick, chan->name);
- return 1;
- }
- }
- }
- return 0;
+class ModuleChanFilter : public Module
+{
+
+ ChanFilter* cf;
+
+ public:
+
+ ModuleChanFilter(InspIRCd* Me)
+ : Module(Me)
+ {
+ cf = new ChanFilter(ServerInstance);
+ if (!ServerInstance->Modes->AddMode(cf))
+ throw ModuleException("Could not add new modes!");
+
+ cf->DoImplements(this);
+ Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel };
+ ServerInstance->Modules->Attach(eventlist, this, 6);