summaryrefslogtreecommitdiff
path: root/modules/commands/ns_drop.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-04-12 01:32:53 -0500
committerAdam <Adam@anope.org>2013-04-12 01:32:53 -0500
commit42c640a9b5fc9d9e89f00b7f69a52052a0666432 (patch)
tree9cf511537cb2d48e4e03437765ed9248b640afe8 /modules/commands/ns_drop.cpp
parent066fc5801b4e0d8174cf279473a1c9936bc5502a (diff)
/ns drop help was pretty much a complete lie, so fixed it. Also require a nick param to /ns drop
Diffstat (limited to 'modules/commands/ns_drop.cpp')
-rw-r--r--modules/commands/ns_drop.cpp68
1 files changed, 17 insertions, 51 deletions
diff --git a/modules/commands/ns_drop.cpp b/modules/commands/ns_drop.cpp
index cc03b1001..047770f89 100644
--- a/modules/commands/ns_drop.cpp
+++ b/modules/commands/ns_drop.cpp
@@ -16,35 +16,30 @@
class CommandNSDrop : public Command
{
public:
- CommandNSDrop(Module *creator) : Command(creator, "nickserv/drop", 0, 1)
+ CommandNSDrop(Module *creator) : Command(creator, "nickserv/drop", 1, 1)
{
+ this->SetSyntax(_("\037nickname\037"));
this->SetDesc(_("Cancel the registration of a nickname"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
- Anope::string nick = !params.empty() ? params[0] : "";
+ const Anope::string &nick = params[0];
- if (Anope::ReadOnly)
+ if (Anope::ReadOnly && !source.HasPriv("nickserv/drop"))
{
source.Reply(_("Sorry, nickname de-registration is temporarily disabled."));
return;
}
- NickAlias *na = NickAlias::Find(!nick.empty() ? nick : source.GetNick());
+ NickAlias *na = NickAlias::Find(nick);
if (!na)
{
- if (!nick.empty())
- source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
- else
- source.Reply(NICK_NOT_REGISTERED);
+ source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
return;
}
bool is_mine = source.GetAccount() == na->nc;
- Anope::string my_nick;
- if (is_mine && nick.empty())
- my_nick = na->nick;
if (!is_mine && !source.HasPriv("nickserv/drop"))
source.Reply(ACCESS_DENIED);
@@ -52,56 +47,27 @@ class CommandNSDrop : public Command
source.Reply(_("You may not drop other Services Operators' nicknames."));
else
{
- if (Anope::ReadOnly)
- source.Reply(READ_ONLY_MODE);
-
FOREACH_MOD(I_OnNickDrop, OnNickDrop(source, na));
- Log(!is_mine ? LOG_OVERRIDE : LOG_COMMAND, source, this) << "to drop nickname " << na->nick << " (group: " << na->nc->display << ") (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
+ Log(!is_mine ? LOG_ADMIN : LOG_COMMAND, source, this) << "to drop nickname " << na->nick << " (group: " << na->nc->display << ") (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
delete na;
- if (!is_mine)
- {
- source.Reply(_("Nickname \002%s\002 has been dropped."), nick.c_str());
- }
- else
- {
- if (!nick.empty())
- source.Reply(_("Nickname \002%s\002 has been dropped."), nick.c_str());
- else
- source.Reply(_("Your nickname has been dropped."));
- }
+ source.Reply(_("Nickname \002%s\002 has been dropped."), nick.c_str());
}
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
- if (source.HasPriv("nickserv/drop"))
- source.Reply(_("Syntax: \002%s [\037nickname\037]\002\n"
- " \n"
- "Without a parameter, deletes your nickname.\n"
- " \n"
- "With a parameter, drops the named nick from the database.\n"
- "You may drop any nick within your group without any\n"
- "special privileges. Dropping any nick is limited to\n"
- "\002Services Operators\002."), source.command.c_str());
+ this->SendSyntax(source);
+ source.Reply(" ");
+ source.Reply(_("Drops the given nick from the database. Once your nickname\n"
+ "is dropped you may lose all of your access and channels that\n"
+ "you may own. Any other user will be able to gain control of\n"
+ "this nick."));
+ if (!source.HasPriv("nickserv/drop"))
+ source.Reply(_("You may drop any nick within your group."));
else
- source.Reply(_("Syntax: \002%s [\037nickname\037 | \037password\037]\002\n"
- " \n"
- "Deletes your nickname. A nick\n"
- "that has been dropped is free for anyone to re-register.\n"
- " \n"
- "You may drop a nick within your group by passing it\n"
- "as the \002nick\002 parameter.\n"
- " \n"
- "If you have a nickname registration pending but can not confirm\n"
- "it for any reason, you can cancel your registration by passing\n"
- "your password as the \002password\002 parameter.\n"
- " \n"
- "In order to use this command, you must first identify\n"
- "with your password."), source.command.c_str());
+ source.Reply(_("As a Services Operator, you may drop any nick."));
return true;
}