From d0f802e30c492cb1b7e55f51063bfd38b29931c6 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 13 May 2019 17:24:25 +0100 Subject: Implement serialisation of users. This allows for various things which will be coming in the future. e.g. Transferring users to another server on upgrade. --- src/users.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index b8a2d31a8..01bad8b61 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -112,6 +112,15 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so ChangeRealHost(GetIPString(), true); } +LocalUser::LocalUser(int myfd, const std::string& uuid, Serializable::Data& data) + : User(uuid, ServerInstance->FakeClient->server, USERTYPE_LOCAL) + , eh(this) + , already_sent(0) +{ + eh.SetFd(myfd); + Deserialize(data); +} + User::~User() { } -- cgit v1.3.1-10-gc9f91 From 7cf9bfbcec453ea244e7f66ca5a76af99a73b7cb Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 18 Oct 2019 13:53:51 +0100 Subject: Fix a shadowing warning in LocalUser. --- src/users.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index 01bad8b61..69483ac92 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -112,8 +112,8 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so ChangeRealHost(GetIPString(), true); } -LocalUser::LocalUser(int myfd, const std::string& uuid, Serializable::Data& data) - : User(uuid, ServerInstance->FakeClient->server, USERTYPE_LOCAL) +LocalUser::LocalUser(int myfd, const std::string& uid, Serializable::Data& data) + : User(uid, ServerInstance->FakeClient->server, USERTYPE_LOCAL) , eh(this) , already_sent(0) { -- cgit v1.3.1-10-gc9f91 From ede5d4f612fed4462893aa8c2f67c44e9ec07b25 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 21 Oct 2019 12:21:11 +0100 Subject: Fire the OnSetUserIP event after the connect class change. --- src/users.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index 69483ac92..69def5154 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -758,17 +758,16 @@ void LocalUser::SetClientIP(const irc::sockets::sockaddrs& sa) return; ServerInstance->Users->RemoveCloneCounts(this); - User::SetClientIP(sa); - - FOREACH_MOD(OnSetUserIP, (this)); - ServerInstance->Users->AddClone(this); // Recheck the connect class. this->MyClass = NULL; this->SetClass(); this->CheckClass(); + + if (!quitting) + FOREACH_MOD(OnSetUserIP, (this)); } void LocalUser::Write(const ClientProtocol::SerializedMessage& text) -- cgit v1.3.1-10-gc9f91 From 2e75491aed528e63a3b1bcbe76483e395f8c2506 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Thu, 24 Oct 2019 10:25:29 +0100 Subject: Fix respecting the deprecated tag. --- src/channels.cpp | 2 ++ src/users.cpp | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/users.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index befc1f133..282199718 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -176,6 +176,8 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co if (!override) { unsigned int maxchans = user->GetClass()->maxchans; + if (!maxchans) + maxchans = ServerInstance->Config->MaxChans; if (user->IsOper()) { unsigned int opermaxchans = ConvToNum(user->oper->getConfig("maxchans")); diff --git a/src/users.cpp b/src/users.cpp index 69def5154..bca1c6a7c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1197,10 +1197,24 @@ const std::string& FakeUser::GetFullRealHost() } ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask) - : config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask), - pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0), - penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(ServerInstance->Config->MaxChans), - limit(0), resolvehostnames(true) + : config(tag) + , type(t) + , fakelag(true) + , name("unnamed") + , registration_timeout(0) + , host(mask) + , pingtime(0) + , softsendqmax(0) + , hardsendqmax(0) + , recvqmax(0) + , penaltythreshold(0) + , commandrate(0) + , maxlocal(0) + , maxglobal(0) + , maxconnwarn(true) + , maxchans(0) + , limit(0) + , resolvehostnames(true) { } -- cgit v1.3.1-10-gc9f91