]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Provide an optional param translate4in6 to User::GetIPString() and default it to...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 10 Apr 2008 23:35:35 +0000 (23:35 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 10 Apr 2008 23:35:35 +0000 (23:35 +0000)
Certain parts such as dns lookup need to set this to false to determine wether to use ipv4 or ipv6 reverse lookup.

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9454 e03df62e-2008-0410-955e-edbf42e46eb7

src/users.cpp

index 43bf64f1c3a95ab75f275cdcbe28d8179022dfba..cdacdc5c2ab52f126e59a093306e7f3bf8071310 100644 (file)
@@ -98,7 +98,7 @@ void User::StartDNSLookup()
        try
        {
                bool cached;
-               const char* sip = this->GetIPString();
+               const char* sip = this->GetIPString(false);
 
                /* Special case for 4in6 (Have i mentioned i HATE 4in6?) */
                if (!strncmp(sip, "0::ffff:", 8))
@@ -1072,7 +1072,7 @@ int User::GetProtocolFamily()
  * XXX the duplication here is horrid..
  * do we really need two methods doing essentially the same thing?
  */
-const char* User::GetIPString()
+const char* User::GetIPString(bool translate4in6)
 {
        static char buf[1024];
 
@@ -1096,6 +1096,12 @@ const char* User::GetIPString()
                        {
                                strlcpy(&temp[1], buf, sizeof(temp) - 1);
                                *temp = '0';
+                               if (translate4in6 && !strncmp(temp, "0::ffff:", 8))
+                               {
+                                       this->cachedip = temp + 8;
+                                       return temp + 8;
+                               }
+
                                this->cachedip = temp;
                                return temp;
                        }