summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-05-16 16:36:12 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-05-16 16:36:12 +0200
commit9fc261d4cdfccacd53ab815539a93b23f3b75d73 (patch)
treeacdf91d893447acff65d92138d2850de71ed60f0 /src
parent6d5169671560a20cf0ae11300766e6de073f5b7b (diff)
cmd_topic Extract code sending RPL_TOPIC and RPL_TOPICTIME into a function
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_channel/cmd_topic.cpp9
-rw-r--r--src/coremods/core_channel/core_channel.h5
2 files changed, 12 insertions, 2 deletions
diff --git a/src/coremods/core_channel/cmd_topic.cpp b/src/coremods/core_channel/cmd_topic.cpp
index ea723c024..8d65d764a 100644
--- a/src/coremods/core_channel/cmd_topic.cpp
+++ b/src/coremods/core_channel/cmd_topic.cpp
@@ -51,8 +51,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& 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
{
@@ -84,3 +83,9 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
c->SetTopic(user, t);
return CMD_SUCCESS;
}
+
+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);
+}
diff --git a/src/coremods/core_channel/core_channel.h b/src/coremods/core_channel/core_channel.h
index d3adbc9c9..f3efa3d67 100644
--- a/src/coremods/core_channel/core_channel.h
+++ b/src/coremods/core_channel/core_channel.h
@@ -21,6 +21,11 @@
#include "inspircd.h"
+namespace Topic
+{
+ void ShowTopic(LocalUser* user, Channel* chan);
+}
+
/** Handle /INVITE.
*/
class CommandInvite : public Command