diff options
author | Peter Powell <petpow@saberuk.com> | 2017-10-27 19:15:23 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2017-10-27 19:15:23 +0100 |
commit | 08f6f056667df63d1673bea959c73b75393113c6 (patch) | |
tree | f051b9cc25c7eea86183560118dde0b777c6dd9a | |
parent | 998967b58afb411c70dbf772758d4e1a1c7bea7e (diff) |
Change SetClientIP to take a C++ string instead of a char array.
-rw-r--r-- | include/users.h | 4 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/uid.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 8 |
4 files changed, 8 insertions, 8 deletions
diff --git a/include/users.h b/include/users.h index 2fbbf31b6..03d94b28b 100644 --- a/include/users.h +++ b/include/users.h @@ -371,7 +371,7 @@ class CoreExport User : public Extensible /** Sets the client IP for this user * @return true if the conversion was successful */ - virtual bool SetClientIP(const char* sip, bool recheck_eline = true); + virtual bool SetClientIP(const std::string& address, bool recheck_eline = true); virtual void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true); @@ -837,7 +837,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local */ void SetClass(const std::string &explicit_name = ""); - bool SetClientIP(const char* sip, bool recheck_eline = true) CXX11_OVERRIDE; + bool SetClientIP(const std::string& address, bool recheck_eline = true) CXX11_OVERRIDE; void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true) CXX11_OVERRIDE; diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 8abf7eb94..21098d7a7 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -36,7 +36,7 @@ enum static void ChangeIP(User* user, const std::string& newip) { ServerInstance->Users->RemoveCloneCounts(user); - user->SetClientIP(newip.c_str()); + user->SetClientIP(newip); ServerInstance->Users->AddClone(user); } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 91c9f3ca8..2a17943e9 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -115,7 +115,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st _new->SetMode(mh, true); } - _new->SetClientIP(params[6].c_str()); + _new->SetClientIP(params[6]); ServerInstance->Users->AddClone(_new); remoteserver->UserCount++; diff --git a/src/users.cpp b/src/users.cpp index 5aede9312..9fef906d1 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -707,10 +707,10 @@ irc::sockets::cidr_mask User::GetCIDRMask() return irc::sockets::cidr_mask(client_sa, range); } -bool User::SetClientIP(const char* sip, bool recheck_eline) +bool User::SetClientIP(const std::string& address, bool recheck_eline) { this->InvalidateCache(); - return irc::sockets::aptosa(sip, 0, client_sa); + return irc::sockets::aptosa(address, 0, client_sa); } void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline) @@ -720,10 +720,10 @@ void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline) memcpy(&client_sa, &sa, sizeof(irc::sockets::sockaddrs)); } -bool LocalUser::SetClientIP(const char* sip, bool recheck_eline) +bool LocalUser::SetClientIP(const std::string& address, bool recheck_eline) { irc::sockets::sockaddrs sa; - if (!irc::sockets::aptosa(sip, 0, sa)) + if (!irc::sockets::aptosa(address, 0, sa)) // Invalid return false; |