summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-02 22:16:35 -0400
committerAdam <Adam@anope.org>2012-10-02 22:16:35 -0400
commit87478187af9f6f670ebf679ce7cc6cc29b21f7af (patch)
tree52568515b06b380ee57813b904b98ca04ebdaeab
parent7042223f2eb486e8d1aec9fd176d416096a6e927 (diff)
Fix topiclock on inspircd
-rw-r--r--include/protocol.h2
-rw-r--r--modules/protocol/bahamut.cpp4
-rw-r--r--modules/protocol/inspircd-ts6.h9
-rw-r--r--modules/protocol/inspircd11.cpp4
-rw-r--r--modules/protocol/plexus.cpp4
-rw-r--r--modules/protocol/ratbox.cpp4
-rw-r--r--modules/protocol/unreal.cpp4
-rw-r--r--src/channels.cpp4
-rw-r--r--src/protocol.cpp4
9 files changed, 22 insertions, 17 deletions
diff --git a/include/protocol.h b/include/protocol.h
index d4ff79082..03b726848 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -67,7 +67,7 @@ class CoreExport IRCDProto
unsigned MaxModes;
virtual void SendSVSNOOP(const Server *, bool) { }
- virtual void SendTopic(BotInfo *, Channel *);
+ virtual void SendTopic(BotInfo *, Channel *, const Anope::string &, const Anope::string &, time_t &);
virtual void SendVhostDel(User *) { }
virtual void SendAkill(User *, XLine *) = 0;
virtual void SendAkillDel(const XLine *) = 0;
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 6f785b37e..31be87086 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -158,9 +158,9 @@ class BahamutIRCdProto : public IRCDProto
}
/* TOPIC */
- void SendTopic(BotInfo *whosets, Channel *c) anope_override
+ void SendTopic(BotInfo *bi, Channel *c, const Anope::string &topic, const Anope::string &setter, time_t &ts) anope_override
{
- UplinkSocket::Message(whosets) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time << " :" << c->topic;
+ UplinkSocket::Message(bi) << "TOPIC " << c->name << " " << setter << " " << ts << " :" << topic;
}
/* UNSQLINE */
diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h
index d011bf70b..bf545bd6c 100644
--- a/modules/protocol/inspircd-ts6.h
+++ b/modules/protocol/inspircd-ts6.h
@@ -92,9 +92,14 @@ class InspIRCdTS6Proto : public IRCDProto
UplinkSocket::Message(bi) << "GLINE " << x->Mask;
}
- void SendTopic(BotInfo *whosets, Channel *c) anope_override
+ void SendTopic(BotInfo *bi, Channel *c, const Anope::string &topic, const Anope::string &setter, time_t &ts) anope_override
{
- UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << c->topic_time << " " << c->topic_setter << " :" << c->topic;
+ /* Preferably we want to set the topic with a TS in the past (when re-setting the topic on channel creation etc)
+ * But if we have a previous topic and it is newer than the older TS we must bump the TS to now
+ */
+ if (c->topic_time > ts)
+ ts = Anope::CurTime;
+ UplinkSocket::Message(bi) << "FTOPIC " << c->name << " " << ts << " " << setter << " :" << topic;
}
void SendVhostDel(User *u) anope_override
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index 1eb385e4b..971528a7b 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -94,9 +94,9 @@ class InspIRCdProto : public IRCDProto
UplinkSocket::Message(findbot(Config->OperServ)) << "GLINE " << x->Mask;
}
- void SendTopic(BotInfo *whosets, Channel *c) anope_override
+ void SendTopic(BotInfo *bi, Channel *c, const Anope::string &topic, const Anope::string &setter, time_t &ts) anope_override
{
- UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << c->topic_time << " " << c->topic_setter <<" :" << c->topic;
+ UplinkSocket::Message(bi) << "FTOPIC " << c->name << " " << ts << " " << setter << " :" << topic;
}
void SendVhostDel(User *u) anope_override
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index f0b213eab..291c3c6eb 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -223,9 +223,9 @@ class PlexusProto : public IRCDProto
UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID();
}
- void SendTopic(BotInfo *bi, Channel *c) anope_override
+ void SendTopic(BotInfo *bi, Channel *c, const Anope::string &topic, const Anope::string &setter, time_t &ts) 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 << " " << setter << " " << ts << " :" << topic;
}
void SendChannel(Channel *c) anope_override
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index a6fc85675..fc6cd788e 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -197,7 +197,7 @@ class RatboxProto : public IRCDProto
return true;
}
- void SendTopic(BotInfo *bi, Channel *c) anope_override
+ void SendTopic(BotInfo *bi, Channel *c, const Anope::string &topic, const Anope::string &setter, time_t &ts) anope_override
{
bool needjoin = c->FindUser(bi) == NULL;
if (needjoin)
@@ -206,7 +206,7 @@ class RatboxProto : public IRCDProto
status.SetFlag(CMODE_OP);
bi->Join(c, &status);
}
- IRCDProto::SendTopic(bi, c);
+ IRCDProto::SendTopic(bi, c, topic, setter, ts);
if (needjoin)
bi->Part(c);
}
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index 186fc8563..3f1ee2263 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -57,9 +57,9 @@ class UnrealIRCdProto : public IRCDProto
UplinkSocket::Message() << "BD - G " << x->GetUser() << " " << x->GetHost() << " " << Config->OperServ;
}
- void SendTopic(BotInfo *whosets, Channel *c) anope_override
+ void SendTopic(BotInfo *bi, Channel *c, const Anope::string &topic, const Anope::string &setter, time_t &ts) anope_override
{
- UplinkSocket::Message(whosets) << ") " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic;
+ UplinkSocket::Message(bi) << "TOPIC " << c->name << " " << setter << " " << ts << " :" << 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..78709ed59 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -910,12 +910,12 @@ void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtop
{
User *u = finduser(user);
+ ircdproto->SendTopic(this->ci->WhoSends(), this, newtopic, u ? u->nick : user, ts);
+
this->topic = newtopic;
this->topic_setter = u ? u->nick : user;
this->topic_time = ts;
- ircdproto->SendTopic(this->ci->WhoSends(), this);
-
FOREACH_MOD(I_OnTopicUpdated, OnTopicUpdated(this, user, this->topic));
if (this->ci)
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 14fe249ed..6be9804c1 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -119,9 +119,9 @@ void IRCDProto::SendNumericInternal(int numeric, const Anope::string &dest, cons
UplinkSocket::Message(Me) << n << " " << dest << " " << buf;
}
-void IRCDProto::SendTopic(BotInfo *bi, Channel *c)
+void IRCDProto::SendTopic(BotInfo *bi, Channel *c, const Anope::string &topic, const Anope::string &, time_t &)
{
- UplinkSocket::Message(bi) << "TOPIC " << c->name << " :" << c->topic;
+ UplinkSocket::Message(bi) << "TOPIC " << c->name << " :" << topic;
}
void IRCDProto::SendSVSKill(const BotInfo *source, User *user, const char *fmt, ...)