summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h6
-rw-r--r--src/users.cpp46
2 files changed, 4 insertions, 48 deletions
diff --git a/include/users.h b/include/users.h
index 915a23c0d..21214062c 100644
--- a/include/users.h
+++ b/include/users.h
@@ -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;
diff --git a/src/users.cpp b/src/users.cpp
index f487be6dc..2fb73c48b 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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