1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 10:33:13 +02:00

Made channel descriptions optional

This commit is contained in:
Adam
2011-07-14 18:29:03 -04:00
parent f858164dee
commit 5bf7dee559
3 changed files with 20 additions and 11 deletions
+2 -1
View File
@@ -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());
+6 -5
View File
@@ -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> &params)
{
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"
+12 -5
View File
@@ -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> &params)
@@ -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;
}