From a7fc2fe0dc845ffba1f4575e694aa1bb7f60756b Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 15 Feb 2019 10:58:43 +0000 Subject: Replace GetServerPort() with server_sa.port(). --- include/users.h | 5 ----- src/coremods/core_who.cpp | 2 +- src/modules/m_close.cpp | 2 +- src/modules/m_hostchange.cpp | 2 +- src/modules/m_httpd_stats.cpp | 2 +- src/modules/m_jumpserver.cpp | 2 +- src/users.cpp | 9 ++------- 7 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/users.h b/include/users.h index 39e7e90f0..9a90567a0 100644 --- a/include/users.h +++ b/include/users.h @@ -772,11 +772,6 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_nodeGetServerPort()) + if (port == lu->server_sa.port()) { match = true; break; diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index b0b45b4b6..c2a94a6ff 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -44,7 +44,7 @@ class CommandClose : public Command if (user->registered != REG_ALL) { ServerInstance->Users->QuitUser(user, "Closing all unknown connections per request"); - std::string key = ConvToStr(user->GetIPString())+"."+ConvToStr(user->GetServerPort()); + std::string key = ConvToStr(user->GetIPString())+"."+ConvToStr(user->server_sa.port()); closed[key]++; } } diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index be503ba6b..895e0f04a 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -76,7 +76,7 @@ class HostRule bool Matches(LocalUser* user) const { - if (!ports.empty() && !ports.count(user->GetServerPort())) + if (!ports.empty() && !ports.count(user->server_sa.port())) return false; if (InspIRCd::MatchCIDR(user->MakeHost(), mask)) diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 2b28c2628..3be8ec970 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -220,7 +220,7 @@ namespace Stats LocalUser* lu = IS_LOCAL(u); if (lu) - data << "" << lu->GetServerPort() << "" + data << "" << lu->server_sa.port() << "" << lu->server_sa.str() << "" << lu->GetClass()->GetName() << "" << lu->idle_lastmsg << ""; diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 02950e0e9..80b0a84ab 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -151,7 +151,7 @@ class CommandJumpserver : public Command { int p = (sslapi && sslapi->GetCertificate(user) ? sslport : port); if (p == 0) - p = user->GetServerPort(); + p = user->server_sa.port(); return p; } }; diff --git a/src/users.cpp b/src/users.cpp index 4050337c7..cf676d2dc 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -560,7 +560,7 @@ void LocalUser::FullConnect() FOREACH_MOD(OnPostConnect, (this)); ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]", - this->GetServerPort(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str()); + this->server_sa.port(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str()); ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); ServerInstance->BanCache.AddHit(this->GetIPString(), "", ""); // reset the flood penalty (which could have been raised due to things like auto +x) @@ -656,11 +656,6 @@ void LocalUser::OverruleNick() this->ChangeNick(this->uuid); } -int LocalUser::GetServerPort() -{ - return this->server_sa.port(); -} - const std::string& User::GetIPString() { if (cachedip.empty()) @@ -1121,7 +1116,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (!c->ports.empty()) { /* and our port doesn't match, fail. */ - if (!c->ports.count(this->GetServerPort())) + if (!c->ports.count(this->server_sa.port())) { ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Requires a different port, skipping"); continue; -- cgit v1.2.3