summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/main.cpp13
-rw-r--r--src/modules/m_spanningtree/main.h1
2 files changed, 14 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)
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index e1c0932b4..46c21b4e9 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -145,6 +145,7 @@ class ModuleSpanningTree : public Module
void OnPostCommand(Command*, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line) CXX11_OVERRIDE;
void OnUserConnect(LocalUser* source) CXX11_OVERRIDE;
void OnUserInvite(User* source, User* dest, Channel* channel, time_t timeout, unsigned int notifyrank, CUList& notifyexcepts) CXX11_OVERRIDE;
+ ModResult OnPreTopicChange(User* user, Channel* chan, const std::string& topic) CXX11_OVERRIDE;
void OnPostTopicChange(User* user, Channel* chan, const std::string &topic) CXX11_OVERRIDE;
void OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE;
void OnBackgroundTimer(time_t curtime) CXX11_OVERRIDE;