summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-04 13:09:18 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-04 13:09:18 +0000
commit235a0a2035bda6dd214719107083266207f39883 (patch)
treeffb6b257f722b9b1e3532d3edaf933e0fdf8f372 /src/modules/extra
parent416cc382022d9c41670e7b53390a900ef0ec8c89 (diff)
Added "char status" parameter to OnUserPreNotice and OnUserPreMessage for NOTICE @#chan etc.
Tidied up craq++ in modules (copy and pasting OnUserPreNotice into OnUserPreMessage?! why not just call one from the other!) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3072 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_filter_pcre.cpp48
1 files changed, 3 insertions, 45 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index ca002f578..f6ec64d6c 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -94,54 +94,12 @@ class ModuleFilterPCRE : public Module
// format of a config entry is <keyword pattern="^regexp$" reason="Some reason here" action="kill/block">
- virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
+ virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status)
{
- for (unsigned int index = 0; index < filters.size(); index++)
- {
- if (pcre_exec(filters[index],NULL,text.c_str(),text.length(),0,0,NULL,0) > -1)
- {
- std::string target = "";
- std::string reason = MyConf->ReadValue("keyword","reason",index);
- std::string do_action = MyConf->ReadValue("keyword","action",index);
-
- if (do_action == "")
- do_action = "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 (do_action == "block")
- {
- Srv->SendOpers(std::string("FilterPCRE: ")+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+" Action: "+do_action);
-
- if (do_action == "kill")
- {
- Srv->QuitUser(user,reason);
- }
- return 1;
- }
- }
- return 0;
+ return OnUserPreNotice(user,dest,target_type,text,status);
}
- virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status)
{
for (unsigned int index = 0; index < filters.size(); index++)
{