X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_satopic.cpp;h=f966d6a5ad16bb8f69f8f8976a578e2829146559;hb=3b78613576364c4ac6a4e4af43a2eea056c8dd3f;hp=a0e3319af25d95d44e7df7e1143748b07823c1af;hpb=74ee9af96639323d852a8b15be72ee9974e0a826;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index a0e3319af..f966d6a5a 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 @@ -40,17 +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); + 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::NoSuchNick(parameters[0])); return CMD_FAILURE; } } @@ -62,15 +64,10 @@ 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); }