*/
-/* $ModDesc: Provides a SATOPIC command */
-
#include "inspircd.h"
/** Handle /SATOPIC
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)
+ CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE
{
/*
* Handles a SATOPIC request. Notifies all +s users.
if(target)
{
- std::string newTopic = parameters[1];
+ 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;
+ }
- // 3rd parameter overrides access checks
- target->SetTopic(user, newTopic, true);
- ServerInstance->SNO->WriteToSnoMask('a', user->nick + " used SATOPIC on " + target->name + ", new topic: " + newTopic);
- ServerInstance->PI->SendSNONotice("A", user->nick + " used SATOPIC on " + target->name + ", new topic: " + newTopic);
+ 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(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchChannel(parameters[0]));
return CMD_FAILURE;
}
}
public:
ModuleSATopic()
: cmd(this)
- {
- ServerInstance->AddCommand(&cmd);
- }
-
- virtual ~ModuleSATopic()
{
}
- virtual Version GetVersion()
+ Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides a SATOPIC command", VF_VENDOR);
}