mirror of
https://github.com/anope/anope.git
synced 2026-07-01 18:06:39 +02:00
Attempt #2 at silly topic ts thing, this is actually must cleaner
This commit is contained in:
+2
-1
@@ -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() */
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+7
-3
@@ -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)
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user