summaryrefslogtreecommitdiff
path: root/src/commands/cmd_topic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/cmd_topic.cpp')
-rw-r--r--src/commands/cmd_topic.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp
index 38982a7a2..25daea142 100644
--- a/src/commands/cmd_topic.cpp
+++ b/src/commands/cmd_topic.cpp
@@ -64,23 +64,20 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
if (parameters.size() == 1)
{
- if (c)
+ if ((c->IsModeSet(secretmode)) && (!c->HasUser(user)))
{
- if ((c->IsModeSet(secretmode)) && (!c->HasUser(user)))
- {
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str());
- return CMD_FAILURE;
- }
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str());
+ return CMD_FAILURE;
+ }
- 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);
- }
- else
- {
- user->WriteNumeric(RPL_NOTOPICSET, "%s :No topic is set.", c->name.c_str());
- }
+ 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);
+ }
+ else
+ {
+ user->WriteNumeric(RPL_NOTOPICSET, "%s :No topic is set.", c->name.c_str());
}
return CMD_SUCCESS;
}