diff options
author | Adam <Adam@anope.org> | 2011-07-14 18:29:03 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-07-14 18:29:03 -0400 |
commit | 5bf7dee559dd576b454537aec439c56c75e556dc (patch) | |
tree | 8e2c3be4306f1c3a62f61894b58a55990cbf0989 | |
parent | f858164deed48f2dcacd5ffc06a55398a54da7e8 (diff) |
Made channel descriptions optional
-rw-r--r-- | modules/core/cs_info.cpp | 3 | ||||
-rw-r--r-- | modules/core/cs_register.cpp | 11 | ||||
-rw-r--r-- | modules/core/cs_set_description.cpp | 17 |
3 files changed, 20 insertions, 11 deletions
diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp index 17960cb67..23303224f 100644 --- a/modules/core/cs_info.cpp +++ b/modules/core/cs_info.cpp @@ -60,7 +60,8 @@ class CommandCSInfo : public Command if (show_all && ci->successor) source.Reply(_(" Successor: %s"), ci->successor->display.c_str()); - source.Reply(_(" Description: %s"), ci->desc.c_str()); + if (!ci->desc.empty()) + source.Reply(_(" Description: %s"), ci->desc.c_str()); source.Reply(_(" Registered: %s"), do_strftime(ci->time_registered).c_str()); source.Reply(_(" Last used: %s"), do_strftime(ci->last_used).c_str()); diff --git a/modules/core/cs_register.cpp b/modules/core/cs_register.cpp index 599f88790..7f08828fc 100644 --- a/modules/core/cs_register.cpp +++ b/modules/core/cs_register.cpp @@ -16,16 +16,16 @@ class CommandCSRegister : public Command { public: - CommandCSRegister(Module *creator) : Command(creator, "chanserv/register", 2, 2) + CommandCSRegister(Module *creator) : Command(creator, "chanserv/register", 1, 2) { this->SetDesc(_("Register a channel")); - this->SetSyntax(_("\037channel\037 \037description\037")); + this->SetSyntax(_("\037channel\037 [\037description\037]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { const Anope::string &chan = params[0]; - const Anope::string &chdesc = params[1]; + const Anope::string &chdesc = params.size() > 1 ? params[1] : ""; User *u = source.u; Channel *c = findchan(params[0]); @@ -51,7 +51,8 @@ class CommandCSRegister : public Command { ci = new ChannelInfo(chan); ci->SetFounder(u->Account()); - ci->desc = chdesc; + if (!chdesc.empty()) + ci->desc = chdesc; if (c && !c->topic.empty()) { @@ -101,7 +102,7 @@ class CommandCSRegister : public Command source.Reply(_("Registers a channel in the %s database. In order\n" "to use this command, you must first be a channel operator\n" "on the channel you're trying to register.\n" - "The description, which \002must\002 be included, is a\n" + "The description, which is optional, is a\n" "general description of the channel's purpose.\n" " \n" "When you register a channel, you are recorded as the\n" diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp index 0be0099b0..726ea5655 100644 --- a/modules/core/cs_set_description.cpp +++ b/modules/core/cs_set_description.cpp @@ -16,10 +16,10 @@ class CommandCSSetDescription : public Command { public: - CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description", const Anope::string &cpermission = "") : Command(creator, cname, 1, 2, cpermission) { this->SetDesc(_("Set the channel description")); - this->SetSyntax(_("\037channel\037 DESC \037description\037")); + this->SetSyntax(_("\037channel\037 DESC [\037description\037]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -38,9 +38,16 @@ class CommandCSSetDescription : public Command return; } - ci->desc = params[1]; - - source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str()); + if (params.size() > 1) + { + ci->desc = params[1]; + source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str()); + } + else + { + ci->desc.clear(); + source.Reply(_("Description of %s unset."), ci->name.c_str()); + } return; } |