summaryrefslogtreecommitdiff
path: root/src/coremods/core_channel/cmd_topic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/coremods/core_channel/cmd_topic.cpp')
-rw-r--r--src/coremods/core_channel/cmd_topic.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/coremods/core_channel/cmd_topic.cpp b/src/coremods/core_channel/cmd_topic.cpp
index b42148939..6d99edcc6 100644
--- a/src/coremods/core_channel/cmd_topic.cpp
+++ b/src/coremods/core_channel/cmd_topic.cpp
@@ -80,7 +80,13 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
}
}
- c->SetTopic(user, t);
+ // Make sure the topic is not longer than the limit in the config
+ if (t.length() > ServerInstance->Config->Limits.MaxTopic)
+ t.erase(ServerInstance->Config->Limits.MaxTopic);
+
+ // Only change if the new topic is different than the current one
+ if (c->topic != t)
+ c->SetTopic(user, t, ServerInstance->Time());
return CMD_SUCCESS;
}