mirror of
https://github.com/anope/anope.git
synced 2026-06-27 08:26:38 +02:00
BUILD : 1.7.3 (122) BUGS : None NOTES : New NSNickTracking directive to track nick cores when changing nicks.
git-svn-id: svn://svn.anope.org/anope/trunk@122 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@96 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
parent
d5b6d250d5
commit
4390d0ff74
@@ -1,6 +1,8 @@
|
||||
Anope Version S V N
|
||||
-------------------
|
||||
Provided by Anope Dev. <dev@anope.org> - 2004
|
||||
05/24 A New NSNickTracking directive to track nick cores when
|
||||
changing nicks.
|
||||
05/21 A Auto enforce upon AKICK addition. [ #63]
|
||||
05/21 A New file docs/OLDCHANGES contains all change history. [ #65]
|
||||
05/24 F Cleaned up compile errors on older compilers. [ #69]
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
Anope Version S V N
|
||||
-------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
|
||||
# NSNickTracking [OPTIONAL]
|
||||
#
|
||||
# When enabled, services will track your last nick identified when issuing
|
||||
# nick changes.
|
||||
|
||||
#NSNickTracking
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
** DELETED CONFIGURATION DIRECTIVES **
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ int NSStrictPrivileges;
|
||||
int NSEmailReg;
|
||||
int NSModeOnID;
|
||||
int NSRestrictGetPass;
|
||||
int NSNickTracking;
|
||||
|
||||
int CSDefNone;
|
||||
int CSDefKeepTopic;
|
||||
@@ -542,6 +543,7 @@ Directive directives[] = {
|
||||
{"NSStrictPrivileges",
|
||||
{{PARAM_SET, PARAM_RELOAD, &NSStrictPrivileges}}},
|
||||
{"NSRestrictGetPass", {{PARAM_SET, PARAM_RELOAD, &NSRestrictGetPass}}},
|
||||
{"NSNickTracking", {{PARAM_SET, PARAM_RELOAD, &NSNickTracking}}},
|
||||
{"OperServDB", {{PARAM_STRING, PARAM_RELOAD, &OperDBName}}},
|
||||
{"OperServName", {{PARAM_STRING, 0, &s_OperServ},
|
||||
{PARAM_STRING, 0, &desc_OperServ}}},
|
||||
|
||||
@@ -806,6 +806,13 @@ NSStrictPrivileges
|
||||
|
||||
NSRestrictGetPass
|
||||
|
||||
# NSNickTracking [OPTIONAL]
|
||||
#
|
||||
# When enabled, services will track your last nick identified when issuing
|
||||
# nick changes.
|
||||
|
||||
#NSNickTracking
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# ChanServ configuration
|
||||
|
||||
@@ -329,6 +329,7 @@ E int NSStrictPrivileges;
|
||||
E int NSEmailReg;
|
||||
E int NSModeOnID;
|
||||
E int NSRestrictGetPass;
|
||||
E int NSNickTracking;
|
||||
|
||||
E int CSDefFlags;
|
||||
E int CSMaxReg;
|
||||
@@ -661,6 +662,10 @@ E NickAlias *findnick(const char *nick);
|
||||
E NickCore *findcore(const char *nick);
|
||||
E void clean_ns_timeouts(NickAlias * na);
|
||||
|
||||
E void nsStartNickTracking(User * u);
|
||||
E void nsStopNickTracking(User * u);
|
||||
E int nsCheckNickTracking(User *u);
|
||||
|
||||
/**** helpserv.c ****/
|
||||
E void helpserv(User * u, char *buf);
|
||||
E void helpserv_init(void);
|
||||
|
||||
+84
@@ -2192,6 +2192,10 @@ static int do_confirm(User * u)
|
||||
notice_lang(s_NickServ, u, NICK_REGISTRATION_FAILED);
|
||||
}
|
||||
|
||||
/* Enable nick tracking if enabled*/
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(u);
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -2414,6 +2418,10 @@ static int do_identify(User * u)
|
||||
|
||||
if (!(na->status & NS_RECOGNIZED))
|
||||
check_memos(u);
|
||||
|
||||
/* Enable nick tracking if enabled*/
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(u);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
@@ -2577,6 +2585,10 @@ static int do_logout(User * u)
|
||||
notice_lang(s_NickServ, u, NICK_LOGOUT_X_SUCCEEDED, nick);
|
||||
else
|
||||
notice_lang(s_NickServ, u, NICK_LOGOUT_SUCCEEDED);
|
||||
|
||||
/* Stop nick tracking if enabled*/
|
||||
if (NSNickTracking)
|
||||
nsStopNickTracking(u);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
@@ -2749,6 +2761,11 @@ static int do_set_display(User * u, NickCore * nc, char *param)
|
||||
|
||||
change_core_display(nc, param);
|
||||
notice_lang(s_NickServ, u, NICK_SET_DISPLAY_CHANGED, nc->display);
|
||||
|
||||
/* Enable nick tracking if enabled*/
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(u);
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -4065,3 +4082,70 @@ int ns_do_register(User * u)
|
||||
{
|
||||
return do_register(u);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/*
|
||||
* Nick tracking
|
||||
*/
|
||||
|
||||
/**
|
||||
* Start Nick tracking and store the nick core display under the user struct.
|
||||
* @param u The user to track nicks for
|
||||
**/
|
||||
void nsStartNickTracking(User * u)
|
||||
{
|
||||
NickCore *nc;
|
||||
|
||||
/* We only track identified users */
|
||||
if (nick_identified(u)) {
|
||||
nc = u->na->nc;
|
||||
|
||||
/* Release memory if needed */
|
||||
if (u->nickTrack)
|
||||
free(u->nickTrack);
|
||||
|
||||
/* Copy the nick core displayed nick to
|
||||
the user structure for further checks */
|
||||
u->nickTrack = sstrdup(nc->display);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop Nick tracking and remove the nick core display under the user struct.
|
||||
* @param u The user to stop tracking for
|
||||
**/
|
||||
void nsStopNickTracking(User * u)
|
||||
{
|
||||
/* Simple enough. If its there, release it */
|
||||
if (u->nickTrack) {
|
||||
free(u->nickTrack);
|
||||
u->nickTrack = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Boolean function to check if the user requesting a nick has the tracking
|
||||
* signature of that core in its structure.
|
||||
* @param u The user whom to check tracking for
|
||||
**/
|
||||
int nsCheckNickTracking(User *u)
|
||||
{
|
||||
NickCore *nc;
|
||||
NickAlias *na;
|
||||
char* nick;
|
||||
|
||||
/* No nick alias or nick return false by default */
|
||||
if((!(na = u->na)) || (!(nick = na->nick)))
|
||||
return 0;
|
||||
|
||||
/* Get the core for the requested nick */
|
||||
nc = na->nc;
|
||||
|
||||
/* If the core and the tracking displayed nick are there,
|
||||
* and they match, return true
|
||||
*/
|
||||
if (nc && u->nickTrack && (strcmp(nc->display, u->nickTrack) == 0))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -711,6 +711,8 @@ struct user_ {
|
||||
char *realname;
|
||||
char *server; /* Name of server user is on */
|
||||
|
||||
char *nickTrack; /* Nick Tracking */
|
||||
|
||||
time_t timestamp; /* Timestamp of the nick */
|
||||
time_t my_signon; /* When did _we_ see the user? */
|
||||
uint32 svid; /* Services ID */
|
||||
|
||||
@@ -712,6 +712,11 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
|
||||
user->na->status |= NS_IDENTIFIED;
|
||||
check_memos(user);
|
||||
nc_changed = 0;
|
||||
|
||||
/* Start nick tracking if available */
|
||||
if (NSNickTracking)
|
||||
nsStartNickTracking(user);
|
||||
|
||||
} else if (svid != 1) {
|
||||
/* Resets the svid because it doesn't match */
|
||||
user->svid = 1;
|
||||
@@ -789,6 +794,12 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
|
||||
|
||||
} /* if (!*source) */
|
||||
|
||||
/* Check for nick tracking to bypass identification */
|
||||
if (NSNickTracking && nsCheckNickTracking(user)) {
|
||||
user->na->status |= NS_IDENTIFIED;
|
||||
nc_changed = 0;
|
||||
}
|
||||
|
||||
if (nc_changed || !nick_recognized(user)) {
|
||||
if (validate_user(user))
|
||||
check_memos(user);
|
||||
|
||||
+5
-1
@@ -8,10 +8,14 @@
|
||||
VERSION_MAJOR="1"
|
||||
VERSION_MINOR="7"
|
||||
VERSION_PATCH="3"
|
||||
VERSION_BUILD="121"
|
||||
VERSION_BUILD="122"
|
||||
|
||||
# $Log$
|
||||
#
|
||||
# BUILD : 1.7.3 (122)
|
||||
# BUGS : None
|
||||
# NOTES : New NSNickTracking directive to track nick cores when changing nicks.
|
||||
#
|
||||
# BUILD : 1.7.3 (121)
|
||||
# BUGS : 69
|
||||
# NOTES : Cleaned up compile errors on older compilers.
|
||||
|
||||
Reference in New Issue
Block a user