]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dccallow.cpp
cgiirc: Pass hosts to WEBIRC command on rehash. No fucking wonder this never worked...
[user/henk/code/inspircd.git] / src / modules / m_dccallow.cpp
index 22df5aa7ed2f05de80077a96c7e198af14889739..56345932c56c0d3e92bd43b91a4cb3b0ad2a3815 100644 (file)
@@ -259,10 +259,11 @@ class ModuleDCCAllow : public Module
        }
 
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                delete Conf;
                Conf = new ConfigReader(ServerInstance);
+               ReadFileConf();
        }
 
        virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
@@ -340,23 +341,26 @@ class ModuleDCCAllow : public Module
                                                std::string defaultaction = Conf->ReadValue("dccallow", "action", 0);
                                                std::string filename = tokens[2];
 
-                                               if (defaultaction == "allow")
-                                                       return 0;
-
+                                               bool found = false;
                                                for (unsigned int i = 0; i < bfl.size(); i++)
                                                {
                                                        if (InspIRCd::Match(filename, bfl[i].filemask, ascii_case_insensitive_map))
                                                        {
+                                                               /* We have a matching badfile entry, override whatever the default action is */
                                                                if (bfl[i].action == "allow")
                                                                        return 0;
-                                                       }
-                                                       else
-                                                       {
-                                                               if (defaultaction == "allow")
-                                                                       return 0;
+                                                               else
+                                                               {
+                                                                       found = true;
+                                                                       break;
+                                                               }
                                                        }
                                                }
 
+                                               /* only follow the default action if no badfile matches were found above */
+                                               if ((!found) && (defaultaction == "allow"))
+                                                       return 0;
+
                                                user->WriteServ("NOTICE %s :The user %s is not accepting DCC SENDs from you. Your file %s was not sent.", user->nick.c_str(), u->nick.c_str(), filename.c_str());
                                                u->WriteServ("NOTICE %s :%s (%s@%s) attempted to send you a file named %s, which was blocked.", u->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), filename.c_str());
                                                u->WriteServ("NOTICE %s :If you trust %s and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system.", u->nick.c_str(), user->nick.c_str());