]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ident.cpp
We were already sending FMODE +nt after each channel creation to keep services happy...
[user/henk/code/inspircd.git] / src / modules / m_ident.cpp
index a0f590f9572f12ee92a2ae6fe8d28ee695334a30..3f3399d3c604682b7eacda235b828706701b5b08 100644 (file)
  * ---------------------------------------------------
  */
 
-#include <stdio.h>
-#include <string>
+#include "inspircd.h"
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
-#include "inspircd.h"
 
 /* $ModDesc: Provides support for RFC 1413 ident lookups */
 
@@ -79,6 +77,7 @@ class RFC1413 : public InspSocket
                                                                {
                                                                        if (this->Instance->IsIdent(section))
                                                                        {
+                                                                               u->Extend("IDENT", new std::string(std::string(section) + "," + std::string(u->ident)));
                                                                                strlcpy(u->ident,section,IDENTMAX);
                                                                                u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
                                                                        }
@@ -204,7 +203,7 @@ class ModuleIdent : public Module
        }
 
        ModuleIdent(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
 
                ReadSettings();
@@ -215,6 +214,17 @@ class ModuleIdent : public Module
                List[I_OnCleanup] = List[I_OnRehash] = List[I_OnUserRegister] = List[I_OnCheckReady] = List[I_OnUserDisconnect] = 1;
        }
 
+       void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable)
+       {
+               if ((displayable) && (extname == "IDENT"))
+               {
+                       std::string* ident;
+                       if (GetExt("IDENT", ident))
+                               proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, *ident);
+               }
+       }
+
+
        virtual void OnRehash(userrec* user, const std::string &parameter)
        {
                ReadSettings();
@@ -265,6 +275,7 @@ class ModuleIdent : public Module
                {
                        userrec* user = (userrec*)item;
                        RFC1413* ident;
+                       std::string* identstr;
                        if (user->GetExt("ident_data", ident))
                        {
                                // FIX: If the user record is deleted, the socket wont be removed
@@ -275,6 +286,10 @@ class ModuleIdent : public Module
                                ServerInstance->SE->DelFd(ident);
                                //delete ident;
                        }
+                       if (user->GetExt("IDENT", identstr))
+                       {
+                               delete identstr;
+                       }
                }
        }
 
@@ -289,11 +304,16 @@ class ModuleIdent : public Module
                 * and this would leave at least one of the invalid ;)
                 */
                RFC1413* ident;
+               std::string* identstr;
                if (user->GetExt("ident_data", ident))
                {
                        ident->u = NULL;
                        ServerInstance->SE->DelFd(ident);
                }
+               if (user->GetExt("IDENT", identstr))
+               {
+                       delete identstr;
+               }
        }
 
        virtual ~ModuleIdent()
@@ -327,7 +347,7 @@ class ModuleIdentFactory : public ModuleFactory
 };
 
 
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
 {
        return new ModuleIdentFactory;
 }