aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_spanningtree/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree/main.cpp')
-rw-r--r--src/modules/m_spanningtree/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 56cc78cd2..6bf9e8044 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -365,6 +365,18 @@ void ModuleSpanningTree::OnUserInvite(User* source, User* dest, Channel* channel
}
}
+ModResult ModuleSpanningTree::OnPreTopicChange(User* user, Channel* chan, const std::string& topic)
+{
+ // XXX: Deny topic changes if the current topic set time is the current time or is in the future because
+ // other servers will drop our FTOPIC. This restriction will be removed when the protocol is updated.
+ if ((chan->topicset >= ServerInstance->Time()) && (Utils->serverlist.size() > 1))
+ {
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, "Retry topic change later");
+ return MOD_RES_DENY;
+ }
+ return MOD_RES_PASSTHRU;
+}
+
void ModuleSpanningTree::OnPostTopicChange(User* user, Channel* chan, const std::string &topic)
{
// Drop remote events on the floor.
@@ -762,6 +774,7 @@ Version ModuleSpanningTree::GetVersion()
void ModuleSpanningTree::Prioritize()
{
ServerInstance->Modules->SetPriority(this, PRIORITY_LAST);
+ ServerInstance->Modules.SetPriority(this, I_OnPreTopicChange, PRIORITY_FIRST);
}
MODULE_INIT(ModuleSpanningTree)