aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-10-11 11:12:04 +0100
committerGravatar Sadie Powell2022-10-11 11:12:04 +0100
commit41d131285318dde95aea16291bcca915b2174e30 (patch)
tree5b22a78c59cbfcaa94eda09889792a2ee3236058
parentFix serializing attributes in httpd_stats. (diff)
Rename User::age to User::nickchanged and fix the docs.
-rw-r--r--include/users.h5
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/modules/m_httpd_stats.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/nickcollide.cpp4
-rw-r--r--src/modules/m_spanningtree/save.cpp2
-rw-r--r--src/modules/m_spanningtree/svsnick.cpp2
-rw-r--r--src/modules/m_spanningtree/uid.cpp14
-rw-r--r--src/modules/m_watch.cpp10
-rw-r--r--src/users.cpp4
10 files changed, 24 insertions, 25 deletions
diff --git a/include/users.h b/include/users.h
index 3dbeb396f..c937166d8 100644
--- a/include/users.h
+++ b/include/users.h
@@ -238,9 +238,8 @@ public:
*/
typedef insp::intrusive_list<Membership> ChanList;
- /** Time that the object was instantiated (used for TS calculation etc)
- */
- time_t age;
+ /** The time at which this user's nickname was last changed. */
+ time_t nickchanged;
/** Time the connection was created, set in the constructor. This
* may be different from the time the user's Cullable object was
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 4ccacccd0..c924f55e5 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -196,7 +196,7 @@ public:
context.Write("server", targetuser->server->GetName());
context.Write("uid", targetuser->uuid);
context.Write("signon", targetuser->signon);
- context.Write("nickts", targetuser->age);
+ context.Write("nickchanged", targetuser->nickchanged);
if (localtarget)
context.Write("lastmsg", localtarget->idle_lastmsg);
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 8dc56972c..f05c418cb 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -262,7 +262,7 @@ namespace Stats
.Attribute("realname", u->GetRealName())
.Attribute("server", u->server->GetName())
.Attribute("signon", u->signon)
- .Attribute("age", u->age)
+ .Attribute("nickchanged", u->nickchanged)
.Attribute("modes", u->GetModeLetters().substr(1))
.Attribute("ident", u->ident)
.Attribute("ipaddress", u->GetIPString());
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index cc5a559ff..55ca9ee62 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -626,12 +626,12 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string& oldnick)
// The nick TS is updated by the core, we don't do it
CmdBuilder params(user, "NICK");
params.push(user->nick);
- params.push(ConvToStr(user->age));
+ params.push(ConvToStr(user->nickchanged));
params.Broadcast();
}
else if (!loopCall)
{
- ServerInstance->Logs.Normal(MODNAME, "WARNING: Changed nick of remote user %s from %s to %s TS %lu by ourselves!", user->uuid.c_str(), oldnick.c_str(), user->nick.c_str(), (unsigned long) user->age);
+ ServerInstance->Logs.Normal(MODNAME, "WARNING: Changed nick of remote user %s from %s to %s TS %lu by ourselves!", user->uuid.c_str(), oldnick.c_str(), user->nick.c_str(), (unsigned long) user->nickchanged);
}
}
diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp
index b0e079de0..1d1122e8f 100644
--- a/src/modules/m_spanningtree/nickcollide.cpp
+++ b/src/modules/m_spanningtree/nickcollide.cpp
@@ -65,7 +65,7 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo
// If the timestamps are not equal only one of the users has to change nick,
// otherwise both have to change
- const time_t localts = u->age;
+ const time_t localts = u->nickchanged;
if (remotets != localts)
{
/* first, let's see if ident@host matches. */
@@ -113,7 +113,7 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo
*/
CmdBuilder params("SAVE");
params.push(u->uuid);
- params.push(ConvToStr(u->age));
+ params.push(ConvToStr(u->nickchanged));
params.Broadcast();
u->ChangeNick(u->uuid, CommandSave::SavedTimestamp);
diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp
index a55f164dd..4dd2a45de 100644
--- a/src/modules/m_spanningtree/save.cpp
+++ b/src/modules/m_spanningtree/save.cpp
@@ -37,7 +37,7 @@ CmdResult CommandSave::Handle(User* user, Params& params)
return CmdResult::FAILURE;
time_t ts = ServerCommand::ExtractTS(params[1]);
- if (u->age == ts)
+ if (u->nickchanged == ts)
u->ChangeNick(u->uuid, SavedTimestamp);
return CmdResult::SUCCESS;
diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp
index 397ae0c39..0ad393796 100644
--- a/src/modules/m_spanningtree/svsnick.cpp
+++ b/src/modules/m_spanningtree/svsnick.cpp
@@ -52,7 +52,7 @@ CmdResult CommandSVSNick::Handle(User* user, Params& parameters)
if (parameters.size() > 3)
{
time_t ExpectedTS = ServerCommand::ExtractTS(parameters[3]);
- if (u->age != ExpectedTS)
+ if (u->nickchanged != ExpectedTS)
return CmdResult::FAILURE; // Ignore SVSNICK
}
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index b954b5a8c..84dae98ef 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -33,10 +33,10 @@
CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params& params)
{
/**
- * 0 1 2 3 4 5 6 7 8 9 (n-1)
- * UID uuid age nick host dhost ident ip.string signon +modes (modepara) :real
+ * 0 1 2 3 4 5 6 7 8 9 (n-1)
+ * UID uuid nickchanged nick host dhost ident ip.string signon +modes (modepara) :real
*/
- time_t age_ts = ServerCommand::ExtractTS(params[1]);
+ time_t nickchanged = ServerCommand::ExtractTS(params[1]);
time_t signon = ServerCommand::ExtractTS(params[7]);
const std::string& modestr = params[8];
@@ -59,12 +59,12 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params
else if (collideswith)
{
// The user on this side is registered, handle the collision
- bool they_change = Utils->DoCollision(collideswith, remoteserver, age_ts, params[5], params[6], params[0], "UID");
+ bool they_change = Utils->DoCollision(collideswith, remoteserver, nickchanged, params[5], params[6], params[0], "UID");
if (they_change)
{
// The client being introduced needs to change nick to uuid, change the nick in the message before
// processing/forwarding it. Also change the nick TS to CommandSave::SavedTimestamp.
- age_ts = CommandSave::SavedTimestamp;
+ nickchanged = CommandSave::SavedTimestamp;
params[1] = ConvToStr(CommandSave::SavedTimestamp);
params[2] = params[0];
}
@@ -87,7 +87,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params
_new->ChangeRealName(params.back());
_new->registered = REG_ALL;
_new->signon = signon;
- _new->age = age_ts;
+ _new->nickchanged = nickchanged;
size_t paramptr = 9;
for (const auto& modechr : modestr)
@@ -171,7 +171,7 @@ CommandUID::Builder::Builder(User* user)
: CmdBuilder(TreeServer::Get(user), "UID")
{
push(user->uuid);
- push_int(user->age);
+ push_int(user->nickchanged);
push(user->nick);
push(user->GetRealHost());
push(user->GetDisplayedHost());
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 43331eb20..9f3010ad6 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -59,9 +59,9 @@ class CommandWatch final
{
// The away state should only be sent if the client requests away notifications for a nick but 2.0 always sends them so we do that too
if (target->IsAway())
- user->WriteNumeric(RPL_NOWISAWAY, target->nick, target->ident, target->GetDisplayedHost(), (unsigned long)target->awaytime, "is away");
+ user->WriteNumeric(RPL_NOWISAWAY, target->nick, target->ident, target->GetDisplayedHost(), target->awaytime, "is away");
else
- user->WriteNumeric(RPL_NOWON, target->nick, target->ident, target->GetDisplayedHost(), (unsigned long)target->age, "is online");
+ user->WriteNumeric(RPL_NOWON, target->nick, target->ident, target->GetDisplayedHost(), target->nickchanged, "is online");
}
else if (show_offline)
user->WriteNumeric(RPL_NOWOFF, nick, "*", "*", "0", "is offline");
@@ -94,7 +94,7 @@ class CommandWatch final
User* target = IRCv3::Monitor::Manager::FindNick(nick);
if (target)
- user->WriteNumeric(RPL_WATCHOFF, target->nick, target->ident, target->GetDisplayedHost(), (unsigned long)target->age, "stopped watching");
+ user->WriteNumeric(RPL_WATCHOFF, target->nick, target->ident, target->GetDisplayedHost(), target->nickchanged, "stopped watching");
else
user->WriteNumeric(RPL_WATCHOFF, nick, "*", "*", "0", "stopped watching");
}
@@ -198,12 +198,12 @@ private:
void Online(User* user)
{
- SendAlert(user, user->nick, RPL_LOGON, "arrived online", user->age);
+ SendAlert(user, user->nick, RPL_LOGON, "arrived online", user->nickchanged);
}
void Offline(User* user, const std::string& nick)
{
- SendAlert(user, nick, RPL_LOGOFF, "went offline", user->age);
+ SendAlert(user, nick, RPL_LOGOFF, "went offline", user->nickchanged);
}
public:
diff --git a/src/users.cpp b/src/users.cpp
index f4a090f58..f2a51a8f6 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -88,7 +88,7 @@ std::string User::GetModeLetters(bool includeparams) const
User::User(const std::string& uid, Server* srv, Type type)
: Extensible(ExtensionType::USER)
- , age(ServerInstance->Time())
+ , nickchanged(ServerInstance->Time())
, uuid(uid)
, server(srv)
, registered(REG_NONE)
@@ -640,7 +640,7 @@ bool User::ChangeNick(const std::string& newnick, time_t newts)
}
}
- age = newts ? newts : ServerInstance->Time();
+ nickchanged = newts ? newts : ServerInstance->Time();
}
if (this->registered == REG_ALL)