summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-10-12 20:56:23 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-10-12 20:56:23 +0000
commit5bcb780c6d486b603856016dc566b3a403548545 (patch)
treec49d832047c23d2ae12b83cf4d53554c3e0fe0fe
parentc79d189e89884d983c374704eadf822620095deb (diff)
Changed /ns confirm to not assume the user you are confirming owns the nick (have it ask the user for the password now), added nickserv/confirm opertype command value, and changed OnNickRegister event param to be NickAlias* not User*
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2554 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--data/example.conf1
-rw-r--r--include/modules.h4
-rw-r--r--src/core/ns_register.c43
3 files changed, 20 insertions, 28 deletions
diff --git a/data/example.conf b/data/example.conf
index 1703015e6..757ac6403 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -525,6 +525,7 @@ options
* memoserv/sendall memoserv/staff
*
* nickserv/getpass nickserv/sendpass nickserv/getemail nickserv/suspend
+ * nickserv/confirm
*
* operserv/global operserv/news operserv/stats operserv/kick
* operserv/mode operserv/session operserv/modlist operserv/ignore
diff --git a/include/modules.h b/include/modules.h
index 5a2a5420b..aea9011f7 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -833,9 +833,9 @@ class CoreExport Module
virtual void OnNickLogout(User *u) { }
/** Called when a nick is registered
- * @param The user
+ * @param The nick
*/
- virtual void OnNickRegister(User *u) { }
+ virtual void OnNickRegister(NickAlias *na) { }
/** Called when a nick is suspended
* @param na The nick alias
diff --git a/src/core/ns_register.c b/src/core/ns_register.c
index ddaa2516e..359ca3912 100644
--- a/src/core/ns_register.c
+++ b/src/core/ns_register.c
@@ -71,21 +71,30 @@ class CommandNSConfirm : public Command
notice_lang(s_NickServ, u, NICK_REGISTERED, u->nick, na->nc->GetAccess(0).c_str());
else
notice_lang(s_NickServ, u, NICK_REGISTERED_NO_MASK, u->nick);
+ delnickrequest(nr);
ircdproto->SendAccountLogin(u, u->nc);
ircdproto->SetAutoIdentificationToken(u);
- FOREACH_MOD(I_OnNickRegister, OnNickRegister(u));
-
if (enc_decrypt(na->nc->pass, tmp_pass, PASSMAX - 1) == 1)
notice_lang(s_NickServ, u, NICK_PASSWORD_IS, tmp_pass);
u->lastnickreg = time(NULL);
}
else
+ {
+ alog("%s: '%s' confirmed by %s!%s@%s (email: %s)", s_NickServ, nr->nick, u->nick, u->GetIdent().c_str(), u->host, nr->email ? nr->email : "none");
+
notice_lang(s_NickServ, u, NICK_FORCE_REG, nr->nick);
- delnickrequest(nr); /* remove the nick request */
+ User *user = finduser(nr->nick);
+ /* Delrequest must be called before validate_user */
+ delnickrequest(nr);
+ if (user)
+ {
+ validate_user(user);
+ }
+ }
return MOD_CONT;
}
@@ -107,38 +116,20 @@ class CommandNSConfirm : public Command
if (!nr)
{
- if (u->nc && u->nc->IsServicesOper())
+ if (u->nc && u->nc->HasCommand("nickserv/confirm"))
{
/* If an admin, their nick is obviously already regged, so look at the passcode to get the nick
of the user they are trying to validate, and push that user through regardless of passcode */
nr = findrequestnick(passcode);
if (nr)
{
- User *utmp = finduser(passcode);
- if (utmp)
- {
- ActuallyConfirmNick(utmp, nr, false);
- notice_lang(s_NickServ, u, NICK_FORCE_REG, utmp->nick);
- return MOD_CONT;
- }
- else
- {
- passcode = nr->passcode;
- ActuallyConfirmNick(u, nr, true);
- return MOD_CONT;
- }
- }
- else
- {
- notice_lang(s_NickServ, u, NICK_CONFIRM_NOT_FOUND, s_NickServ);
+ ActuallyConfirmNick(u, nr, true);
return MOD_CONT;
}
}
- else
- {
- notice_lang(s_NickServ, u, NICK_CONFIRM_NOT_FOUND, s_NickServ);
- return MOD_CONT;
- }
+ notice_lang(s_NickServ, u, NICK_CONFIRM_NOT_FOUND, s_NickServ);
+
+ return MOD_CONT;
}
if (stricmp(nr->passcode, passcode))