From 6a95b42e11bae7a3385c3d03819e29bb64f00191 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 5 Feb 2019 02:22:26 +0000 Subject: Move and to core_oper. --- src/users.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index b00992141..582abe17e 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -377,17 +377,6 @@ void User::Oper(OperInfo* info) if (info->oper_block) opername = info->oper_block->getString("name"); - if (IS_LOCAL(this)) - { - LocalUser* l = IS_LOCAL(this); - std::string vhost = oper->getConfig("vhost"); - if (!vhost.empty()) - l->ChangeDisplayedHost(vhost); - std::string opClass = oper->getConfig("class"); - if (!opClass.empty()) - l->SetClass(opClass); - } - ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')", nick.c_str(), ident.c_str(), GetRealHost().c_str(), oper->name.c_str(), opername.c_str()); this->WriteNumeric(RPL_YOUAREOPER, InspIRCd::Format("You are now %s %s", strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->name.c_str())); -- cgit v1.3.1-10-gc9f91 From 168ee804903e5ee10edc04e870e36a1256885e34 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 15 Feb 2019 10:56:08 +0000 Subject: Rename User::nping to nextping for consistency with lastping. --- include/users.h | 5 ++--- src/command_parse.cpp | 2 +- src/usermanager.cpp | 6 +++--- src/users.cpp | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/users.cpp') diff --git a/include/users.h b/include/users.h index 3937f74aa..39e7e90f0 100644 --- a/include/users.h +++ b/include/users.h @@ -791,9 +791,8 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_nodenping = ServerInstance->Time() + user->MyClass->GetPingTime(); + user->nextping = ServerInstance->Time() + user->MyClass->GetPingTime(); if (handler->flags_needed) { diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 4ab13fc95..40e0096a2 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -52,13 +52,13 @@ namespace void CheckPingTimeout(LocalUser* user) { // Check if it is time to ping the user yet. - if (ServerInstance->Time() < user->nping) + if (ServerInstance->Time() < user->nextping) return; // This user didn't answer the last ping, remove them. if (!user->lastping) { - time_t secs = ServerInstance->Time() - (user->nping - user->MyClass->GetPingTime()); + time_t secs = ServerInstance->Time() - (user->nextping - user->MyClass->GetPingTime()); const std::string message = "Ping timeout: " + ConvToStr(secs) + (secs != 1 ? " seconds" : " second"); ServerInstance->Users.QuitUser(user, message); return; @@ -68,7 +68,7 @@ namespace ClientProtocol::Messages::Ping ping; user->Send(ServerInstance->GetRFCEvents().ping, ping); user->lastping = 0; - user->nping = ServerInstance->Time() + user->MyClass->GetPingTime(); + user->nextping = ServerInstance->Time() + user->MyClass->GetPingTime(); } void CheckRegistrationTimeout(LocalUser* user) diff --git a/src/users.cpp b/src/users.cpp index 582abe17e..4050337c7 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -97,7 +97,7 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so , quitting_sendq(false) , lastping(true) , exempt(false) - , nping(0) + , nextping(0) , idle_lastmsg(0) , CommandFloodPenalty(0) , already_sent(0) @@ -503,7 +503,7 @@ void LocalUser::CheckClass(bool clone_count) } } - this->nping = ServerInstance->Time() + a->GetPingTime(); + this->nextping = ServerInstance->Time() + a->GetPingTime(); } bool LocalUser::CheckLines(bool doZline) -- cgit v1.3.1-10-gc9f91 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(-) (limited to 'src/users.cpp') 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.3.1-10-gc9f91