summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoratoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b <atoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-05-24 21:53:45 +0000
committeratoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b <atoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-05-24 21:53:45 +0000
commit4390d0ff7490a775bc2ee2ed3461f9eabb4e1f23 (patch)
treee3953c14468aeb0032fd321b6b78c32a19e53022
parentd5b6d250d5456bd62a743c6058358d900a4d0d4b (diff)
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
-rw-r--r--Changes2
-rw-r--r--Changes.conf8
-rw-r--r--config.c2
-rw-r--r--data/example.conf7
-rw-r--r--extern.h5
-rw-r--r--nickserv.c84
-rw-r--r--services.h2
-rw-r--r--users.c11
-rw-r--r--version.log6
9 files changed, 126 insertions, 1 deletions
diff --git a/Changes b/Changes
index c32f44b24..1b880d159 100644
--- a/Changes
+++ b/Changes
@@ -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]
diff --git a/Changes.conf b/Changes.conf
index b1f841eb8..ce287bb01 100644
--- a/Changes.conf
+++ b/Changes.conf
@@ -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 **
diff --git a/config.c b/config.c
index b2a4770fb..27bc8068b 100644
--- a/config.c
+++ b/config.c
@@ -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}}},
diff --git a/data/example.conf b/data/example.conf
index 12b93d3c4..033a470bc 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -806,6 +806,13 @@ NSStrictPrivileges
NSRestrictGetPass
+# NSNickTracking [OPTIONAL]
+#
+# When enabled, services will track your last nick identified when issuing
+# nick changes.
+
+#NSNickTracking
+
###########################################################################
#
# ChanServ configuration
diff --git a/extern.h b/extern.h
index d1e45269d..06954d81a 100644
--- a/extern.h
+++ b/extern.h
@@ -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);
diff --git a/nickserv.c b/nickserv.c
index f190873f2..b9399ca82 100644
--- a/nickserv.c
+++ b/nickserv.c
@@ -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;
+}
diff --git a/services.h b/services.h
index 7200e3e1b..44f23a0d2 100644
--- a/services.h
+++ b/services.h
@@ -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 */
diff --git a/users.c b/users.c
index f868ebdba..454065c2b 100644
--- a/users.c
+++ b/users.c
@@ -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);
diff --git a/version.log b/version.log
index 8d4b45f69..00372c141 100644
--- a/version.log
+++ b/version.log
@@ -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.