]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_filter.h
Remove some debug (im on a crusade to make debug mode useful, but at the same time...
[user/henk/code/inspircd.git] / src / modules / m_filter.h
index ec95431faf451b1c5b5c9ceebb241cb9041c6203..28259277617ff98afe13478582bb43aaba1541c8 100644 (file)
@@ -50,7 +50,7 @@ class FilterBase : public Module
        virtual void SendFilter(Module* proto, void* opaque, FilterResult* iter);
        virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration) = 0;
        virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
-       virtual void OnRehash(const std::string &parameter);
+       virtual void OnRehash(userrec* user, const std::string &parameter);
        virtual Version GetVersion();
        std::string EncodeFilter(FilterResult* filter);
        FilterResult DecodeFilter(const std::string &data);
@@ -221,12 +221,20 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters
        
                if (command == "QUIT")
                {
+                       /* QUIT with no reason: nothing to do */
+                       if (pcnt < 1)
+                               return 0;
+
                        checkline = parameters[0];
                        replacepoint = 0;
                        parting = false;
                }
                else if (command == "PART")
                {
+                       /* PART with no reason: nothing to do */
+                       if (pcnt < 2)
+                               return 0;
+
                        checkline = parameters[1];
                        replacepoint = 1;
                        parting = true;
@@ -254,7 +262,10 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters
                                params[item] = parameters[item];
                        params[replacepoint] = "Reason filtered";
 
-                       if (f->action == "block")
+                       /* We're blocking, OR theyre quitting and its a KILL action
+                        * (we cant kill someone whos already quitting, so filter them anyway)
+                        */
+                       if ((f->action == "block") || (((!parting) && (f->action == "kill"))))
                        {
                                c->Handle(params, pcnt, user);
                                return 1;
@@ -287,7 +298,7 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters
        return 0;
 }
 
-void FilterBase::OnRehash(const std::string &parameter)
+void FilterBase::OnRehash(userrec* user, const std::string &parameter)
 {
 }