]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ident.cpp
Move IsNick, IsIdent into class InspIRCd, update modules that use it.
[user/henk/code/inspircd.git] / src / modules / m_ident.cpp
index 4de84ea06e1ec22c3bea358032e5c484784a8ec4..32e87272a3ebf65b6074ff745c5c1b62dea7ec16 100644 (file)
@@ -23,6 +23,8 @@ using namespace std;
 #include "modules.h"
 #include "inspircd.h"
 
+extern InspIRCd* ServerInstance;
+
 extern userrec* fd_ref_table[MAX_DESCRIPTORS];
 
 /* $ModDesc: Provides support for RFC 1413 ident lookups */
@@ -43,9 +45,9 @@ class RFC1413 : public InspSocket
        userrec* u;              // user record that the lookup is associated with
        int ufd;
 
-       RFC1413(userrec* user, int maxtime, Server* S) : InspSocket(user->GetIPString(), 113, false, maxtime), Srv(S), u(user), ufd(user->fd)
+       RFC1413(InspIRCd* SI, userrec* user, int maxtime, Server* S) : InspSocket(SI, user->GetIPString(), 113, false, maxtime), Srv(S), u(user), ufd(user->fd)
        {
-               Srv->Log(DEBUG,"Ident: associated.");
+               log(DEBUG,"Ident: associated.");
        }
 
        virtual void OnTimeout()
@@ -85,9 +87,12 @@ class RFC1413 : public InspSocket
                                                        {
                                                                if (u && (fd_ref_table[ufd] == u))
                                                                {
-                                                                       strlcpy(u->ident,section,IDENTMAX);
-                                                                       Srv->Log(DEBUG,"IDENT SET: "+std::string(u->ident));
-                                                                       u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
+                                                                       if (ServerInstance->IsIdent(section))
+                                                                       {
+                                                                               strlcpy(u->ident,section,IDENTMAX);
+                                                                               log(DEBUG,"IDENT SET: "+std::string(u->ident));
+                                                                               u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
+                                                                       }
                                                                }
                                                        }
                                                        return false;
@@ -143,7 +148,7 @@ class RFC1413 : public InspSocket
                        themlen = sizeof(sock_them);
                        if ((getsockname(this->u->fd,(sockaddr*)&sock_us,&uslen) || getpeername(this->u->fd, (sockaddr*)&sock_them, &themlen)))
                        {
-                               Srv->Log(DEBUG,"Ident: failed to get socket names, bailing");
+                               log(DEBUG,"Ident: failed to get socket names, bailing");
                                return false;
                        }
                        else
@@ -155,7 +160,7 @@ class RFC1413 : public InspSocket
                                snprintf(ident_request,127,"%d,%d\r\n",ntohs(sock_them.sin_port),ntohs(sock_us.sin_port));
 #endif
                                this->Write(ident_request);
-                               Srv->Log(DEBUG,"Sent ident request, waiting for reply");
+                               log(DEBUG,"Sent ident request, waiting for reply");
                                return true;
                        }
                }
@@ -209,7 +214,7 @@ class ModuleIdent : public Module
                 * Server::AddSocket() call.
                 */
                user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Looking up your ident...");
-               RFC1413* ident = new RFC1413(user, IdentTimeout, Srv);
+               RFC1413* ident = new RFC1413(ServerInstance, user, IdentTimeout, Srv);
                if (ident->GetState() != I_ERROR)
                {
                        user->Extend("ident_data", (char*)ident);