summaryrefslogtreecommitdiff
path: root/src/modules/m_satopic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_satopic.cpp')
-rw-r--r--src/modules/m_satopic.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp
index 4a6f85536..f45d9c8cd 100644
--- a/src/modules/m_satopic.cpp
+++ b/src/modules/m_satopic.cpp
@@ -26,7 +26,7 @@ class CommandSATopic : public Command
public:
CommandSATopic(Module* Creator) : Command(Creator,"SATOPIC", 2, 2)
{
- flags_needed = 'o'; Penalty = 0; syntax = "<target> <topic>";
+ flags_needed = 'o'; syntax = "<target> <topic>";
}
CmdResult Handle (const std::vector<std::string>& parameters, User *user)
@@ -38,15 +38,21 @@ 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;
}
else
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
}