summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/Changes1
-rw-r--r--modules/core/ns_drop.cpp43
-rw-r--r--modules/core/ns_register.cpp2
-rw-r--r--src/language.cpp9
4 files changed, 39 insertions, 16 deletions
diff --git a/docs/Changes b/docs/Changes
index 6df1c7ecb..0ab0670b2 100644
--- a/docs/Changes
+++ b/docs/Changes
@@ -3,6 +3,7 @@ Anope Version 1.9.4
A Automatically set channel founder to the user with the highest access if there is no successor
A /chanserv clone command to copy settings from one channel to another.
A Ability for users to delete their own access in channels
+A Ability for users with registrations pending to drop their registrations with /nickserv drop
F Changed the GHOST command to not allow ghosting unidentified users if the RECOVER command exists
Anope Version 1.9.3
diff --git a/modules/core/ns_drop.cpp b/modules/core/ns_drop.cpp
index 13f003ff2..a3e292df1 100644
--- a/modules/core/ns_drop.cpp
+++ b/modules/core/ns_drop.cpp
@@ -18,15 +18,12 @@ class CommandNSDrop : public Command
public:
CommandNSDrop() : Command("DROP", 0, 1)
{
+ this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
Anope::string nick = !params.empty() ? params[0] : "";
- NickAlias *na;
- NickRequest *nr = NULL;
- int is_mine; /* Does the nick being dropped belong to the user that is dropping? */
- Anope::string my_nick;
if (readonly)
{
@@ -34,27 +31,47 @@ class CommandNSDrop : public Command
return MOD_CONT;
}
- if (!(na = findnick(!nick.empty() ? nick : u->nick)))
+ NickAlias *na = findnick((u->Account() && !nick.empty() ? nick : u->nick));
+ if (!na)
{
- if (!nick.empty())
+ NickRequest *nr = findrequestnick(u->Account() && !nick.empty() ? nick : u->nick);
+ if (nr && u->Account() && u->Account()->IsServicesOper())
+ {
+ if (Config->WallDrop)
+ ircdproto->SendGlobops(NickServ, "\2%s\2 used DROP on \2%s\2", u->nick.c_str(), nick.c_str());
+
+ Log(LOG_ADMIN, u, this) << "to drop nickname " << nr->nick << " (email: " << nr->email << ")";
+ delete nr;
+ u->SendMessage(NickServ, NICK_X_DROPPED, nick.c_str());
+ }
+ else if (nr && !nick.empty())
{
- if ((nr = findrequestnick(nick)) && u->Account()->IsServicesOper())
+ int res = enc_check_password(nick, nr->password);
+ if (res)
{
- if (Config->WallDrop)
- ircdproto->SendGlobops(NickServ, "\2%s\2 used DROP on \2%s\2", u->nick.c_str(), nick.c_str());
- Log(LOG_ADMIN, u, this) << "to drop nickname " << nr->nick << " (email: " << nr->email << ")";
+ Log(LOG_COMMAND, u, this) << "to drop nick request " << nr->nick;
+ u->SendMessage(NickServ, NICK_X_DROPPED, nr->nick.c_str());
delete nr;
- u->SendMessage(NickServ, NICK_X_DROPPED, nick.c_str());
}
+ else if (bad_password(u))
+ return MOD_STOP;
else
- u->SendMessage(NickServ, NICK_X_NOT_REGISTERED, nick.c_str());
+ u->SendMessage(NickServ, PASSWORD_INCORRECT);
}
else
u->SendMessage(NickServ, NICK_NOT_REGISTERED);
+
return MOD_CONT;
}
- is_mine = u->Account() && u->Account() == na->nc;
+ if (!u->Account())
+ {
+ u->SendMessage(NickServ, NICK_IDENTIFY_REQUIRED, Config->s_NickServ.c_str());
+ return MOD_CONT;
+ }
+
+ bool is_mine = u->Account() == na->nc;
+ Anope::string my_nick;
if (is_mine && nick.empty())
my_nick = na->nick;
diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp
index a2af5ad7e..4a1f74e9d 100644
--- a/modules/core/ns_register.cpp
+++ b/modules/core/ns_register.cpp
@@ -279,7 +279,7 @@ class CommandNSRegister : public CommandNSConfirm
{
if (SendRegmail(u, nr))
{
- u->SendMessage(NickServ, NICK_ENTER_REG_CODE, email.c_str(), Config->s_NickServ.c_str());
+ u->SendMessage(NickServ, NICK_ENTER_REG_CODE, email.c_str(), Config->s_NickServ.c_str(), Config->s_NickServ.c_str());
Log(LOG_COMMAND, u, this) << "send registration verification code to " << nr->email;
}
else
diff --git a/src/language.cpp b/src/language.cpp
index c136b02fe..badc76ec2 100644
--- a/src/language.cpp
+++ b/src/language.cpp
@@ -674,7 +674,8 @@ const char *const language_strings[LANG_STRING_COUNT] = {
/* NICK_IS_PREREG */
_("This nick is awaiting an e-mail verification code before completing registration."),
/* NICK_ENTER_REG_CODE */
- _("A passcode has been sent to %s, please type %R%s confirm <passcode> to complete registration"),
+ _("A passcode has been sent to %s, please type %R%s confirm <passcode> to complete registration.\n"
+ "If you need to cancel your registration, use \"%R%s drop <password>\"."),
/* NICK_GETPASS_PASSCODE_IS */
_("Passcode for %s is %s."),
/* NICK_FORCE_REG */
@@ -2780,7 +2781,7 @@ const char *const language_strings[LANG_STRING_COUNT] = {
"anymore. Note, however, that you won't be asked to reidentify\n"
"yourself."),
/* NICK_HELP_DROP */
- _("Syntax: DROP [nickname]\n"
+ _("Syntax: DROP [nickname | \037password\037]\n"
" \n"
"Drops your nickname from the %S database. A nick\n"
"that has been dropped is free for anyone to re-register.\n"
@@ -2788,6 +2789,10 @@ const char *const language_strings[LANG_STRING_COUNT] = {
"You may drop a nick within your group by passing it\n"
"as the nick 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 (%R%S HELP IDENTIFY for more\n"
"information)."),