summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-02-15 10:58:43 +0000
committerPeter Powell <petpow@saberuk.com>2019-02-15 11:35:25 +0000
commita7fc2fe0dc845ffba1f4575e694aa1bb7f60756b (patch)
tree3d8c861e33e8b9ffe3cbd78a522a4e85fd914ec7
parent168ee804903e5ee10edc04e870e36a1256885e34 (diff)
Replace GetServerPort() with server_sa.port().
-rw-r--r--include/users.h5
-rw-r--r--src/coremods/core_who.cpp2
-rw-r--r--src/modules/m_close.cpp2
-rw-r--r--src/modules/m_hostchange.cpp2
-rw-r--r--src/modules/m_httpd_stats.cpp2
-rw-r--r--src/modules/m_jumpserver.cpp2
-rw-r--r--src/users.cpp9
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_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
index 132f8bc1e..b5f9163e1 100644
--- 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
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 << "<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
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;