summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h5
-rw-r--r--src/users.cpp14
2 files changed, 18 insertions, 1 deletions
diff --git a/include/users.h b/include/users.h
index 56297bed8..cdc0d8078 100644
--- a/include/users.h
+++ b/include/users.h
@@ -394,6 +394,11 @@ class CoreExport User : public Extensible
*/
bool SetClientIP(const char* sip);
+ /** Sets the client IP for this user
+ * @return true always
+ */
+ bool SetClientIP(irc::sockets::sockaddrs *sa);
+
/** Constructor
* @throw CoreException if the UID allocated to the user already exists
*/
diff --git a/src/users.cpp b/src/users.cpp
index 2ee389c86..b05d24871 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1008,10 +1008,22 @@ irc::sockets::cidr_mask User::GetCIDRMask()
return irc::sockets::cidr_mask(client_sa, range);
}
+bool User::SetClientIP(irc::sockets::sockaddrs *sa)
+{
+ memcpy(&client_sa, sa, sizeof(irc::sockets::sockaddrs));
+
+ return true;
+}
+
bool User::SetClientIP(const char* sip)
{
+ irc::sockets::sockaddrs sa;
+
this->cachedip = "";
- return irc::sockets::aptosa(sip, 0, client_sa);
+ if (!irc::sockets::aptosa(sip, 0, sa))
+ return false;
+
+ return SetClientIP(&sa);
}
static std::string wide_newline("\r\n");