summaryrefslogtreecommitdiff
path: root/modules/commands/cs_topic.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-01-05 16:31:09 -0500
committerAdam <Adam@anope.org>2015-01-05 19:00:51 -0500
commitd79d8e2608e304760c42bdf87502e3bc51781b88 (patch)
tree179913b8b328f88d52d84c3453fceb28a2d63422 /modules/commands/cs_topic.cpp
parent8ab1c71d7dc7a0d47e5711dc72e3fc9c3ee850bb (diff)
parentc46ec39e5088119cd21f5f7e16e64e61a876ca20 (diff)
Merge branch '2.0' into 2.1
Conflicts: CMakeLists.txt include/modules.h include/serialize.h modules/commands/bs_assign.cpp modules/commands/bs_badwords.cpp modules/commands/bs_bot.cpp modules/commands/bs_control.cpp modules/commands/bs_kick.cpp modules/commands/cs_access.cpp modules/commands/cs_akick.cpp modules/commands/cs_drop.cpp modules/commands/cs_entrymsg.cpp modules/commands/cs_flags.cpp modules/commands/cs_info.cpp modules/commands/cs_invite.cpp modules/commands/cs_kick.cpp modules/commands/cs_mode.cpp modules/commands/cs_register.cpp modules/commands/cs_seen.cpp modules/commands/cs_set.cpp modules/commands/cs_suspend.cpp modules/commands/cs_topic.cpp modules/commands/cs_unban.cpp modules/commands/cs_xop.cpp modules/commands/hs_del.cpp modules/commands/hs_list.cpp modules/commands/hs_request.cpp modules/commands/ms_ignore.cpp modules/commands/ms_send.cpp modules/commands/ns_recover.cpp modules/commands/ns_register.cpp modules/commands/ns_suspend.cpp modules/commands/os_dns.cpp modules/commands/os_noop.cpp modules/commands/os_oper.cpp modules/commands/os_session.cpp modules/database/db_sql_live.cpp modules/encryption/enc_bcrypt.cpp modules/extra/m_ldap_authentication.cpp modules/extra/m_ldap_oper.cpp modules/fantasy.cpp modules/m_dnsbl.cpp modules/m_sasl.cpp modules/protocol/hybrid.cpp modules/protocol/inspircd20.cpp modules/protocol/unreal.cpp modules/pseudoclients/chanserv.cpp modules/pseudoclients/nickserv.cpp modules/webcpanel/pages/chanserv/access.cpp modules/webcpanel/webcpanel.cpp modules/webcpanel/webcpanel.h src/command.cpp src/messages.cpp src/modulemanager.cpp src/regchannel.cpp src/serialize.cpp
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 49a5a0043..9e8b3764a 100644
--- a/modules/commands/cs_topic.cpp
+++ b/modules/commands/cs_topic.cpp
@@ -115,10 +115,8 @@ class CommandCSTopic : public Command
source.Reply(_("Topic lock option for \002{0}\002 is now \002off\002."), ci->GetName());
}
- void Set(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
+ void Set(CommandSource &source, ChanServ::Channel *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);
@@ -142,12 +140,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->GetName());
- new_params.push_back(new_topic);
-
- this->Set(source, ci, new_params);
+ this->Set(source, ci, new_topic);
}
public:
@@ -155,7 +148,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]"));
}
@@ -176,12 +169,23 @@ class CommandCSTopic : public Command
this->Unlock(source, ci, params);
else if (!ci->c)
source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
- 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) override