summaryrefslogtreecommitdiff
path: root/modules/commands/cs_topic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands/cs_topic.cpp')
-rw-r--r--modules/commands/cs_topic.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp
index bc5b9c000..1506bcc9c 100644
--- a/modules/commands/cs_topic.cpp
+++ b/modules/commands/cs_topic.cpp
@@ -114,10 +114,8 @@ class CommandCSTopic : public Command
source.Reply(_("Topic lock option for %s is now \002off\002."), ci->name.c_str());
}
- void Set(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+ void Set(CommandSource &source, ChannelInfo *ci, const Anope::string &topic)
{
- const Anope::string &topic = params.size() > 2 ? params[2] : "";
-
bool has_topiclock = topiclock->HasExt(ci);
topiclock->Unset(ci);
ci->c->ChangeTopic(source.GetNick(), topic, Anope::CurTime);
@@ -141,12 +139,7 @@ class CommandCSTopic : public Command
else
new_topic = topic;
- std::vector<Anope::string> new_params;
- new_params.push_back("SET");
- new_params.push_back(ci->name);
- new_params.push_back(new_topic);
-
- this->Set(source, ci, new_params);
+ this->Set(source, ci, new_topic);
}
public:
@@ -154,7 +147,7 @@ class CommandCSTopic : public Command
topiclock("TOPICLOCK")
{
this->SetDesc(_("Manipulate the topic of the specified channel"));
- this->SetSyntax(_("\037channel\037 SET [\037topic\037]"));
+ this->SetSyntax(_("\037channel\037 [SET] [\037topic\037]"));
this->SetSyntax(_("\037channel\037 APPEND \037topic\037"));
this->SetSyntax(_("\037channel\037 [UNLOCK|LOCK]"));
}
@@ -174,12 +167,23 @@ class CommandCSTopic : public Command
this->Unlock(source, ci, params);
else if (!ci->c)
source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str());
- else if (subcmd.equals_ci("SET"))
- this->Set(source, ci, params);
else if (subcmd.equals_ci("APPEND") && params.size() > 2)
this->Append(source, ci, params);
else
- this->SendSyntax(source);
+ {
+ Anope::string topic;
+ if (subcmd.equals_ci("SET"))
+ {
+ topic = params.size() > 2 ? params[2] : "";
+ }
+ else
+ {
+ topic = subcmd;
+ if (params.size() > 2)
+ topic += " " + params[2];
+ }
+ this->Set(source, ci, topic);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override