]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_channel/cmd_topic.cpp
Refactor topic setting logic to go through Channel::SetTopic() in all cases
[user/henk/code/inspircd.git] / src / coremods / core_channel / cmd_topic.cpp
index b421489399953867c169af5712d60a418d5e9d05..6d99edcc6eeb1176880312bf2d7b0ee6cd3c21e5 100644 (file)
@@ -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;
 }