]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dnsbl.cpp
Add initial query support to m_mysql [patch by Athenon]
[user/henk/code/inspircd.git] / src / modules / m_dnsbl.cpp
index 9122486fc86fd2e8953420453d596ffffb60c5a9..f70496d687546221144edf4adec15c7c5a721bdd 100644 (file)
@@ -60,12 +60,8 @@ class DNSBLResolver : public Resolver
        }
 
        /* Note: This may be called multiple times for multiple A record results */
-       virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0)
+       virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
        {
-               /* for bitmask reply types, we arent interested in any but the first result (number 0) */
-               if ((ConfEntry->type == DNSBLConfEntry::A_BITMASK) && (resultnum))
-                       return;
-
                /* Check the user still exists */
                if ((them) && (them == ServerInstance->SE->GetRef(theirfd)))
                {
@@ -259,7 +255,7 @@ class ModuleDNSBL : public Module
                        }
 
                        e->banaction = str2banaction(MyConf->ReadValue("dnsbl", "action", i));
-                       e->duration = ServerInstance->Duration(MyConf->ReadValue("dnsbl", "duration", i));
+                       e->duration = ServerInstance->Duration(MyConf->ReadValue("dnsbl", "duration", "60", i));
 
                        /* Use portparser for record replies */
 
@@ -280,6 +276,10 @@ class ModuleDNSBL : public Module
                        {
                                ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(#%d): Invalid banaction", i);
                        }
+                       else if (e->duration <= 0)
+                       {
+                               ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(#%d): Invalid duration", i);
+                       }
                        else
                        {
                                if (e->reason.empty())
@@ -300,12 +300,12 @@ class ModuleDNSBL : public Module
                delete MyConf;
        }
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                ReadConf();
        }
 
-       virtual int OnUserRegister(User* user)
+       virtual ModResult OnUserRegister(User* user)
        {
                /* only do lookups on local users */
                if (IS_LOCAL(user))
@@ -320,7 +320,7 @@ class ModuleDNSBL : public Module
                        success = inet_aton(user->GetIPString(), &in);
 
                        if (!success)
-                               return 0;
+                               return MOD_RES_PASSTHRU;
 
                        d = (unsigned char) (in.s_addr >> 24) & 0xFF;
                        c = (unsigned char) (in.s_addr >> 16) & 0xFF;
@@ -344,13 +344,13 @@ class ModuleDNSBL : public Module
                }
 
                /* don't do anything with this hot potato */
-               return 0;
+               return MOD_RES_PASSTHRU;
        }
 
-       virtual int OnStats(char symbol, User* user, string_list &results)
+       virtual ModResult OnStats(char symbol, User* user, string_list &results)
        {
                if (symbol != 'd')
-                       return 0;
+                       return MOD_RES_PASSTHRU;
 
                unsigned long total_hits = 0, total_misses = 0;
 
@@ -366,7 +366,7 @@ class ModuleDNSBL : public Module
                results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total hits: " + ConvToStr(total_hits));
                results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total misses: " + ConvToStr(total_misses));
 
-               return 0;
+               return MOD_RES_PASSTHRU;
        }
 };