X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_topiclock.cpp;h=340fbfdec86655a96f9983015d586041032583f0;hb=c0aba5b728b0a921d95ec120aa638dab1520b42f;hp=42ed6e4c1ced14aa3606be15b009a08e77ee77eb;hpb=3a3ff949670c61a4a8856e1391222e156eb1cd17;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp index 42ed6e4c1..340fbfdec 100644 --- a/src/modules/m_topiclock.cpp +++ b/src/modules/m_topiclock.cpp @@ -49,32 +49,13 @@ class CommandSVSTOPIC : public Command return CMD_INVALID; } - std::string newtopic; - newtopic.assign(parameters[3], 0, ServerInstance->Config->Limits.MaxTopic); - bool topics_differ = (chan->topic != newtopic); - if ((topics_differ) || (chan->topicset != topicts) || (chan->setby != parameters[2])) - { - // Update when any parameter differs - chan->topicset = topicts; - chan->setby.assign(parameters[2], 0, 127); - chan->topic = newtopic; - // Send TOPIC to clients only if the actual topic has changed, be silent otherwise - if (topics_differ) - chan->WriteChannel(user, "TOPIC %s :%s", chan->name.c_str(), chan->topic.c_str()); - } + chan->SetTopic(user, parameters[3], topicts, ¶meters[2]); } else { // 1 parameter version, nuke the topic - bool topic_empty = chan->topic.empty(); - if (!topic_empty || !chan->setby.empty()) - { - chan->topicset = 0; - chan->setby.clear(); - chan->topic.clear(); - if (!topic_empty) - chan->WriteChannel(user, "TOPIC %s :", chan->name.c_str()); - } + chan->SetTopic(user, std::string(), 0); + chan->setby.clear(); } return CMD_SUCCESS; @@ -90,7 +71,7 @@ class FlagExtItem : public ExtensionItem { public: FlagExtItem(const std::string& key, Module* owner) - : ExtensionItem(key, owner) + : ExtensionItem(key, ExtensionItem::EXT_CHANNEL, owner) { } @@ -150,7 +131,7 @@ class ModuleTopicLock : public Module // Only fired for local users currently, but added a check anyway if ((IS_LOCAL(user)) && (topiclock.get(chan))) { - user->WriteNumeric(744, "%s :TOPIC cannot be changed due to topic lock being active on the channel", chan->name.c_str()); + user->WriteNumeric(744, chan->name, "TOPIC cannot be changed due to topic lock being active on the channel"); return MOD_RES_DENY; }