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/modules/m_satopic.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/modules/m_satopic.cpp')
-rw-r--r-- | src/modules/m_satopic.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 040d86b9a..f966d6a5a 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -38,8 +38,14 @@ class CommandSATopic : public Command if(target) { - const std::string& newTopic = parameters[1]; - target->SetTopic(user, newTopic); + const std::string newTopic(parameters[1], 0, ServerInstance->Config->Limits.MaxTopic); + if (target->topic == newTopic) + { + user->WriteNotice(InspIRCd::Format("The topic on %s is already what you are trying to change it to.", target->name.c_str())); + return CMD_SUCCESS; + } + + target->SetTopic(user, newTopic, ServerInstance->Time(), NULL); ServerInstance->SNO->WriteGlobalSno('a', user->nick + " used SATOPIC on " + target->name + ", new topic: " + newTopic); return CMD_SUCCESS; |