]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ident.cpp
Tidy up strlens which are not required
[user/henk/code/inspircd.git] / src / modules / m_ident.cpp
index 669e9edbeb6f6f568d35d67d0e6ddf757f0c52a3..040e856d4d710542fcc6e98c43d836da8e7e7cbf 100644 (file)
@@ -52,8 +52,12 @@ class RFC1413 : public InspSocket
                // so we just display a notice, and tidy off the ident_data.
                if (u && (Instance->SE->GetRef(ufd) == u))
                {
+                       char newident[MAXBUF];
                        u->Shrink("ident_data");
-                       u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Could not find your ident, using "+std::string(u->ident)+" instead.");
+                       u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Could not find your ident, using ~"+std::string(u->ident)+" instead.");
+                       strcpy(newident,"~");
+                       strlcat(newident,u->ident,IDENTMAX);
+                       strlcpy(u->ident,newident,IDENTMAX);
                }
        }
 
@@ -212,7 +216,19 @@ class ModuleIdent : public Module
                 */
                user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Looking up your ident...");
                RFC1413* ident = new RFC1413(ServerInstance, user, IdentTimeout);
-               user->Extend("ident_data", (char*)ident);
+               if ((ident->GetState() == I_CONNECTING) || (ident->GetState() == I_CONNECTED))
+               {
+                       user->Extend("ident_data", (char*)ident);
+               }
+               else
+               {
+                       char newident[MAXBUF];
+                       user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not find your ident, using ~"+std::string(user->ident)+" instead.");
+                       strcpy(newident,"~");
+                       strlcat(newident,user->ident,IDENTMAX);
+                       strlcpy(user->ident,newident,IDENTMAX);
+                       delete ident;
+               }
        }
 
        virtual bool OnCheckReady(userrec* user)
@@ -266,7 +282,7 @@ class ModuleIdent : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,5,0,0,VF_VENDOR);
+               return Version(1,5,0,0,VF_VENDOR,API_VERSION);
        }
        
 };