]> 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 fd9fd4434ac96e632f3ddabf1f2f861a788ace8b..a9ea8c06e5bc750a53f2889ae5cd181fe218d175 100644 (file)
@@ -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;
                }
 
@@ -416,8 +415,6 @@ class ModuleIdent : public Module
         */
        virtual bool OnCheckReady(User *user)
        {
-               ServerInstance->Logs->Log("m_ident",DEBUG,"OnCheckReady %s", user->nick);
-
                /* Does user have an ident socket attached at all? */
                IdentRequestSocket *isock = NULL;
                if (!user->GetExt("ident_socket", isock))
@@ -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->Logs->Log("m_ident",DEBUG, "Removed ident socket from %s", user->nick);
                }
        }
 };