diff options
-rw-r--r-- | include/channels.h | 3 | ||||
-rw-r--r-- | modules/extra/m_xmlrpc_main.cpp | 1 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 2 | ||||
-rw-r--r-- | modules/protocol/inspircd-ts6.h | 7 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 2 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 2 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 2 | ||||
-rw-r--r-- | src/channels.cpp | 10 | ||||
-rw-r--r-- | src/regchannel.cpp | 2 |
9 files changed, 21 insertions, 10 deletions
diff --git a/include/channels.h b/include/channels.h index 7dee744c2..2c2fbb66d 100644 --- a/include/channels.h +++ b/include/channels.h @@ -69,7 +69,8 @@ class CoreExport Channel : public virtual Base, public Extensible, public Flags< Anope::string topic; /* Current topic of the channel */ Anope::string topic_setter; /* Who set the topic */ - time_t topic_time; /* When the topic was set*/ + time_t topic_ts; /* The timestamp associated with the topic. Not necessarually anywhere close to Anope::CurTime */ + time_t topic_time; /* The actual time the topic was set, probably close to Anope::CurTime */ time_t server_modetime; /* Time of last server MODE */ time_t chanserv_modetime; /* Time of last check_modes() */ diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp index da2d09f22..dc12d565e 100644 --- a/modules/extra/m_xmlrpc_main.cpp +++ b/modules/extra/m_xmlrpc_main.cpp @@ -161,6 +161,7 @@ class MyXMLRPCEvent : public XMLRPCEvent request->reply("topicsetter", iface->Sanitize(c->topic_setter)); request->reply("topictime", stringify(c->topic_time)); + request->reply("topicts", stringify(c->topic_ts)); } } diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 6f785b37e..d4d7b7703 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -160,7 +160,7 @@ class BahamutIRCdProto : public IRCDProto /* TOPIC */ void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time << " :" << c->topic; + UplinkSocket::Message(whosets) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } /* UNSQLINE */ diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index d011bf70b..37e4b1b48 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -94,7 +94,12 @@ class InspIRCdTS6Proto : public IRCDProto void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << c->topic_time << " " << c->topic_setter << " :" << c->topic; + /* If the last time a topic was set is after the TS we want for this topic we must bump this topic's timestamp to now */ + time_t ts = c->topic_ts; + if (c->topic_time > ts) + ts = Anope::CurTime; + /* But don't modify c->topic_ts, it should remain set to the real TS we want as ci->last_topic_time pulls from it */ + UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << ts << " " << c->topic_setter << " :" << c->topic; } void SendVhostDel(User *u) anope_override diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index 1eb385e4b..3a3463ff8 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -96,7 +96,7 @@ class InspIRCdProto : public IRCDProto void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << c->topic_time << " " << c->topic_setter <<" :" << c->topic; + UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << c->topic_time << " " << c->topic_ts <<" :" << c->topic; } void SendVhostDel(User *u) anope_override diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index f0b213eab..2444d3569 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -225,7 +225,7 @@ class PlexusProto : public IRCDProto void SendTopic(BotInfo *bi, Channel *c) anope_override { - UplinkSocket::Message(bi) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic; + UplinkSocket::Message(bi) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } void SendChannel(Channel *c) anope_override diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 186fc8563..edfe203ac 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -59,7 +59,7 @@ class UnrealIRCdProto : public IRCDProto void SendTopic(BotInfo *whosets, Channel *c) anope_override { - UplinkSocket::Message(whosets) << ") " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic; + UplinkSocket::Message(whosets) << ") " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override diff --git a/src/channels.cpp b/src/channels.cpp index c95e46373..be3915b46 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -41,7 +41,7 @@ Channel::Channel(const Anope::string &nname, time_t ts) : Flags<ChannelFlag, 3>( this->creation_time = ts; this->server_modetime = this->chanserv_modetime = 0; - this->server_modecount = this->chanserv_modecount = this->bouncy_modes = this->topic_time = 0; + this->server_modecount = this->chanserv_modecount = this->bouncy_modes = this->topic_ts = this->topic_time = 0; this->ci = cs_findchan(this->name); if (this->ci) @@ -896,7 +896,8 @@ void Channel::ChangeTopicInternal(const Anope::string &user, const Anope::string this->topic = newtopic; this->topic_setter = u ? u->nick : user; - this->topic_time = ts; + this->topic_ts = ts; + this->topic_time = Anope::CurTime; Log(LOG_DEBUG) << "Topic of " << this->name << " changed by " << (u ? u->nick : user) << " to " << newtopic; @@ -912,10 +913,13 @@ void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtop this->topic = newtopic; this->topic_setter = u ? u->nick : user; - this->topic_time = ts; + this->topic_ts = ts; ircdproto->SendTopic(this->ci->WhoSends(), this); + /* Now that the topic is set update the time set. This is *after* we set it so the protocol modules are able to tell the old last set time */ + this->topic_time = Anope::CurTime; + FOREACH_MOD(I_OnTopicUpdated, OnTopicUpdated(this, user, this->topic)); if (this->ci) diff --git a/src/regchannel.cpp b/src/regchannel.cpp index e0f371117..1e0014454 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -1134,7 +1134,7 @@ void ChannelInfo::CheckTopic() { this->last_topic = this->c->topic; this->last_topic_setter = this->c->topic_setter; - this->last_topic_time = this->c->topic_time; + this->last_topic_time = this->c->topic_ts; } } |