X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_satopic.cpp;h=dc1e954887313a7a158e946ddde4c5b39f1810ac;hb=e59cb85871f75b7603c63c6cd274d57536cf6794;hp=bf65cc5d5e9ab2a1e61b0c1380b19e3e091d1ee8;hpb=fcacc8e0306382bc3f938073092c3729d77e2b41;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index bf65cc5d5..dc1e95488 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -17,8 +17,6 @@ */ -/* $ModDesc: Provides a SATOPIC command */ - #include "inspircd.h" /** Handle /SATOPIC @@ -28,10 +26,10 @@ class CommandSATopic : public Command public: CommandSATopic(Module* Creator) : Command(Creator,"SATOPIC", 2, 2) { - flags_needed = 'o'; Penalty = 0; syntax = " "; + flags_needed = 'o'; syntax = " :"; } - CmdResult Handle (const std::vector& parameters, User *user) + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE { /* * Handles a SATOPIC request. Notifies all +s users. @@ -40,18 +38,21 @@ class CommandSATopic : public Command 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; } } @@ -63,17 +64,12 @@ class ModuleSATopic : public Module public: ModuleSATopic() : cmd(this) - { - ServerInstance->AddCommand(&cmd); - } - - virtual ~ModuleSATopic() { } - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { - return Version("Provides a SATOPIC command", VF_VENDOR); + return Version("Provides the SATOPIC command", VF_VENDOR); } };