inspircd

A modular C++ IRC daemon (ircd). https://www.inspircd.org/
Log | Files | Refs | README

commit a7fc2fe0dc845ffba1f4575e694aa1bb7f60756b
parent 168ee804903e5ee10edc04e870e36a1256885e34
Author: Peter Powell <petpow@saberuk.com>
Date:   Fri, 15 Feb 2019 10:58:43 +0000

Replace GetServerPort() with server_sa.port().

Diffstat:
Minclude/users.h | 5-----
Msrc/coremods/core_who.cpp | 2+-
Msrc/modules/m_close.cpp | 2+-
Msrc/modules/m_hostchange.cpp | 2+-
Msrc/modules/m_httpd_stats.cpp | 2+-
Msrc/modules/m_jumpserver.cpp | 2+-
Msrc/users.cpp | 9++-------
7 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/include/users.h b/include/users.h @@ -772,11 +772,6 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local */ irc::sockets::sockaddrs server_sa; - /** - * @return The port number of this user. - */ - int GetServerPort(); - /** Recursion fix: user is out of SendQ and will be quit as soon as possible. * This can't be handled normally because QuitUser itself calls Write on other * users, which could trigger their SendQ to overrun. diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp @@ -274,7 +274,7 @@ bool CommandWho::MatchUser(LocalUser* source, User* user, WhoData& data) long port; while ((port = portrange.GetToken())) { - if (port == lu->GetServerPort()) + if (port == lu->server_sa.port()) { match = true; break; diff --git 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 @@ -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 @@ -220,7 +220,7 @@ namespace Stats LocalUser* lu = IS_LOCAL(u); if (lu) - data << "<local/><port>" << lu->GetServerPort() << "</port><servaddr>" + data << "<local/><port>" << lu->server_sa.port() << "</port><servaddr>" << lu->server_sa.str() << "</servaddr><connectclass>" << lu->GetClass()->GetName() << "</connectclass><lastmsg>" << lu->idle_lastmsg << "</lastmsg>"; diff --git 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 @@ -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;