]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ident.cpp
Fix these too
[user/henk/code/inspircd.git] / src / modules / m_ident.cpp
index 185b9cf6d747c98d2149ee691cfc8b88eab4fa4a..a9ea8c06e5bc750a53f2889ae5cd181fe218d175 100644 (file)
@@ -180,7 +180,7 @@ class IdentRequestSocket : public EventHandler
 
        virtual void OnConnected()
        {
-               ServerInstance->Log(DEBUG,"OnConnected()");
+               ServerInstance->Logs->Log("m_ident",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
@@ -230,7 +230,7 @@ class IdentRequestSocket : public EventHandler
                        break;
                        case EVENT_ERROR:
                                /* fd error event, ohshi- */
-                               ServerInstance->Log(DEBUG,"EVENT_ERROR");
+                               ServerInstance->Logs->Log("m_ident",DEBUG,"EVENT_ERROR");
                                /* We *must* Close() here immediately or we get a
                                 * huge storm of EVENT_ERROR events!
                                 */
@@ -247,7 +247,7 @@ class IdentRequestSocket : public EventHandler
                 */
                if (GetFd() > -1)
                {
-                       ServerInstance->Log(DEBUG,"Close ident socket %d", GetFd());
+                       ServerInstance->Logs->Log("m_ident",DEBUG,"Close ident socket %d", GetFd());
                        ServerInstance->SE->DelFd(this);
                        ServerInstance->SE->Close(GetFd());
                        ServerInstance->SE->Shutdown(GetFd(), SHUT_WR);
@@ -286,7 +286,7 @@ class IdentRequestSocket : public EventHandler
                        return;
                }
 
-               ServerInstance->Log(DEBUG,"ReadResponse()");
+               ServerInstance->Logs->Log("m_ident",DEBUG,"ReadResponse()");
 
                irc::sepstream sep(ibuf, ':');
                std::string token;
@@ -350,7 +350,7 @@ class ModuleIdent : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1, 1, 1, 0, VF_VENDOR, API_VERSION);
+               return Version(1, 2, 1, 0, VF_VENDOR, API_VERSION);
        }
        
        
@@ -367,10 +367,9 @@ class ModuleIdent : public Module
        {
                /* User::ident is currently the username field from USER; with m_ident loaded, that
                 * should be preceded by a ~. The field is actually IDENTMAX+2 characters wide. */
-               memmove(user->ident + 1, user->ident, IDENTMAX);
-               user->ident[0] = '~';
-               /* Ensure that it is null terminated */
-               user->ident[IDENTMAX + 1] = '\0';
+               if (user->ident.length() > IDENTMAX + 1)
+                       user->ident.assign(user->ident, 0, IDENTMAX);
+               user->ident.insert('~', 0);
 
                user->WriteServ("NOTICE Auth :*** Looking up your ident...");
 
@@ -384,7 +383,7 @@ class ModuleIdent : public Module
 
                if (getsockname(user->GetFd(), (sockaddr*) &laddr, &laddrsz) != 0)
                {
-                       user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident);
+                       user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident.c_str());
                        return 0;
                }
 
@@ -402,7 +401,7 @@ class ModuleIdent : public Module
                }
                catch (ModuleException &e)
                {
-                       ServerInstance->Log(DEBUG,"Ident exception: %s", e.GetReason());
+                       ServerInstance->Logs->Log("m_ident",DEBUG,"Ident exception: %s", e.GetReason());
                        return 0;
                }
 
@@ -416,17 +415,15 @@ class ModuleIdent : public Module
         */
        virtual bool OnCheckReady(User *user)
        {
-               ServerInstance->Log(DEBUG,"OnCheckReady %s", user->nick);
-
                /* Does user have an ident socket attached at all? */
                IdentRequestSocket *isock = NULL;
                if (!user->GetExt("ident_socket", isock))
                {
-                       ServerInstance->Log(DEBUG, "No ident socket :(");
+                       ServerInstance->Logs->Log("m_ident",DEBUG, "No ident socket :(");
                        return true;
                }
 
-               ServerInstance->Log(DEBUG, "Has ident_socket");
+               ServerInstance->Logs->Log("m_ident",DEBUG, "Has ident_socket");
 
                time_t compare = isock->age;
                compare += RequestTimeout;
@@ -436,7 +433,7 @@ class ModuleIdent : public Module
                {
                        /* Ident timeout */
                        user->WriteServ("NOTICE Auth :*** Ident request timed out.");
-                       ServerInstance->Log(DEBUG, "Timeout");
+                       ServerInstance->Logs->Log("m_ident",DEBUG, "Timeout");
                        /* The user isnt actually disconnecting,
                         * we call this to clean up the user
                         */
@@ -447,11 +444,11 @@ class ModuleIdent : public Module
                /* Got a result yet? */
                if (!isock->HasResult())
                {
-                       ServerInstance->Log(DEBUG, "No result yet");
+                       ServerInstance->Logs->Log("m_ident",DEBUG, "No result yet");
                        return false;
                }
 
-               ServerInstance->Log(DEBUG, "Yay, result!");
+               ServerInstance->Logs->Log("m_ident",DEBUG, "Yay, result!");
 
                /* wooo, got a result (it will be good, or bad) */
                if (*(isock->GetResult()) != '~')
@@ -460,7 +457,7 @@ class ModuleIdent : public Module
                        user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", isock->GetResult());
 
                /* Copy the ident string to the user */
-               strlcpy(user->ident, isock->GetResult(), IDENTMAX+1);
+               user->ident.assign(isock->GetResult(), 0, IDENTMAX+1);
 
                /* The user isnt actually disconnecting, we call this to clean up the user */
                OnUserDisconnect(user);
@@ -483,7 +480,6 @@ class ModuleIdent : public Module
                        isock->Close();
                        delete isock;
                        user->Shrink("ident_socket");
-                       ServerInstance->Log(DEBUG, "Removed ident socket from %s", user->nick);
                }
        }
 };