[NeoStats-Devel] [Commits] rev 12 - trunk

[email protected]
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: DNB
Date: Fri Mar 18 07:27:28 2005
New Revision: 12

Modified:
   trunk/ChangeLog
   trunk/events.c
   trunk/seen.c
   trunk/seenserv.h
Log:
use new core user struct fields userhostmask and uservhostmask (seendata file must be removed when updating to this rev)

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Fri Mar 18 07:27:28 2005
@@ -2,6 +2,8 @@
 Fish (F), Mark (M), DeadNotBuried (D)
 ==============================================================================
 3.0.a3-dev
+ - use new core user struct fields userhostmask and uservhostmask (breaks
+   the seendata file again but should be the last time hopefully) (D)
  - SEEN and SEENNICK available to NS_ULEVEL_LOCOPER even if disabled
    (including in the services channel) (D)
  - SEEN and SEENNICK now checks to see if passed data is a valid nickname,

Modified: trunk/events.c
==============================================================================
--- trunk/events.c	(original)
+++ trunk/events.c	Fri Mar 18 07:27:28 2005
@@ -31,7 +31,7 @@
 */
 int SeenSignon (CmdParams *cmdparams) {
 	ircsnprintf(tmpmsg, SS_MESSAGESIZE, "%s", cmdparams->param);
-	addseenentry(cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->hostname, cmdparams->source->user->vhost, tmpmsg, SS_CONNECTED);
+	addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, tmpmsg, SS_CONNECTED);
 	return NS_SUCCESS;
 }
 
@@ -40,7 +40,7 @@
 */
 int SeenQuit (CmdParams *cmdparams) {
 	ircsnprintf(tmpmsg, SS_MESSAGESIZE, "(%s)", cmdparams->param);
-	addseenentry(cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->hostname, cmdparams->source->user->vhost, tmpmsg, SS_QUIT);
+	addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, tmpmsg, SS_QUIT);
 	return NS_SUCCESS;
 }
 
@@ -49,7 +49,7 @@
 */
 int SeenKill (CmdParams *cmdparams) {
 	ircsnprintf(tmpmsg, SS_MESSAGESIZE, "by %s (%s)", cmdparams->target->name, cmdparams->source->name, cmdparams->param);
-	addseenentry(cmdparams->target->name, cmdparams->target->user->username, cmdparams->target->user->hostname, cmdparams->target->user->vhost, tmpmsg, SS_KILLED);
+	addseenentry(cmdparams->target->name, cmdparams->target->user->userhostmask, cmdparams->target->user->uservhostmask, tmpmsg, SS_KILLED);
 	return NS_SUCCESS;
 }
 
@@ -58,7 +58,7 @@
 */
 int SeenNickChange (CmdParams *cmdparams) {
 	strlcpy(tmpmsg, cmdparams->source->name, SS_MESSAGESIZE);
-	addseenentry(cmdparams->param, cmdparams->source->user->username, cmdparams->source->user->hostname, cmdparams->source->user->vhost, tmpmsg, SS_NICKCHANGE);
+	addseenentry(cmdparams->param, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, tmpmsg, SS_NICKCHANGE);
 	return NS_SUCCESS;
 }
 
@@ -70,7 +70,7 @@
 		return NS_SUCCESS;
 	}
 	strlcpy(tmpmsg, cmdparams->channel->name, SS_MESSAGESIZE);
-	addseenentry(cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->hostname, cmdparams->source->user->vhost, tmpmsg, SS_JOIN);
+	addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, tmpmsg, SS_JOIN);
 	return NS_SUCCESS;
 }
 
@@ -86,7 +86,7 @@
 	} else {
 		strlcpy(tmpmsg, cmdparams->channel->name, SS_MESSAGESIZE);
 	}
-	addseenentry(cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->hostname, cmdparams->source->user->vhost, tmpmsg, SS_PART);
+	addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, tmpmsg, SS_PART);
 	return NS_SUCCESS;
 }
 
@@ -98,6 +98,6 @@
 		return NS_SUCCESS;
 	}
 	ircsnprintf(tmpmsg, SS_MESSAGESIZE, "%s by %s (%s)", cmdparams->channel->name, cmdparams->source->name, cmdparams->param);
-	addseenentry(cmdparams->target->name, cmdparams->target->user->username, cmdparams->target->user->hostname, cmdparams->target->user->vhost, tmpmsg, SS_KICKED);
+	addseenentry(cmdparams->target->name, cmdparams->target->user->userhostmask, cmdparams->target->user->uservhostmask, tmpmsg, SS_KICKED);
 	return NS_SUCCESS;
 }

Modified: trunk/seen.c
==============================================================================
--- trunk/seen.c	(original)
+++ trunk/seen.c	Fri Mar 18 07:27:28 2005
@@ -27,9 +27,8 @@
 static list_t *seenlist;
 
 static char ttxt[4][12];
-static char th[SS_HOSTSIZE];
 static char dt[SS_GENCHARLEN];
-static char matchstr[SS_HOSTSIZE];
+static char matchstr[USERHOSTLEN];
 static char cc[SS_GENCHARLEN];
 static char senf[5][MAXNICK+3];
 static char nickstr[SS_MESSAGESIZE];
@@ -37,14 +36,14 @@
 /*
  *  add new seen entry to list
 */
