]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cgiirc.cpp
Remove unneeded headers from spanningtree. This was done to the rest of the source...
[user/henk/code/inspircd.git] / src / modules / m_cgiirc.cpp
index 290f55d22df63cbf0203e76e1abc4a09acf500f9..49a6fdabb454a1229083354dd2b2024278b6f820 100644 (file)
@@ -12,9 +12,7 @@
  */
 
 #include "inspircd.h"
-#include "users.h"
-#include "modules.h"
-#include "dns.h"
+
 #ifndef WINDOWS
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -23,7 +21,7 @@
 
 /* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */
 
-enum CGItype { PASS, IDENT, PASSFIRST, IDENTFIRST, WEBIRC };
+enum CGItype { INVALID, PASS, IDENT, PASSFIRST, IDENTFIRST, WEBIRC };
 
 
 /** Holds a CGI site's details
@@ -91,8 +89,11 @@ class CGIResolver : public Resolver
        CGIResolver(Module* me, InspIRCd* ServerInstance, bool NotifyOpers, const std::string &source, bool forward, userrec* u, int userfd, const std::string &type, bool &cached)
                : Resolver(ServerInstance, source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { }
 
-       virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
+       virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0)
        {
+               if (resultnum)
+                       return;
+
                /* Check the user still exists */
                if ((them) && (them == ServerInstance->SE->GetRef(theirfd)))
                {
@@ -162,19 +163,26 @@ public:
                        
                        if(hostmask.length())
                        {
-                               if(type == "webirc" && !password.length()) {
+                               if (type == "webirc" && !password.length()) {
                                                ServerInstance->Log(DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str());
-                               } else {
-                                       CGItype cgitype;
-                                       if(type == "pass")
+                               }
+                               else
+                               {
+                                       CGItype cgitype = INVALID;
+                                       if (type == "pass")
                                                cgitype = PASS;
-                                       else if(type == "ident")
+                                       else if (type == "ident")
                                                cgitype = IDENT;
-                                       else if(type == "passfirst")
+                                       else if (type == "passfirst")
                                                cgitype = PASSFIRST;
-                                       else if(type == "webirc") {
+                                       else if (type == "webirc")
+                                       {
                                                cgitype = WEBIRC;
                                        }
+
+                                       if (cgitype == INVALID)
+                                               cgitype = PASS;
+
                                        Hosts.push_back(CGIhost(hostmask,cgitype, password.length() ? password : "" ));
                                }
                        }