X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcoremods%2Fcore_channel%2Fcmd_topic.cpp;h=8d65d764a1a7aac3e75854cf3723d4134a8bb0bf;hb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;hp=2b0f81fb68077dea2d084809373f90cd75ca0404;hpb=c67d3103e9f7397f0ab9631bf07a5e5547deb2c3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_channel/cmd_topic.cpp b/src/coremods/core_channel/cmd_topic.cpp index 2b0f81fb6..8d65d764a 100644 --- a/src/coremods/core_channel/cmd_topic.cpp +++ b/src/coremods/core_channel/cmd_topic.cpp @@ -21,33 +21,16 @@ #include "inspircd.h" +#include "core_channel.h" -/** Handle /TOPIC. - */ -class CommandTopic : public SplitCommand +CommandTopic::CommandTopic(Module* parent) + : SplitCommand(parent, "TOPIC", 1, 2) + , secretmode(parent, "secret") + , topiclockmode(parent, "topiclock") { - ChanModeReference secretmode; - ChanModeReference topiclockmode; - - public: - /** Constructor for topic. - */ - CommandTopic(Module* parent) - : SplitCommand(parent, "TOPIC", 1, 2) - , secretmode(parent, "secret") - , topiclockmode(parent, "topiclock") - { - syntax = " []"; - Penalty = 2; - } - - /** Handle command. - * @param parameters The parameters to the command - * @param user The user issuing the command - * @return A value from CmdResult to indicate command success or failure. - */ - CmdResult HandleLocal(const std::vector& parameters, LocalUser* user); -}; + syntax = " []"; + Penalty = 2; +} CmdResult CommandTopic::HandleLocal(const std::vector& parameters, LocalUser* user) { @@ -68,8 +51,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, if (c->topic.length()) { - user->WriteNumeric(RPL_TOPIC, "%s :%s", c->name.c_str(), c->topic.c_str()); - user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset); + Topic::ShowTopic(user, c); } else { @@ -102,5 +84,8 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, return CMD_SUCCESS; } - -COMMAND_INIT(CommandTopic) +void Topic::ShowTopic(LocalUser* user, Channel* chan) +{ + user->WriteNumeric(RPL_TOPIC, "%s :%s", chan->name.c_str(), chan->topic.c_str()); + user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", chan->name.c_str(), chan->setby.c_str(), (unsigned long)chan->topicset); +}