- text = text + " ";
- for (int index = 0; index < MyConf->Enumerate("keyword"); index++)
- {
- std::string pattern = MyConf->ReadValue("keyword","pattern",index);
- if (Srv->MatchText(text,pattern))
- {
- std::string target = "";
- std::string reason = MyConf->ReadValue("keyword","reason",index);
- if (target_type == TYPE_USER)
- {
- userrec* t = (userrec*)dest;
- target = std::string(t->nick);
- }
- else if (target_type == TYPE_CHANNEL)
- {
- chanrec* t = (chanrec*)dest;
- target = std::string(t->name);
- }
- Srv->SendOpers(std::string("FILTER: ")+std::string(user->nick)+
- std::string(" had their message filtered, target was ")+
- target+": "+reason);
- Srv->Log(DEFAULT,std::string("FILTER: ")+std::string(user->nick)+
- std::string(" had their message filtered, target was ")+
- target+": "+reason);
- // this form of SendTo (with the source as NuLL) sends a server notice
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+
- " :Your message has been filtered and opers notified: "+reason);
- return 1;
- }
- }
- return 0;