diff options
-rw-r--r-- | include/users.h | 8 | ||||
-rw-r--r-- | modules/commands/ns_register.cpp | 2 | ||||
-rw-r--r-- | modules/extra/m_xmlrpc_main.cpp | 2 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 5 | ||||
-rw-r--r-- | modules/protocol/inspircd-ts6.h | 2 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 1 | ||||
-rw-r--r-- | modules/pseudoclients/nickserv.cpp | 2 | ||||
-rw-r--r-- | src/messages.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 9 |
9 files changed, 17 insertions, 16 deletions
diff --git a/include/users.h b/include/users.h index 502cc0a7c..8757778b3 100644 --- a/include/users.h +++ b/include/users.h @@ -60,8 +60,8 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe Anope::string fingerprint; /* SSL Fingerprint */ Anope::string ip; /* User's IP */ Server *server; /* Server user is connected to */ - time_t timestamp; /* Timestamp of the nick */ - time_t my_signon; /* When did _we_ see the user? */ + time_t signon; /* When the user signed on. Set on connect and never modified. */ + time_t timestamp; /* Timestamp of the nick. Updated when the nick changes. */ bool SuperAdmin; /* is SuperAdmin on or off? */ /* Channels the user is in */ @@ -98,8 +98,10 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe /** Update the nickname of a user record accordingly, should be * called from ircd protocol. + * @param newnick The new username + * @param ts The time the nick was changed, User::timestamp will be updated to this. */ - void ChangeNick(const Anope::string &newnick); + void ChangeNick(const Anope::string &newnick, time_t ts = Anope::CurTime); /** Update the displayed (vhost) of a user record. * This is used (if set) instead of real host. diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index 4253b672b..f7675ca60 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -130,7 +130,7 @@ class CommandNSRegister : public Command return; } - if (u && !u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay) + if (u && !u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->timestamp < Config->NickRegDelay) { source.Reply(_("You must have been using this nick for at least %d seconds to register."), Config->NickRegDelay); return; diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp index 94b655ad7..f3ed81d4d 100644 --- a/modules/extra/m_xmlrpc_main.cpp +++ b/modules/extra/m_xmlrpc_main.cpp @@ -202,7 +202,7 @@ class MyXMLRPCEvent : public XMLRPCEvent if (!u->ip.empty()) request->reply("ip", u->ip); request->reply("timestamp", stringify(u->timestamp)); - request->reply("signon", stringify(u->my_signon)); + request->reply("signon", stringify(u->signon)); if (u->Account()) { request->reply("account", iface->Sanitize(u->Account()->display)); diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 87388f0b3..74f0ee51e 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -352,7 +352,7 @@ struct IRCDMessageNick : IRCDMessage /* :0MCAAAAAB NICK newnick 1350157102 */ bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { - source.GetUser()->ChangeNick(params[0]); + source.GetUser()->ChangeNick(params[0], convertTo<time_t>(params[1])); return true; } }; @@ -511,7 +511,7 @@ struct IRCDMessageSjoin : IRCDMessage * Don't trigger OnJoinChannel event then as the user will be destroyed */ if (MOD_RESULT != EVENT_STOP && c->ci && c->ci->CheckKick(u)) - continue; + continue; FOREACH_MOD(I_OnJoinChannel, OnJoinChannel(u, c)); } @@ -627,6 +627,7 @@ class ProtoHybrid : public Module CoreIRCDMessageTime core_message_time; CoreIRCDMessageTopic core_message_topic; CoreIRCDMessageVersion core_message_version; + CoreIRCDMessageWhois core_message_whois; /* Our message handlers */ IRCDMessageBMask message_bmask; diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index 38dd7e15e..b3d3a7a36 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -203,7 +203,7 @@ class InspIRCdTS6Proto : public IRCDProto void SendClientIntroduction(const User *u) anope_override { Anope::string modes = "+" + u->GetModes(); - UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->my_signon << " " << modes << " :" << u->realname; + UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->timestamp << " " << modes << " :" << u->realname; } /* SERVER services-dev.chatspike.net password 0 :Description here */ diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 793347da6..4acf5e79a 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -561,6 +561,7 @@ class ProtoRatbox : public Module CoreIRCDMessageTime core_message_time; CoreIRCDMessageTopic core_message_topic; CoreIRCDMessageVersion core_message_version; + CoreIRCDMessageWhois core_message_whois; /* Our message handlers */ IRCDMessageBMask message_bmask; diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp index caffd74d4..4115ee9b0 100644 --- a/modules/pseudoclients/nickserv.cpp +++ b/modules/pseudoclients/nickserv.cpp @@ -61,7 +61,7 @@ class NickServCollide : public Timer return; /* If they identified or don't exist anymore, don't kill them. */ NickAlias *na = findnick(u->nick); - if (!na || u->Account() == na->nc || u->my_signon > this->GetSetTime()) + if (!na || u->Account() == na->nc || u->timestamp > this->GetSetTime()) return; u->Collide(na); diff --git a/src/messages.cpp b/src/messages.cpp index ad3ef661e..ee5716dc2 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -388,7 +388,7 @@ bool CoreIRCDMessageWhois::Run(MessageSource &source, const std::vector<Anope::s ircdproto->SendNumeric(307, source.GetSource(), "%s :is a registered nick", bi->nick.c_str()); ircdproto->SendNumeric(312, source.GetSource(), "%s %s :%s", u->nick.c_str(), Config->ServerName.c_str(), Config->ServerDesc.c_str()); if (bi) - ircdproto->SendNumeric(317, source.GetSource(), "%s %ld %ld :seconds idle, signon time", bi->nick.c_str(), static_cast<long>(Anope::CurTime - bi->lastmsg), static_cast<long>(start_time)); + ircdproto->SendNumeric(317, source.GetSource(), "%s %ld %ld :seconds idle, signon time", bi->nick.c_str(), static_cast<long>(Anope::CurTime - bi->lastmsg), static_cast<long>(bi->signon)); ircdproto->SendNumeric(318, source.GetSource(), "%s :End of /WHOIS list.", params[0].c_str()); } else diff --git a/src/users.cpp b/src/users.cpp index 28b2c413c..fac00d723 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -41,7 +41,6 @@ User::User(const Anope::string &snick, const Anope::string &sident, const Anope: server = NULL; invalid_pw_count = invalid_pw_time = lastmemosend = lastnickreg = lastmail = 0; OnAccess = false; - timestamp = my_signon = Anope::CurTime; this->nick = snick; this->ident = sident; @@ -52,7 +51,7 @@ User::User(const Anope::string &snick, const Anope::string &sident, const Anope: this->ip = sip; this->server = sserver; this->realname = srealname; - this->timestamp = ssignon; + this->timestamp = this->signon = ssignon; this->SetModesInternal("%s", smodes.c_str()); this->uid = suid; this->SuperAdmin = false; @@ -84,7 +83,7 @@ User::User(const Anope::string &snick, const Anope::string &sident, const Anope: FOREACH_MOD(I_OnUserConnect, OnUserConnect(user, exempt)); } -void User::ChangeNick(const Anope::string &newnick) +void User::ChangeNick(const Anope::string &newnick, time_t ts) { /* Sanity check to make sure we don't segfault */ if (newnick.empty()) @@ -94,14 +93,12 @@ void User::ChangeNick(const Anope::string &newnick) Log(this, "nick") << "(" << this->realname << ") changed nick to " << newnick; Anope::string old = this->nick; + this->timestamp = ts; if (this->nick.equals_ci(newnick)) this->nick = newnick; else { - /* Update this only if nicks aren't the same */ - this->my_signon = Anope::CurTime; - NickAlias *old_na = findnick(this->nick); if (old_na && (this->IsIdentified(true) || this->IsRecognized())) old_na->last_seen = Anope::CurTime; |