]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_ident: Add an option to allow idents of users to still be prefixed with a '~' for...
authorRobby- <robby@chat.be>
Wed, 13 Nov 2013 20:01:24 +0000 (21:01 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Wed, 28 May 2014 11:39:23 +0000 (13:39 +0200)
Fixes #683.

Some changes by @attilamolnar, original PR #684

docs/conf/modules.conf.example
src/modules/m_ident.cpp

index 851c69f12f1be2d32604cdba88b3595cdd4ae140..b759f8d5dab784fca1fae44b84e6ad6bc1a3f79f 100644 (file)
 # the user in a 'connecting' state until the lookup is complete.      #
 # The bind value indicates which IP to bind outbound requests to.     #
 #
-#<ident timeout="5">
+#<ident timeout="5" nolookupprefix="no">
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # Invite exception module: Adds support for channel invite exceptions
index 1e01806b8da2918e430d1aa05f4d579871df7fee..ae21c6940a4cf2d7a89230a6235d0fd3a43d65b8 100644 (file)
@@ -268,6 +268,7 @@ class IdentRequestSocket : public EventHandler
 class ModuleIdent : public Module
 {
        int RequestTimeout;
+       bool NoLookupPrefix;
        SimpleExtItem<IdentRequestSocket, stdalgo::culldeleter> ext;
  public:
        ModuleIdent() : ext("ident_socket", this)
@@ -281,9 +282,11 @@ class ModuleIdent : public Module
 
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
-               RequestTimeout = ServerInstance->Config->ConfValue("ident")->getInt("timeout", 5);
+               ConfigTag* tag = ServerInstance->Config->ConfValue("ident");
+               RequestTimeout = tag->getInt("timeout", 5);
                if (!RequestTimeout)
                        RequestTimeout = 5;
+               NoLookupPrefix = tag->getBool("nolookupprefix", false);
        }
 
        void OnUserInit(LocalUser *user) CXX11_OVERRIDE
@@ -314,7 +317,11 @@ class ModuleIdent : public Module
                /* Does user have an ident socket attached at all? */
                IdentRequestSocket *isock = ext.get(user);
                if (!isock)
+               {
+                       if ((NoLookupPrefix) && (user->ident[0] != '~'))
+                               user->ident.insert(user->ident.begin(), 1, '~');
                        return MOD_RES_PASSTHRU;
+               }
 
                time_t compare = isock->age;
                compare += RequestTimeout;