]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove second overridden (fully duplicated :/) copy of GetIPString which copies into...
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 16 Oct 2007 10:29:01 +0000 (10:29 +0000)
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 16 Oct 2007 10:29:01 +0000 (10:29 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8218 e03df62e-2008-0410-955e-edbf42e46eb7

include/users.h
src/users.cpp

index 915a23c0d8967c0738885423928116ad418e392a..21214062c1b2e6d7bd63c4a4f44f185edc79108f 100644 (file)
@@ -659,12 +659,6 @@ class CoreExport User : public connection
         */
        const char* GetIPString();
 
-       /** Get IP string from sockaddr, using caller-specified buffer
-        * @param buf A buffer to use
-        * @return The IP string
-        */
-       const char* GetIPString(char* buf);
-
        /* Write error string
         */
        std::string WriteError;
index f487be6dc89ec62f6db41760c0e9c223fcf9061d..2fb73c48b6cc0c748289de4a63f1a8a7edbf2c09 100644 (file)
@@ -1139,6 +1139,10 @@ int User::GetProtocolFamily()
        return sin->sin_family;
 }
 
+/*
+ * XXX the duplication here is horrid..
+ * do we really need two methods doing essentially the same thing?
+ */
 const char* User::GetIPString()
 {
        static char buf[1024];
@@ -1179,48 +1183,6 @@ const char* User::GetIPString()
        return "";
 }
 
-const char* User::GetIPString(char* buf)
-{
-       if (this->ip == NULL)
-       {
-               *buf = 0;
-               return buf;
-       }
-
-       switch (this->GetProtocolFamily())
-       {
-#ifdef SUPPORT_IP6LINKS
-               case AF_INET6:
-               {
-                       static char temp[1024];
-
-                       sockaddr_in6* sin = (sockaddr_in6*)this->ip;
-                       inet_ntop(sin->sin6_family, &sin->sin6_addr, buf, sizeof(buf));
-                       /* IP addresses starting with a : on irc are a Bad Thing (tm) */
-                       if (*buf == ':')
-                       {
-                               strlcpy(&temp[1], buf, sizeof(temp) - 1);
-                               *temp = '0';
-                               strlcpy(buf, temp, sizeof(temp));
-                       }
-                       return buf;
-               }
-               break;
-#endif
-               case AF_INET:
-               {
-                       sockaddr_in* sin = (sockaddr_in*)this->ip;
-                       inet_ntop(sin->sin_family, &sin->sin_addr, buf, sizeof(buf));
-                       return buf;
-               }
-               break;
-
-               default:
-               break;
-       }
-       return "";
-}
-
 /** NOTE: We cannot pass a const reference to this method.
  * The string is changed by the workings of the method,
  * so that if we pass const ref, we end up copying it to