]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ident.cpp
Add extra parameter to OnUserPreNotice and OnUserPrePrivmsg, CUList &exempt_list...
[user/henk/code/inspircd.git] / src / modules / m_ident.cpp
index 53c13260fa295559e3f71341c258d8ef314b8ca2..dc59adcead13a766a2cb569211724650806b69ca 100644 (file)
@@ -27,6 +27,8 @@ using namespace std;
 
 // Version 1.5.0.0 - Updated to use InspSocket, faster and neater.
 
+/** Handles RFC1413 ident connections to users
+ */
 class RFC1413 : public InspSocket
 {
  protected:
@@ -52,8 +54,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);
                }
        }
 
@@ -202,7 +208,7 @@ class ModuleIdent : public Module
                ReadSettings();
        }
 
-       virtual void OnUserRegister(userrec* user)
+       virtual int OnUserRegister(userrec* user)
        {
                /*
                 * when the new user connects, before they authenticate with USER/NICK/PASS, we do
@@ -217,7 +223,15 @@ class ModuleIdent : public Module
                        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;
+               }
+               return 0;
        }
 
        virtual bool OnCheckReady(userrec* user)
@@ -244,6 +258,8 @@ class ModuleIdent : public Module
                                // a user which has now vanished! To prevent this, set ident::u
                                // to NULL and check it so that we dont write users who have gone away.
                                ident->u = NULL;
+                               ServerInstance->SE->DelFd(ident);
+                               delete ident;
                        }
                }
        }
@@ -262,6 +278,8 @@ class ModuleIdent : public Module
                if (user->GetExt("ident_data", ident))
                {
                        ident->u = NULL;
+                       ServerInstance->SE->DelFd(ident);
+                       delete ident;
                }
        }
        
@@ -271,7 +289,7 @@ class ModuleIdent : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,5,0,0,VF_VENDOR,API_VERSION);
+               return Version(1,1,0,0,VF_VENDOR,API_VERSION);
        }
        
 };