-void addseenentry(char *nick, char *user, char *host, char *vhost, char *message, int type) {
+void addseenentry(char *nick, char *host, char *vhost, char *message, int type) {
 	SeenData *sd;
 	
 	removepreviousnick(nick);
 	sd = ns_calloc(sizeof(SeenData));
 	strlcpy(sd->nick, nick, MAXNICK);
-	ircsnprintf(sd->userhost, SS_HOSTSIZE, "%s!%s@%s", nick, user, host);
-	ircsnprintf(sd->uservhost, SS_HOSTSIZE, "%s!%s@%s", nick, user, vhost);
+	strlcpy(sd->userhost, host, USERHOSTLEN);
+	strlcpy(sd->uservhost, vhost, USERHOSTLEN);
 	strlcpy(sd->message, message, SS_MESSAGESIZE);
 	sd->seentype = type;
 	sd->seentime = me.now;
@@ -196,9 +195,10 @@
 	h = m = s = sef = 0;
 	if (checktype == SS_CHECK_WILDCARD) {
 		if (!strchr(cmdparams->av[0], '*') == NULL) {
-			ircsnprintf(matchstr, SS_HOSTSIZE, "%s", cmdparams->av[0]);
+
+			ircsnprintf(matchstr, USERHOSTLEN, "%s", cmdparams->av[0]);
 		} else {
-			ircsnprintf(matchstr, SS_HOSTSIZE, "*%s*", cmdparams->av[0]);
+			ircsnprintf(matchstr, USERHOSTLEN, "*%s*", cmdparams->av[0]);
 		}
 	}
 	ln = list_last(seenlist);
@@ -266,8 +266,7 @@
 		if ( sdo->seentype == SS_CONNECTED ) {
 			u = FindUser(sdo->nick);
 			if (u) {
-				ircsnprintf(th, SS_HOSTSIZE, "%s!%s@%s", u->name, u->user->username, u->user->hostname);
-				if (!ircstrcasecmp(sdo->userhost, th)) {
+				if (!ircstrcasecmp(sdo->userhost, u->user->userhostmask)) {
 					ircsnprintf(cc, SS_GENCHARLEN, ", %s is currently connected", u->name);
 				}
 			}
@@ -303,8 +302,7 @@
 		} else if ( sdo->seentype == SS_NICKCHANGE ) {
 			u = FindUser(sdo->message);
 			if (u) {
-				ircsnprintf(th, SS_HOSTSIZE, "%s!%s@%s", u->name, u->user->username, u->user->hostname);
-				if (!ircstrcasecmp(sdo->userhost, th)) {
+				if (!ircstrcasecmp(sdo->userhost, u->user->userhostmask)) {
 					ircsnprintf(cc, SS_GENCHARLEN, ", %s is currently connected", u->name);
 				}
 			}
@@ -320,8 +318,7 @@
 		} else if ( sdo->seentype == SS_JOIN ) {
 			u = FindUser(sdo->nick);
 			if (u) {
-				ircsnprintf(th, SS_HOSTSIZE, "%s!%s@%s", u->name, u->user->username, u->user->hostname);
-				if (!ircstrcasecmp(sdo->userhost, th)) {
+				if (!ircstrcasecmp(sdo->userhost, u->user->userhostmask)) {
 					c = FindChannel(sdo->message);
 					if (c) {
 						if (IsChannelMember(c, u) && !is_hidden_chan(c)) {
@@ -446,7 +443,6 @@
 		irc_prefmsg (sns_bot, cmdparams->source, "%d Channel Kicks", sc[SS_KICKED]);
 		irc_prefmsg (sns_bot, cmdparams->source, "End Of Statistics");
 	} else {
-		irc_chanprivmsg (sns_bot, cmdparams->channel->name, "Stats command used");
 		irc_chanprivmsg (sns_bot, cmdparams->channel->name, "Seen Statistics (Current Records Per Type)");
 		irc_chanprivmsg (sns_bot, cmdparams->channel->name, "%d Connections", sc[SS_CONNECTED]);
 		irc_chanprivmsg (sns_bot, cmdparams->channel->name, "%d Quits", sc[SS_QUIT]);

Modified: trunk/seenserv.h
==============================================================================
--- trunk/seenserv.h	(original)
+++ trunk/seenserv.h	Fri Mar 18 07:27:28 2005
@@ -33,7 +33,6 @@
 #define SS_PART			0x00000006	/* Seen Part Channel Type */
 #define SS_KICKED		0x00000007	/* Seen Kicked Channel Type */
 
-#define SS_HOSTSIZE		MAXNICK+MAXUSER+MAXHOST /* Max Length to store Nick!User@<Host|Vhost> */
 #define SS_MESSAGESIZE		300 /* Message Field Size */
 #define SS_GENCHARLEN		128 /* General Character Field Length */
 
@@ -51,8 +50,8 @@
 
 typedef struct SeenData {
 	char nick[MAXNICK];
-	char userhost[SS_HOSTSIZE];
-	char uservhost[SS_HOSTSIZE];
+	char userhost[USERHOSTLEN];
+	char uservhost[USERHOSTLEN];
 	char message[SS_MESSAGESIZE];
 	int seentype;
 	time_t seentime;
@@ -89,7 +88,7 @@
 static int sns_set_exclusions (CmdParams *cmdparams, SET_REASON reason);
 
 /* seen.c */
-void addseenentry(char *nick, char *user, char *host, char *vhost, char *message, int type);
+void addseenentry(char *nick, char *host, char *vhost, char *message, int type);
 void checkseenlistlimit(void);
 void removepreviousnick(char *nn);
 void loadseendata(void);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.