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/coremods/core_channel/cmd_topic.cpp | |
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/coremods/core_channel/cmd_topic.cpp')
-rw-r--r-- | src/coremods/core_channel/cmd_topic.cpp | 8 |
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; } |