]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Replace GetServerPort() with server_sa.port().
authorPeter Powell <petpow@saberuk.com>
Fri, 15 Feb 2019 10:58:43 +0000 (10:58 +0000)
committerPeter Powell <petpow@saberuk.com>
Fri, 15 Feb 2019 11:35:25 +0000 (11:35 +0000)
include/users.h
src/coremods/core_who.cpp
src/modules/m_close.cpp
src/modules/m_hostchange.cpp
src/modules/m_httpd_stats.cpp
src/modules/m_jumpserver.cpp
src/users.cpp

index 39e7e90f00d08a10da2107176f280bc530ddb515..9a90567a09ab3e27f53abfcca7bd9facdb7bfb3c 100644 (file)
@@ -772,11 +772,6 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
         */
        irc::sockets::sockaddrs server_sa;
 
         */
        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.
        /** 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.
index 132f8bc1e29d5d2af8396ab3310a3b0a7c3d011c..b5f9163e14fafb7edcfd65dcb4cebc49b392a956 100644 (file)
@@ -274,7 +274,7 @@ bool CommandWho::MatchUser(LocalUser* source, User* user, WhoData& data)
                        long port;
                        while ((port = portrange.GetToken()))
                        {
                        long port;
                        while ((port = portrange.GetToken()))
                        {
-                               if (port == lu->GetServerPort())
+                               if (port == lu->server_sa.port())
                                {
                                        match = true;
                                        break;
                                {
                                        match = true;
                                        break;
index b0b45b4b6b3797a18cda2120be497c1e5a99efa2..c2a94a6ff57d6e83a8ac35a839674211e96d65d9 100644 (file)
@@ -44,7 +44,7 @@ class CommandClose : public Command
                        if (user->registered != REG_ALL)
                        {
                                ServerInstance->Users->QuitUser(user, "Closing all unknown connections per request");
                        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]++;
                        }
                }
                                closed[key]++;
                        }
                }
index be503ba6b29520084b97a5375eb14bde23ad17c9..895e0f04a29ebba0f2a3c615a91bc4c42c71fa96 100644 (file)
@@ -76,7 +76,7 @@ class HostRule
 
        bool Matches(LocalUser* user) const
        {
 
        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))
                        return false;
 
                if (InspIRCd::MatchCIDR(user->MakeHost(), mask))
index 2b28c262802ff4f28c4973d87df0b7b21e745828..3be8ec9703562225257e496016a01a5a81d964ac 100644 (file)
@@ -220,7 +220,7 @@ namespace Stats
 
                LocalUser* lu = IS_LOCAL(u);
                if (lu)
 
                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>";
                                << lu->server_sa.str() << "</servaddr><connectclass>"
                                << lu->GetClass()->GetName() << "</connectclass><lastmsg>"
                                << lu->idle_lastmsg << "</lastmsg>";
index 02950e0e97c3c12e85dbfc4016708442e441830e..80b0a84abe47f859fcce9abaf03c34daa0b30732 100644 (file)
@@ -151,7 +151,7 @@ class CommandJumpserver : public Command
        {
                int p = (sslapi && sslapi->GetCertificate(user) ? sslport : port);
                if (p == 0)
        {
                int p = (sslapi && sslapi->GetCertificate(user) ? sslport : port);
                if (p == 0)
-                       p = user->GetServerPort();
+                       p = user->server_sa.port();
                return p;
        }
 };
                return p;
        }
 };
index 4050337c7a2e7ed6ab9b02564136d508ff044c14..cf676d2dcba676a3b2fbcf42fa982c0e0b41d97e 100644 (file)
@@ -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]",
        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)
        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);
 }
 
        this->ChangeNick(this->uuid);
 }
 
-int LocalUser::GetServerPort()
-{
-       return this->server_sa.port();
-}
-
 const std::string& User::GetIPString()
 {
        if (cachedip.empty())
 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.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;
                                {
                                        ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Requires a different port, skipping");
                                        continue;