diff options
| author | 2022-10-29 15:44:01 +0100 | |
|---|---|---|
| committer | 2022-10-29 15:54:59 +0100 | |
| commit | 6fc111ccb6650a67f014977b2e7ebc2fb5b16790 (patch) | |
| tree | ea56149af9bf3e2226e32385ad6989355266090d /src | |
| parent | Use User::IsFullyConnected instead of checking for REG_ALL. (diff) | |
Rename session registration to connection to avoid a semantic conflict.
We previously referred to both session registration and user registration
as "registration" which is confusing for users who aren't familiar with
how IRC works.
Diffstat (limited to 'src')
31 files changed, 77 insertions, 79 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 532a1ad1f..591f3368b 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -174,7 +174,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co { if (!user->IsFullyConnected()) { - ServerInstance->Logs.Debug("CHANNELS", "Attempted to join unregistered user " + user->uuid + " to channel " + cname); + ServerInstance->Logs.Debug("CHANNELS", "Attempted to join partially connected user " + user->uuid + " to channel " + cname); return nullptr; } diff --git a/src/command_parse.cpp b/src/command_parse.cpp index dda2d2edd..62b7dcade 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -314,7 +314,7 @@ void CommandParser::ProcessCommand(LocalUser* user, std::string& command, Comman if (!user->IsFullyConnected() && !handler->works_before_reg) { user->CommandFloodPenalty += failpenalty; - handler->TellNotRegistered(user, command_p); + handler->TellNotFullyConnected(user, command_p); FOREACH_MOD(OnCommandBlocked, (command, command_p, user)); } else diff --git a/src/commands.cpp b/src/commands.cpp index bae8ef10b..c35e5d2cb 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -76,9 +76,9 @@ void Command::TellNotEnoughParameters(LocalUser* user, const Params& parameters) } } -void Command::TellNotRegistered(LocalUser* user, const Params& parameters) +void Command::TellNotFullyConnected(LocalUser* user, const Params& parameters) { - user->WriteNumeric(ERR_NOTREGISTERED, name, "You have not registered."); + user->WriteNumeric(ERR_NOTREGISTERED, name, "You must be fully connected to use this command."); } SplitCommand::SplitCommand(Module* me, const std::string& cmd, unsigned int minpara, unsigned int maxpara) diff --git a/src/coremods/core_info/isupport.cpp b/src/coremods/core_info/isupport.cpp index 7cc2f1135..822af8b6b 100644 --- a/src/coremods/core_info/isupport.cpp +++ b/src/coremods/core_info/isupport.cpp @@ -127,7 +127,7 @@ void ISupportManager::Build() { for (LocalUser* user : ServerInstance->Users.GetLocalUsers()) { - if (!(user->registered & REG_ALL)) + if (!(user->connected & User::CONN_FULL)) continue; // User hasn't received 005 yet. auto numerics = diffnumerics.find(user->GetClass()); diff --git a/src/coremods/core_lusers.cpp b/src/coremods/core_lusers.cpp index 852a2b385..19b308393 100644 --- a/src/coremods/core_lusers.cpp +++ b/src/coremods/core_lusers.cpp @@ -47,7 +47,7 @@ struct LusersCounters final LusersCounters(UserModeReference& invisiblemode) : max_local(ServerInstance->Users.LocalUserCount()) - , max_global(ServerInstance->Users.RegisteredUserCount()) + , max_global(ServerInstance->Users.GlobalUserCount()) { for (const auto& [_, u] : ServerInstance->Users.GetUsers()) { @@ -62,7 +62,7 @@ struct LusersCounters final if (current > max_local) max_local = current; - current = ServerInstance->Users.RegisteredUserCount(); + current = ServerInstance->Users.GlobalUserCount(); if (current > max_global) max_global = current; } @@ -86,7 +86,7 @@ public: CmdResult CommandLusers::Handle(User* user, const Params& parameters) { - size_t n_users = ServerInstance->Users.RegisteredUserCount(); + size_t n_users = ServerInstance->Users.GlobalUserCount(); ProtocolInterface::ServerList serverlist; ServerInstance->PI->GetServerList(serverlist); size_t n_serv = serverlist.size(); @@ -110,8 +110,8 @@ CmdResult CommandLusers::Handle(User* user, const Params& parameters) if (opercount) user->WriteNumeric(RPL_LUSEROP, opercount, "operator(s) online"); - if (ServerInstance->Users.UnregisteredUserCount()) - user->WriteNumeric(RPL_LUSERUNKNOWN, ServerInstance->Users.UnregisteredUserCount(), "unknown connections"); + if (ServerInstance->Users.UnknownUserCount()) + user->WriteNumeric(RPL_LUSERUNKNOWN, ServerInstance->Users.UnknownUserCount(), "unknown connections"); user->WriteNumeric(RPL_LUSERCHANNELS, ServerInstance->Channels.GetChans().size(), "channels formed"); user->WriteNumeric(RPL_LUSERME, InspIRCd::Format("I have %zu clients and %zu servers", ServerInstance->Users.LocalUserCount(), n_local_servs)); diff --git a/src/coremods/core_message.cpp b/src/coremods/core_message.cpp index 5338d3666..849b15732 100644 --- a/src/coremods/core_message.cpp +++ b/src/coremods/core_message.cpp @@ -196,7 +196,7 @@ private: for (auto* luser : ServerInstance->Users.GetLocalUsers()) { - // Don't send to unregistered users or the user who is the source. + // Don't send to partially connected users or the user who is the source. if (!luser->IsFullyConnected() || luser == source) continue; @@ -238,7 +238,7 @@ private: if (!target) { - // The target user does not exist or is not fully registered. + // The target user does not exist or is not fully connected. source->WriteNumeric(Numerics::NoSuchNick(parameters[0])); return CmdResult::FAILURE; } @@ -379,7 +379,7 @@ public: if (!target || !target->server->IsService()) { - // The target user does not exist, is not fully registered, or is not a service. + // The target user does not exist, is not fully connected, or is not a service. user->WriteRemoteNumeric(ERR_NOSUCHSERVICE, parameters[0], "No such service"); return CmdResult::FAILURE; } diff --git a/src/coremods/core_oper/cmd_die.cpp b/src/coremods/core_oper/cmd_die.cpp index df2a306e0..b62913786 100644 --- a/src/coremods/core_oper/cmd_die.cpp +++ b/src/coremods/core_oper/cmd_die.cpp @@ -52,7 +52,7 @@ void DieRestart::SendError(const std::string& message) } else { - // Unregistered connections receive ERROR, not a NOTICE + // Partially connected users receive ERROR, not a NOTICE user->Send(errorevent); } } diff --git a/src/coremods/core_oper/core_oper.h b/src/coremods/core_oper/core_oper.h index 1cb22b762..a6ef6632c 100644 --- a/src/coremods/core_oper/core_oper.h +++ b/src/coremods/core_oper/core_oper.h @@ -25,7 +25,7 @@ namespace DieRestart { - /** Send an ERROR to unregistered users and a NOTICE to all registered local users + /** Send an ERROR to partially connected users and a NOTICE to fully connected users * @param message Message to send */ void SendError(const std::string& message); diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index 3fe7171b2..6d1111f4c 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -161,7 +161,7 @@ void CommandStats::DoStats(Stats::Context& stats) { for (const auto& host : c->GetHosts()) stats.AddRow(215, 'i', "NOMATCH", '*', host, (c->limit ? c->limit : SocketEngine::GetMaxFds()), idx, ServerInstance->Config->ServerName, '*'); - stats.AddRow(218, 'Y', idx, c->pingtime, '0', c->hardsendqmax, ConvToStr(c->recvqmax) + " " + ConvToStr(c->registration_timeout)); + stats.AddRow(218, 'Y', idx, c->pingtime, '0', c->hardsendqmax, ConvToStr(c->recvqmax) + " " + ConvToStr(c->connection_timeout)); idx++; } } diff --git a/src/coremods/core_stub.cpp b/src/coremods/core_stub.cpp index 1b21eba40..4928b1d88 100644 --- a/src/coremods/core_stub.cpp +++ b/src/coremods/core_stub.cpp @@ -40,7 +40,7 @@ public: CmdResult Handle(User* user, const Params& parameters) override { - if (user->registered == REG_NONE) + if (user->connected == User::CONN_NONE) { // The CAPAB command is used in the server protocol for negotiating // the protocol version when initiating a server connection. There diff --git a/src/coremods/core_user/cmd_nick.cpp b/src/coremods/core_user/cmd_nick.cpp index 9dc23981a..0079c683b 100644 --- a/src/coremods/core_user/cmd_nick.cpp +++ b/src/coremods/core_user/cmd_nick.cpp @@ -92,9 +92,9 @@ CmdResult CommandNick::HandleLocal(LocalUser* user, const Params& parameters) if (!user->ChangeNick(newnick)) return CmdResult::FAILURE; - if (user->registered < REG_NICKUSER) + if (user->connected < User::CONN_NICKUSER) { - user->registered = (user->registered | REG_NICK); + user->connected |= User::CONN_NICK; return CommandUser::CheckRegister(user); } diff --git a/src/coremods/core_user/cmd_user.cpp b/src/coremods/core_user/cmd_user.cpp index dc641a267..597599eee 100644 --- a/src/coremods/core_user/cmd_user.cpp +++ b/src/coremods/core_user/cmd_user.cpp @@ -44,7 +44,7 @@ CommandUser::CommandUser(Module* parent) CmdResult CommandUser::HandleLocal(LocalUser* user, const Params& parameters) { /* A user may only send the USER command once */ - if (!(user->registered & REG_USER)) + if (!(user->connected & User::CONN_USER)) { if (!ServerInstance->IsIdent(parameters[0])) { @@ -55,12 +55,12 @@ CmdResult CommandUser::HandleLocal(LocalUser* user, const Params& parameters) { user->ChangeIdent(parameters[0]); user->ChangeRealName(parameters[3]); - user->registered = (user->registered | REG_USER); + user->connected |= User::CONN_USER; } } else { - user->WriteNumeric(ERR_ALREADYREGISTERED, "You may not reregister"); + user->WriteNumeric(ERR_ALREADYREGISTERED, "You may not resend the USER command"); user->CommandFloodPenalty += 1000; return CmdResult::FAILURE; } @@ -71,9 +71,10 @@ CmdResult CommandUser::HandleLocal(LocalUser* user, const Params& parameters) CmdResult CommandUser::CheckRegister(LocalUser* user) { - // If the user is registered, return CmdResult::SUCCESS/CmdResult::FAILURE depending on what modules say, otherwise just - // return CmdResult::SUCCESS without doing anything, knowing the other handler will call us again - if (user->registered == REG_NICKUSER) + // If the user is fully connected, return CmdResult::SUCCESS/CmdResult::FAILURE depending on + // what modules say, otherwise just return CmdResult::SUCCESS without doing anything, knowing + // the other handler will call us again + if (user->connected == User::CONN_NICKUSER) { ModResult MOD_RESULT; FIRST_MOD_RESULT(OnUserRegister, MOD_RESULT, (user)); diff --git a/src/coremods/core_user/core_user.cpp b/src/coremods/core_user/core_user.cpp index 57ad1b0d5..7277d54e3 100644 --- a/src/coremods/core_user/core_user.cpp +++ b/src/coremods/core_user/core_user.cpp @@ -43,11 +43,10 @@ public: CmdResult HandleLocal(LocalUser* user, const Params& parameters) override { - // Check to make sure they haven't registered -- Fix by FCS if (user->IsFullyConnected()) { user->CommandFloodPenalty += 1000; - user->WriteNumeric(ERR_ALREADYREGISTERED, "You may not reregister"); + user->WriteNumeric(ERR_ALREADYREGISTERED, "You may not resend the PASS command"); return CmdResult::FAILURE; } user->password = parameters[0]; diff --git a/src/coremods/core_user/core_user.h b/src/coremods/core_user/core_user.h index 619d0c4ba..db4748af9 100644 --- a/src/coremods/core_user/core_user.h +++ b/src/coremods/core_user/core_user.h @@ -119,7 +119,7 @@ public: CommandUser(Module* parent); CmdResult HandleLocal(LocalUser* user, const Params& parameters) override; - /** Run the OnUserRegister hook if the user has sent both NICK and USER. Called after an unregistered user + /** Run the OnUserRegister hook if the user has sent both NICK and USER. Called after a partially connected user * successfully executes the USER or the NICK command. * @param user User to inspect and possibly pass to the OnUserRegister hook * @return CmdResult::FAILURE if OnUserRegister was called and it returned MOD_RES_DENY, CmdResult::SUCCESS in every other case diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index 43494e15f..ac872209b 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -258,7 +258,7 @@ bool CommandWho::MatchChannel(LocalUser* source, Membership* memb, WhoData& data bool CommandWho::MatchUser(LocalUser* source, User* user, WhoData& data) { - // Users who are not fully registered can never match. + // Users who are not fully connected can never match. if (!user->IsFullyConnected()) return false; diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp index f9d786141..cd0ec058b 100644 --- a/src/coremods/core_xline/core_xline.cpp +++ b/src/coremods/core_xline/core_xline.cpp @@ -145,7 +145,7 @@ public: if (!xline) return MOD_RES_PASSTHRU; // No match - // A Q-line matched the new nick, tell opers if the user is registered + // A Q-line matched the new nick, tell opers if the user is fully connected if (user->IsFullyConnected()) { ServerInstance->SNO.WriteGlobalSno('x', "Q-lined nickname %s from %s: %s", diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 1a02b2972..ee4c5d6e5 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -160,9 +160,7 @@ public: ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) override { - /* If they're not registered yet, we dont want - * to know. - */ + // If they're not fully connected yet, we dont want to know. if (!user->IsFullyConnected()) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 793ec389d..93254a852 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -77,7 +77,7 @@ public: ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) override { - // Don't do anything with unregistered users + // Don't do anything with partially connected users if (!user->IsFullyConnected()) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index c98ea0208..d84b70a8e 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -59,7 +59,7 @@ public: auto dest = ServerInstance->Users.Find(parameters[0]); - // Allow services to change the host of unregistered users + // Allow services to change the host of partially connected users. if (!dest || (!dest->IsFullyConnected() && !user->server->IsService())) { user->WriteNumeric(Numerics::NoSuchNick(parameters[0])); diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index c00f4e850..e0112b6aa 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -57,7 +57,7 @@ public: } if(sendsnotice) - user->WriteNotice("*** If you are having problems connecting due to registration timeouts type /quote PONG " + pingrpl + " or /raw PONG " + pingrpl + " now."); + user->WriteNotice("*** If you are having problems connecting due to connection timeouts type /quote PONG " + pingrpl + " or /raw PONG " + pingrpl + " now."); ext.Set(user, pingrpl); return MOD_RES_PASSTHRU; @@ -79,7 +79,7 @@ public: else { if(killonbadreply) - ServerInstance->Users.QuitUser(user, "Incorrect ping reply for registration"); + ServerInstance->Users.QuitUser(user, "Incorrect ping reply for connection"); return MOD_RES_DENY; } } diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp index c718d0abc..e9610209f 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -141,7 +141,7 @@ public: ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) override { - // If a command is unvalidated or the source is not registered we do nothing. + // If a command is unvalidated or the source is not fully connected we do nothing. if (!validated || !user->IsFullyConnected()) return MOD_RES_PASSTHRU; @@ -169,7 +169,7 @@ public: ModResult OnRawMode(User* user, Channel* chan, const Modes::Change& change) override { - // If a mode change is remote or the source is not registered we do nothing. + // If a mode change is remote or the source is not fully connected we do nothing. if (!IS_LOCAL(user) || !user->IsFullyConnected()) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 9adfaf3bd..ede26f28f 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -28,7 +28,7 @@ enum { - // Either the ident lookup has not started yet or the user is registered. + // Either the ident lookup has not started yet or the user is fully connected. IDENT_UNKNOWN = 0, // Ident lookups are not enabled and a user has been marked as being skipped. @@ -380,7 +380,7 @@ public: } else if (!isock->HasResult()) { - // time still good, no result yet... hold the registration + // time still good, no result yet... hold the connection return MOD_RES_DENY; } diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp index c1c617538..a961dbffa 100644 --- a/src/modules/m_ircv3.cpp +++ b/src/modules/m_ircv3.cpp @@ -146,7 +146,7 @@ public: void OnAccountChange(User* user, const std::string& newaccount) override { - if (!(user->registered & REG_NICKUSER)) + if (!(user->connected & User::CONN_NICKUSER)) return; // Logged in: 1 parameter which is the account name diff --git a/src/modules/m_ircv3_chghost.cpp b/src/modules/m_ircv3_chghost.cpp index df706334f..5ff9ac1ba 100644 --- a/src/modules/m_ircv3_chghost.cpp +++ b/src/modules/m_ircv3_chghost.cpp @@ -30,7 +30,7 @@ class ModuleIRCv3ChgHost final void DoChgHost(User* user, const std::string& ident, const std::string& host) { - if (!(user->registered & REG_NICKUSER)) + if (!(user->connected & User::CONN_NICKUSER)) return; ClientProtocol::Message msg("CHGHOST", user); diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index 5d9e74e8a..14bc98fbc 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -133,7 +133,7 @@ private: message.SetSideEffect(true); for (auto* luser : ServerInstance->Users.GetLocalUsers()) { - // Don't send to unregistered users or the user who is the source. + // Don't send to partially connected users or the user who is the source. if (!luser->IsFullyConnected() || luser == source) continue; @@ -185,7 +185,7 @@ private: if (!target) { - // The target user does not exist or is not fully registered. + // The target user does not exist or is not fully connected. source->WriteNumeric(Numerics::NoSuchNick(parameters[0])); return CmdResult::FAILURE; } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 159d960ed..4ca3e6979 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -443,7 +443,7 @@ public: void OnUserConnect(LocalUser* user) override { - // If the client completes registration (with CAP END, NICK, USER and + // If the client completes connection (with CAP END, NICK, USER and // any other necessary messages) while the SASL authentication is still // in progress, the server SHOULD abort it and send a 906 numeric, then // register the client without authentication. diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index e94f425f0..884edabec 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -95,7 +95,7 @@ public: void OnChangeRealName(User* user, const std::string& real) override { - if (!(user->registered & REG_NICKUSER)) + if (!(user->connected & User::CONN_NICKUSER)) return; ClientProtocol::Message msg("SETNAME", user); diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index ccedf8c3c..e141f022b 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -51,14 +51,14 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params auto collideswith = ServerInstance->Users.FindNick(params[2]); if (collideswith && !collideswith->IsFullyConnected()) { - // User that the incoming user is colliding with is not fully registered, we force nick change the - // unregistered user to their uuid and tell them what happened + // User that the incoming user is colliding with is not fully connected, we force nick change the + // partially connected user to their uuid and tell them what happened LocalUser* const localuser = static_cast<LocalUser*>(collideswith); localuser->OverruleNick(); } else if (collideswith) { - // The user on this side is registered, handle the collision + // The user on this side is fully connected, handle the collision bool they_change = Utils->DoCollision(collideswith, remoteserver, nickchanged, params[5], params[6], params[0], "UID"); if (they_change) { @@ -85,7 +85,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params _new->ident = params[5]; _new->ChangeRemoteAddress(sa); _new->ChangeRealName(params.back()); - _new->registered = REG_ALL; + _new->connected = User::CONN_FULL; _new->signon = signon; _new->nickchanged = nickchanged; diff --git a/src/modules/m_starttls.cpp b/src/modules/m_starttls.cpp index c95b7b4f5..905e8f6e3 100644 --- a/src/modules/m_starttls.cpp +++ b/src/modules/m_starttls.cpp @@ -55,7 +55,7 @@ public: if (user->IsFullyConnected()) { - user->WriteNumeric(ERR_STARTTLS, "STARTTLS is not permitted after client registration is complete"); + user->WriteNumeric(ERR_STARTTLS, "STARTTLS is not permitted once you are fully connected"); return CmdResult::FAILURE; } @@ -70,7 +70,7 @@ public: * otherwise we'll be sending this line inside the TLS session - which * won't start its handshake until the client gets this line. Currently, * we assume the write will not block here; this is usually safe, as - * STARTTLS is sent very early on in the registration phase, where the + * STARTTLS is sent very early on in the connection phase, where the * user hasn't built up much sendq. Handling a blocked write here would * be very annoying. */ diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 5e33002bc..041d32d3b 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -80,13 +80,13 @@ namespace user->nextping = ServerInstance->Time() + user->GetClass()->pingtime; } - void CheckRegistrationTimeout(LocalUser* user) + void CheckConnectionTimeout(LocalUser* user) { - if (user->GetClass() && (ServerInstance->Time() > static_cast<time_t>(user->signon + user->GetClass()->registration_timeout))) + if (user->GetClass() && (ServerInstance->Time() > static_cast<time_t>(user->signon + user->GetClass()->connection_timeout))) { - // Either the user did not send NICK/USER or a module blocked registration in + // Either the user did not send NICK/USER or a module blocked connection in // OnCheckReady until the client timed out. - ServerInstance->Users.QuitUser(user, "Registration timeout"); + ServerInstance->Users.QuitUser(user, "Connection timeout"); } } @@ -104,7 +104,7 @@ namespace // If the user has been quit in OnCheckReady then we shouldn't quit // them again for having a registration timeout. if (!user->quitting) - CheckRegistrationTimeout(user); + CheckConnectionTimeout(user); } } @@ -127,7 +127,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs ServerInstance->Logs.Debug("USERS", "New user fd: %d", socket); - this->unregistered_count++; + this->unknown_count++; this->clientlist[New->nick] = New; this->AddClone(New); this->local_users.push_front(New); @@ -283,7 +283,7 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std WriteCommonQuit(user, quitmsg, operquitmsg); } else - unregistered_count--; + unknown_count--; if (IS_LOCAL(user)) { @@ -351,7 +351,7 @@ const UserManager::CloneCounts& UserManager::GetCloneCounts(User* user) const /** * This function is called once a second from the mainloop. * It is intended to do background checking on all the users, e.g. do - * ping checks, registration timeouts, etc. + * ping checks, connection timeouts, etc. */ void UserManager::DoBackgroundUserStuff() { @@ -371,18 +371,18 @@ void UserManager::DoBackgroundUserStuff() curr->eh.OnDataReady(); } - switch (curr->registered) + switch (curr->connected) { - case REG_ALL: + case User::CONN_FULL: CheckPingTimeout(curr); break; - case REG_NICKUSER: + case User::CONN_NICKUSER: CheckModulesReady(curr); break; default: - CheckRegistrationTimeout(curr); + CheckConnectionTimeout(curr); break; } } diff --git a/src/users.cpp b/src/users.cpp index e5b38349d..f711a4a7d 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -91,7 +91,7 @@ User::User(const std::string& uid, Server* srv, Type type) , nickchanged(ServerInstance->Time()) , uuid(uid) , server(srv) - , registered(REG_NONE) + , connected(CONN_NONE) , quitting(false) , uniqueusername(false) , usertype(type) @@ -566,15 +566,15 @@ void LocalUser::FullConnect() return; /* - * We don't set REG_ALL until triggering OnUserConnect, so some module events don't spew out stuff + * We don't set CONN_FULL until triggering OnUserConnect, so some module events don't spew out stuff * for a user that doesn't exist yet. */ FOREACH_MOD(OnUserConnect, (this)); - /* Now registered */ - if (ServerInstance->Users.unregistered_count) - ServerInstance->Users.unregistered_count--; - this->registered = REG_ALL; + // The user is now fully connected. + if (ServerInstance->Users.unknown_count) + ServerInstance->Users.unknown_count--; + this->connected = CONN_FULL; FOREACH_MOD(OnPostConnect, (this)); @@ -671,7 +671,7 @@ void LocalUser::OverruleNick() this->WriteNumeric(ERR_NICKNAMEINUSE, this->nick, "Nickname overruled."); // Clear the bit before calling ChangeNick() to make it NOT run the OnUserPostNick() hook - this->registered &= ~REG_NICK; + this->connected &= ~CONN_NICK; this->ChangeNick(this->uuid); } @@ -998,7 +998,7 @@ bool User::ChangeDisplayedHost(const std::string& shost) this->InvalidateCache(); - if (IS_LOCAL(this) && this->registered != REG_NONE) + if (IS_LOCAL(this) && connected != User::CONN_NONE) this->WriteNumeric(RPL_YOURDISPLAYEDHOST, this->GetDisplayedHost(), "is now your displayed host"); return true; @@ -1105,11 +1105,11 @@ void LocalUser::SetClass(const std::string& explicit_name) continue; } - bool regdone = (registered != REG_NONE); - if (c->config->getBool("registered", regdone) != regdone) + bool conndone = connected != User::CONN_NONE; + if (c->config->getBool("connected", c->config->getBool("registered", conndone)) != conndone) { ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires that the user is %s", - c->GetName().c_str(), regdone ? "not fully connected" : "fully connected"); + c->GetName().c_str(), conndone ? "not fully connected" : "fully connected"); continue; } @@ -1150,7 +1150,7 @@ void LocalUser::SetClass(const std::string& explicit_name) continue; } - if (regdone && !c->password.empty() && !ServerInstance->PassCompare(this, c->password, password, c->passwordhash)) + if (conndone && !c->password.empty() && !ServerInstance->PassCompare(this, c->password, password, c->passwordhash)) { ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as requires a password and %s", c->GetName().c_str(), password.empty() ? "one was not provided" : "the provided password was incorrect"); @@ -1273,7 +1273,7 @@ void ConnectClass::Configure(const std::string& classname, std::shared_ptr<Confi penaltythreshold = tag->getUInt("threshold", penaltythreshold, 1); pingtime = tag->getDuration("pingfreq", pingtime); recvqmax = tag->getUInt("recvq", recvqmax, ServerInstance->Config->Limits.MaxLine); - registration_timeout = tag->getDuration("timeout", registration_timeout); + connection_timeout = tag->getDuration("timeout", connection_timeout); resolvehostnames = tag->getBool("resolvehostnames", resolvehostnames); softsendqmax = tag->getUInt("softsendq", softsendqmax, ServerInstance->Config->Limits.MaxLine); uniqueusername = tag->getBool("uniqueusername", uniqueusername); @@ -1299,7 +1299,7 @@ void ConnectClass::Update(const ConnectClass::Ptr src) pingtime = src->pingtime; ports = src->ports; recvqmax = src->recvqmax; - registration_timeout = src->registration_timeout; + connection_timeout = src->connection_timeout; resolvehostnames = src->resolvehostnames; softsendqmax = src->softsendqmax; type = src->type; |
