- 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);
- std::string action = MyConf->ReadValue("keyword","action",index);
- std::string operaction = MyConf->ReadValue("keyword","operaction",index);
- std::string do_action = "none";
-
- if (action == "")
- action = "none";
- if (operaction == "")
- operaction = "none";
- 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);
- }
- if (strchr(user->modes,'o'))
- {
- do_action = operaction;
- }
- else
- {
- do_action = action;
- }
- if (do_action == "block")
- {
- Srv->SendOpers(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);
- }
-
- Srv->Log(DEFAULT,std::string("FILTER: ")+std::string(user->nick)+
- std::string(" had their message filtered, target was ")+
- target+": "+reason);
-
- if (do_action == "kill")
- {
- Srv->QuitUser(user,reason);
- }
- return 1;
- }
- }
- return 0;