summaryrefslogtreecommitdiff
path: root/src/users.c
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-09-26 04:53:59 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-09-26 04:53:59 +0000
commitd8bd3afd763c0813544ea6c8bbaa589dc0e44034 (patch)
tree2632a45ee7989d7219eaa79d07a39b406c95650c /src/users.c
parent927d2717a989d5b5c074390fbb71d8230b13d5d5 (diff)
Fixed bug #1107. We now have support for IRCds that send auth after the initial NICK/UID command, and automatically reidentifying users from their account name on InspIRCd1.2
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2513 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/users.c')
-rw-r--r--src/users.c78
1 files changed, 51 insertions, 27 deletions
diff --git a/src/users.c b/src/users.c
index b051dbe04..76e108154 100644
--- a/src/users.c
+++ b/src/users.c
@@ -366,6 +366,24 @@ void User::CheckAuthenticationToken(const char *svid)
}
}
+/** Auto identify the user to the given accountname.
+ * @param account Display nick of account
+ */
+void User::AutoID(const char *account)
+{
+ NickCore *tnc;
+ NickAlias *na;
+
+ if ((tnc = findcore(account)))
+ {
+ this->nc = tnc;
+ if ((na = findnick(this->nick)) && na->nc == tnc)
+ {
+ na->status |= NS_IDENTIFIED;
+ check_memos(this);
+ }
+ }
+}
/*************************************************************************/
/*************************************************************************/
@@ -777,37 +795,43 @@ User *do_nick(const char *source, const char *nick, const char *username, const
} /* if (!*source) */
- NickAlias *ntmp = findnick(user->nick);
- if (ntmp && user->nc == ntmp->nc)
- {
- ntmp->status |= NS_IDENTIFIED;
- nc_changed = 0;
- }
-
- if (!ntmp || ntmp->nc != user->nc || nc_changed)
- {
- if (validate_user(user))
- check_memos(user);
- }
- else
+ /* Do not attempt to validate the user if their server is syncing and this
+ * ircd has delayed auth - Adam
+ */
+ if (!(ircd->b_delay_auth && user->server->sync == SSYNC_IN_PROGRESS))
{
- ntmp->last_seen = time(NULL);
-
- if (ntmp->last_usermask)
- delete [] ntmp->last_usermask;
- ntmp->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
- sprintf(ntmp->last_usermask, "%s@%s",
- user->GetIdent().c_str(), user->GetDisplayedHost().c_str());
- ircdproto->SetAutoIdentificationToken(user);
- alog("%s: %s!%s@%s automatically identified for nick %s", s_NickServ, user->nick, user->GetIdent().c_str(), user->host, user->nick);
- }
+ NickAlias *ntmp = findnick(user->nick);
+ if (ntmp && user->nc == ntmp->nc)
+ {
+ ntmp->status |= NS_IDENTIFIED;
+ nc_changed = 0;
+ }
- /* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
- if (ircd->check_nick_id)
- {
- if (nick_identified(user))
+ if (!ntmp || ntmp->nc != user->nc || nc_changed)
+ {
+ if (validate_user(user))
+ check_memos(user);
+ }
+ else
{
+ ntmp->last_seen = time(NULL);
+
+ if (ntmp->last_usermask)
+ delete [] ntmp->last_usermask;
+ ntmp->last_usermask = new char[user->GetIdent().length() + user->GetDisplayedHost().length() + 2];
+ sprintf(ntmp->last_usermask, "%s@%s",
+ user->GetIdent().c_str(), user->GetDisplayedHost().c_str());
ircdproto->SetAutoIdentificationToken(user);
+ alog("%s: %s!%s@%s automatically identified for nick %s", s_NickServ, user->nick, user->GetIdent().c_str(), user->host, user->nick);
+ }
+
+ /* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
+ if (ircd->check_nick_id)
+ {
+ if (nick_identified(user))
+ {
+ ircdproto->SetAutoIdentificationToken(user);
+ }
}
}