X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_satopic.cpp;h=8fe96bcf93e4f9effed1a2e313cd220c618bff60;hb=9c4cc196c073145d4ad2ae92fb2be2194cf621f4;hp=040d86b9a46b68cf1e9bf09b79d4d7043e7457c2;hpb=da29af8cba49d51e53d6e68237ccbf6370b6dd1f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 040d86b9a..8fe96bcf9 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -26,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(const std::vector& parameters, User* user) CXX11_OVERRIDE { /* * Handles a SATOPIC request. Notifies all +s users. @@ -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(Numerics::NoSuchNick(parameters[0])); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); return CMD_FAILURE; } }