diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-04-11 15:53:01 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-04-11 15:53:01 +0200 |
commit | 2706a993b3f8ee52e2728047fad6a56f7e3cf405 (patch) | |
tree | 30d99f78630372bbe630fcf47f2f32fc8891fbe9 /src/modules/m_spanningtree | |
parent | b25070bf5e9447533bf1a0555c6954740ca12340 (diff) |
Refactor topic setting logic to go through Channel::SetTopic() in all cases
- Pass topic set time and optionally the setter to SetTopic()
- Don't do anything if the topic is changed by a local user to what it is currently
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_spanningtree/ftopic.cpp | 14 |
2 files changed, 3 insertions, 20 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 74590adf8..40ba5e893 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -278,14 +278,9 @@ void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname) // Unset all extensions chan->FreeAllExtItems(); - // Clear the topic, if it isn't empty then send a topic change message to local users - if (!chan->topic.empty()) - { - chan->topic.clear(); - chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "TOPIC %s :", chan->name.c_str()); - } + // Clear the topic + chan->SetTopic(ServerInstance->FakeClient, std::string(), 0); chan->setby.clear(); - chan->topicset = 0; } CommandFJoin::Builder::Builder(Channel* chan, TreeServer* source) diff --git a/src/modules/m_spanningtree/ftopic.cpp b/src/modules/m_spanningtree/ftopic.cpp index 3c76c928a..de72d162a 100644 --- a/src/modules/m_spanningtree/ftopic.cpp +++ b/src/modules/m_spanningtree/ftopic.cpp @@ -63,19 +63,7 @@ CmdResult CommandFTopic::Handle(User* user, std::vector<std::string>& params) return CMD_FAILURE; } - if (c->topic != newtopic) - { - // Update topic only when it differs from current topic - c->topic.assign(newtopic, 0, ServerInstance->Config->Limits.MaxTopic); - c->WriteChannel(user, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str()); - } - - // Update setter and settime - c->setby.assign(setter, 0, 128); - c->topicset = ts; - - FOREACH_MOD(OnPostTopicChange, (user, c, c->topic)); - + c->SetTopic(user, newtopic, ts, &setter); return CMD_SUCCESS; } |