]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_proxyscan.cpp
fixed some indentation and spacing in modules
[user/henk/code/inspircd.git] / src / modules / m_proxyscan.cpp
index 916a8d89199921eb58ef057023a3e9c5d9af63cf..5e302ea8054ee04fa245e3a904b422822bcd89f1 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -31,7 +31,7 @@
 
 /*
  * A few things to note:
- * 
+ *
  *   O  The only place that may *delete* an active or inactive
  *      ident socket is OnUserDisconnect in the module class.
  *      Because this is out of scope of the socket class there is
@@ -40,7 +40,7 @@
  *
  *   O  Closure of the ident socket with the Close() method will
  *      not cause removal of the socket from memory or detatchment
- *      from its 'parent' User class. It will only flag it as an 
+ *      from its 'parent' User class. It will only flag it as an
  *      inactive socket in the socket engine.
  *
  *   O  Timeouts are handled in OnCheckReaady at the same time as
@@ -76,12 +76,12 @@ class ProxySocket : public EventHandler
        int rlen;
        bool done;
  public:
-       ProxySocket(InspIRCd *Server, User* u, const std::string &bindip, int port, char *cstr, int clen, char *rstr, int rlen)
+       ProxySocket(InspIRCd *Server, User* u, const std::string &bindip, int port, const char *cstr, int mclen, const char *rstr, int mrlen)
        {
                user = u;
                ServerInstance = Server;
-               this->clen = clen;
-               this->rlen = rlen;
+               this->clen = mclen;
+               this->rlen = mrlen;
 
                int i;
 
@@ -95,7 +95,7 @@ class ProxySocket : public EventHandler
                {
                        this->response[i] = rstr[i];
                }
-               
+
                socklen_t size = 0;
 #ifdef IPV6
                /* Does this look like a v6 ip address? */
@@ -115,7 +115,7 @@ class ProxySocket : public EventHandler
                /* We allocate two of these because sizeof(sockaddr_in6) > sizeof(sockaddr_in) */
                sockaddr* s = new sockaddr[2];
                sockaddr* addr = new sockaddr[2];
-       
+
 #ifdef IPV6
                /* Horrid icky nasty ugly berkely socket crap. */
                if (v6)
@@ -189,7 +189,7 @@ class ProxySocket : public EventHandler
 
        virtual void OnConnected()
        {
-               ServerInstance->Log(DEBUG,"OnConnected()");
+               ServerInstance->Logs->Log("m_proxyscan",DEBUG,"OnConnected()");
 
                /* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the
                 * only members we use are in a part of the struct that should always be identical (at the
@@ -212,10 +212,10 @@ class ProxySocket : public EventHandler
                /* Send failed if we didnt write the whole ident request --
                 * might as well give up if this happens!
                 */
-               ServerInstance->Log(DEBUG, "Sending");
+               ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Sending");
                if (ServerInstance->SE->Send(this, this->challenge, this->clen, 0) < this->clen)
                {
-                       ServerInstance->Log(DEBUG, "Send incomplete");
+                       ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Send incomplete");
                        done = true;
                }
        }
@@ -234,7 +234,7 @@ class ProxySocket : public EventHandler
                        break;
                        case EVENT_ERROR:
                                /* fd error event, ohshi- */
-                               ServerInstance->Log(DEBUG,"EVENT_ERROR");
+                               ServerInstance->Logs->Log("m_proxyscan",DEBUG,"EVENT_ERROR");
                                /* We *must* Close() here immediately or we get a
                                 * huge storm of EVENT_ERROR events!
                                 */
@@ -251,7 +251,7 @@ class ProxySocket : public EventHandler
                 */
                if (GetFd() > -1)
                {
-                       ServerInstance->Log(DEBUG,"Close ident socket %d", GetFd());
+                       ServerInstance->Logs->Log("m_proxyscan",DEBUG,"Close ident socket %d", GetFd());
                        ServerInstance->SE->DelFd(this);
                        ServerInstance->SE->Close(GetFd());
                        ServerInstance->SE->Shutdown(GetFd(), SHUT_WR);
@@ -272,7 +272,7 @@ class ProxySocket : public EventHandler
                char ibuf[MAXBUF];
                int recvresult = ServerInstance->SE->Recv(this, ibuf, MAXBUF-1, 0);
 
-               ServerInstance->Log(DEBUG,"ReadResponse(): %s -- %d", ibuf, recvresult);
+               ServerInstance->Logs->Log("m_proxyscan",DEBUG,"ReadResponse(): %s -- %d", ibuf, recvresult);
 
                bool match = true;
                int i;
@@ -281,7 +281,7 @@ class ProxySocket : public EventHandler
                {
                        if (this->response[i] != ibuf[i])
                        {
-                               ServerInstance->Log(DEBUG, "No match at pos %d: %c ne %c", i, this->response[i], ibuf[i]);
+                               ServerInstance->Logs->Log("m_proxyscan",DEBUG, "No match at pos %d: %c ne %c", i, this->response[i], ibuf[i]);
                                /* no match */
                                match = false;
                        }
@@ -289,7 +289,7 @@ class ProxySocket : public EventHandler
 
                if (match == true)
                {
-                       User::QuitUser(ServerInstance, this->user, "Open proxy detected.");
+                       ServerInstance->Users->QuitUser(this->user, "Open proxy detected.");
                }
 
                /* Close (but dont delete from memory) our socket
@@ -313,26 +313,22 @@ class ModuleProxy : public Module
                Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCleanup, I_OnUserDisconnect };
                ServerInstance->Modules->Attach(eventlist, this, 4);
        }
-       
+
        virtual Version GetVersion()
        {
-               return Version(1, 1, 1, 0, VF_VENDOR, API_VERSION);
-       }
-       
-       virtual void Implements(char *List)
-       {
-               List[I_OnRehash] = List[I_OnUserRegister] = List[I_OnCleanup] = List[I_OnUserDisconnect] = 1;
+               return Version(1, 2, 1, 0, VF_VENDOR, API_VERSION);
        }
-       
+
+
        virtual void OnRehash(User *user, const std::string &param)
        {
                ConfigReader MyConf(ServerInstance);
-               
+
                RequestTimeout = MyConf.ReadInteger("ident", "timeout", 0, true);
                if (!RequestTimeout)
                        RequestTimeout = 5;
        }
-       
+
        virtual int OnUserRegister(User *user)
        {
                user->WriteServ("NOTICE Auth :*** Checking you for proxies...");
@@ -364,7 +360,7 @@ class ModuleProxy : public Module
                }
                catch (ModuleException &e)
                {
-                       ServerInstance->Log(DEBUG,"Proxy exception: %s", e.GetReason());
+                       ServerInstance->Logs->Log("m_proxyscan",DEBUG,"Proxy exception: %s", e.GetReason());
                        return 0;
                }
 
@@ -388,7 +384,7 @@ class ModuleProxy : public Module
                        p->Close();
                        delete p;
                        user->Shrink("proxy_socket");
-                       ServerInstance->Log(DEBUG, "Removed proxy socket from %s", user->nick);
+                       ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Removed proxy socket from %s", user->nick.c_str());
                }
        }
 };