summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2012-06-11 22:06:36 -0500
committerSir Poggles <sir.pogsalot@gmail.com>2012-06-12 22:49:29 -0700
commitf0474272303ac9297f637ce956315518138bafff (patch)
tree8c79e5206ee53282b252ad876d66f4ab08fe49c5 /src/users.cpp
parent5db5dd923c6dc3f4c24b592148060b258b295cde (diff)
users: add SetClientIP function for irc::sockets::sockaddrs type.
Code which touches client_sa should instead use this SetClientIP function so that hooks may be called in the future.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp14
1 files changed, 13 insertions, 1 deletions
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");