[cvslog] (2003-07-06 07:17:32 UTC) Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sun Jul 6 01:17:32 CST 2003


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2003-07-06 07:17:32 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     config.xml lib/eggdrop/xmlwrite.c modules/server/channels.c
     modules/server/channels.h modules/server/input.c
     modules/server/servsock.c

Log message:



---------------------- diff included ----------------------
Index: eggdrop1.7/config.xml
diff -u eggdrop1.7/config.xml:1.4 eggdrop1.7/config.xml:1.5
--- eggdrop1.7/config.xml:1.4	Sat Apr 19 00:47:26 2003
+++ eggdrop1.7/config.xml	Sun Jul  6 02:17:21 2003
@@ -21,6 +21,7 @@
 	<quick_logs>0</quick_logs>
 	<module_path>modules/</module_path>
 	<autoload>
+		<module>telnetparty</module>
 		<module>tclscript</module>
 		<module>script</module>
 		<module>server</module>
@@ -53,3 +54,9 @@
 		<port>6667</port>
 	</server>
 </server>
+<telnetparty>
+	<vhost />
+	<port>3333</port>
+	<stealth>0</stealth>
+	<max_retries>3</max_retries>
+</telnetparty>
Index: eggdrop1.7/lib/eggdrop/xmlwrite.c
diff -u eggdrop1.7/lib/eggdrop/xmlwrite.c:1.3 eggdrop1.7/lib/eggdrop/xmlwrite.c:1.4
--- eggdrop1.7/lib/eggdrop/xmlwrite.c:1.3	Mon May 12 06:54:53 2003
+++ eggdrop1.7/lib/eggdrop/xmlwrite.c	Sun Jul  6 02:17:21 2003
@@ -18,6 +18,7 @@
 	else if (node->type == 2) {
 		/* comment like <!-- ... --> */
 		fprintf(fp, "%s<!--%s-->\n", tabs, node->text);
+		free(tabs);
 		return(0);
 	}
 
@@ -30,6 +31,7 @@
 	else if (node->len > 0) {
 		/* If it's just small text and no children... */
 		fprintf(fp, ">%s</%s>\n", node->text, node->name);
+		free(tabs);
 		return(0);
 	}
 	else {
@@ -49,5 +51,6 @@
 	if (node->name) {
 		fprintf(fp, "%s</%s>\n", tabs, node->name);
 	}
+	free(tabs);
 	return(0);
 }
Index: eggdrop1.7/modules/server/channels.c
diff -u eggdrop1.7/modules/server/channels.c:1.10 eggdrop1.7/modules/server/channels.c:1.11
--- eggdrop1.7/modules/server/channels.c:1.10	Thu Jun 12 22:35:15 2003
+++ eggdrop1.7/modules/server/channels.c	Sun Jul  6 02:17:21 2003
@@ -175,11 +175,11 @@
 	}
 
 	/* Nope, so add him and put him in the cache. */
-	uhost_cache_fillin(nick, uhost, 1);
+	if (uhost) uhost_cache_fillin(nick, uhost, 1);
 
 	m = calloc(1, sizeof(*m));
 	m->nick = strdup(nick);
-	m->uhost = strdup(uhost);
+	if (uhost) m->uhost = strdup(uhost);
 	timer_get_now_sec(&m->join_time);
 
 	m->next = chan->member_head;
@@ -200,7 +200,7 @@
 
 	if (create) {
 		chan->status |= CHANNEL_WHOLIST | CHANNEL_BANLIST;
-		printserv(SERVER_NORMAL, "WHO %s\r\n", chan_name);
+		//printserv(SERVER_NORMAL, "WHO %s\r\n", chan_name);
 		printserv(SERVER_NORMAL, "MODE %s +b\r\n", chan_name);
 	}
 
@@ -220,7 +220,7 @@
 			next = m->next;
 			uhost_cache_decref(m->nick);
 			free(m->nick);
-			free(m->uhost);
+			if (m->uhost) free(m->uhost);
 			free(m);
 		}
 		if (chan->topic) free(chan->topic);
@@ -246,7 +246,7 @@
 		else chan->member_head = m->next;
 
 		free(m->nick);
-		free(m->uhost);
+		if (m->uhost) free(m->uhost);
 		free(m);
 	}
 
@@ -348,7 +348,7 @@
 	while (*flags) {
 		ptr = strchr(current_server.whoprefix, *flags);
 		if (ptr) {
-			i = current_server.whoprefix - ptr;
+			i = ptr - current_server.whoprefix;
 			changestr[1] = current_server.modeprefix[i];
 			flag_merge_str(&m->mode, changestr);
 		}
@@ -369,6 +369,54 @@
 	return(0);
 }
 
+/* :server 353 <ournick> = <chan> :<mode><nick1> <mode><nick2> ... */
+static int got353(char *from_nick, char *from_uhost, user_t *u, char *cmd, int nargs, char *args[])
+{
+	char *chan_name, *nick, *nicks, *flags, *ptr, *prefixptr, changestr[3];
+	int i;
+	channel_member_t *m;
+
+	chan_name = args[2];
+	nicks = strdup(args[3]);
+	ptr = nicks;
+	changestr[0] = '+';
+	changestr[2] = 0;
+	while (ptr && *ptr) {
+		while (isspace(*ptr)) ptr++;
+		flags = ptr;
+		while (strchr(current_server.whoprefix, *ptr)) ptr++;
+		nick = ptr;
+		while (*ptr && !isspace(*ptr)) ptr++;
+		if (*ptr) *ptr = 0;
+		else ptr = NULL;
+		m = channel_add_member(chan_name, nick, NULL);
+		*nick = 0;
+		while (*flags) {
+			prefixptr = strchr(current_server.whoprefix, *flags);
+			if (prefixptr) {
+				i = prefixptr - current_server.whoprefix;
+				changestr[1] = current_server.modeprefix[i];
+				flag_merge_str(&m->mode, changestr);
+			}
+			flags++;
+		}
+		if (ptr) ptr++;
+	}
+	free(nicks);
+	return(0);
+}
+
+/* :server 366 <ournick> <name> :End of /NAMES list */
+static int got366(char *from_nick, char *from_uhost, user_t *u, char *cmd, int nargs, char *args[])
+{
+	char *chan_name = args[1];
+	channel_t *chan = NULL;
+
+	channel_lookup(chan_name, 0, &chan, NULL);
+	if (chan) chan->status &= ~CHANNEL_NAMESLIST;
+	return(0);
+}
+
 /* :origin TOPIC <chan> :topic */
 static int gottopic(char *from_nick, char *from_uhost, user_t *u, char *cmd, int nargs, char *args[])
 {
@@ -720,6 +768,10 @@
 	/* WHO replies */
 	{NULL, "352", got352}, /* WHO reply */
 	{NULL, "315", got315}, /* end of WHO */
+
+	/* NAMES replies */
+	{NULL, "353", got353}, /* NAMES reply */
+	{NULL, "366", got366}, /* end of NAMES */
 
 	/* Topic info */
 	{NULL, "TOPIC", gottopic},
Index: eggdrop1.7/modules/server/channels.h
diff -u eggdrop1.7/modules/server/channels.h:1.7 eggdrop1.7/modules/server/channels.h:1.8
--- eggdrop1.7/modules/server/channels.h:1.7	Sat Mar  8 01:12:57 2003
+++ eggdrop1.7/modules/server/channels.h	Sun Jul  6 02:17:21 2003
@@ -4,6 +4,7 @@
 /* Status bits for channels. */
 #define CHANNEL_WHOLIST	1
 #define CHANNEL_BANLIST	2
+#define CHANNEL_NAMESLIST	4
 
 typedef struct {
 	char *nick;
Index: eggdrop1.7/modules/server/input.c
diff -u eggdrop1.7/modules/server/input.c:1.21 eggdrop1.7/modules/server/input.c:1.22
--- eggdrop1.7/modules/server/input.c:1.21	Thu Jun 12 22:35:15 2003
+++ eggdrop1.7/modules/server/input.c	Sun Jul  6 02:17:21 2003
@@ -87,18 +87,12 @@
 	char *arg, *name, *equalsign, *value;
 	int i;
 
-	/* We only process this once (fake or real). */
-	if (current_server.got005) return(0);
-	current_server.got005 = 1;
-
-	for (i = 0; i < current_server.nsupport; i++) {
-		free(current_server.support[i].name);
-		free(current_server.support[i].value);
-	}
-	if (current_server.support) free(current_server.support);
+	/* Some servers send multiple 005 messages, so we need to process
+	 * them all. */
+	current_server.got005++;
 
-	current_server.support = malloc(sizeof(*current_server.support) * (nargs-1));
-	current_server.nsupport = nargs-2;
+	current_server.support = realloc(current_server.support, sizeof(*current_server.support) * (current_server.nsupport+nargs-1));
+	current_server.nsupport += nargs-2;
 
 	for (i = 1; i < nargs-1; i++) {
 		arg = args[i];
@@ -166,11 +160,19 @@
 {
 	char *fake;
 
-	if (server_config.fake005 && server_config.fake005[0]) {
+	if (!current_server.got005 && server_config.fake005 && server_config.fake005[0]) {
 		fake = strdup(server_config.fake005);
 		server_parse_input(fake);
 		free(fake);
 	}
+	if (!current_server.chantypes) current_server.chantypes = strdup("#&");
+	if (!current_server.strcmp) current_server.strcmp = irccmp;
+	if (!current_server.type1modes) current_server.type1modes = strdup("b");
+	if (!current_server.type2modes) current_server.type2modes = strdup("k");
+	if (!current_server.type3modes) current_server.type3modes = strdup("l");
+	if (!current_server.type4modes) current_server.type4modes = strdup("imnprst");
+	if (!current_server.modeprefix) current_server.modeprefix = strdup("ov");
+	if (!current_server.whoprefix) current_server.whoprefix = strdup("@+");
 	return(0);
 }
 
@@ -330,10 +332,10 @@
 	if (r) return(0);
 
 	/* Skip any mode prefix to the destination (e.g. PRIVMSG @#trivia :blah). */
-	if (strchr(current_server.whoprefix, *dest)) destname = dest+1;
+	if (current_server.whoprefix && strchr(current_server.whoprefix, *dest)) destname = dest+1;
 	else destname = dest;
 
-	if (strchr(current_server.chantypes, *destname)) to_channel = 1;
+	if (current_server.chantypes && strchr(current_server.chantypes, *destname)) to_channel = 1;
 	else to_channel = 0;
 
 	/* Check if it's a ctcr. */
@@ -463,8 +465,9 @@
 		uhost = egg_mprintf("%s@%s", current_server.user, current_server.host);
 		full = egg_mprintf("%s!%s", current_server.nick, uhost);
 		u = user_lookup_by_irchost_nocache(full);
-		channel_on_quit(current_server.nick, full, u);
+		channel_on_quit(current_server.nick, uhost, u);
 		free(full);
+		free(uhost);
 	}
 
 	putlog(LOG_MSGS | LOG_SERV, "*", "-ERROR from server- %s", args[0]);
Index: eggdrop1.7/modules/server/servsock.c
diff -u eggdrop1.7/modules/server/servsock.c:1.15 eggdrop1.7/modules/server/servsock.c:1.16
--- eggdrop1.7/modules/server/servsock.c:1.15	Thu Jun 12 22:35:15 2003
+++ eggdrop1.7/modules/server/servsock.c	Sun Jul  6 02:17:21 2003
@@ -70,18 +70,26 @@
 static void disconnect_server()
 {
 	int connected = current_server.connected;
+	int i, idx = current_server.idx;
 
 	cycle_delay = server_config.cycle_delay;
 
-	current_server.connected = 0;
-	current_server.registered = 0;
-	current_server.got005 = 0;
-
-	if (current_server.idx != -1) {
-		sockbuf_delete(current_server.idx);
-		current_server.idx = -1;
+	if (current_server.server_host) free(current_server.server_host);
+	if (current_server.server_self) free(current_server.server_self);
+	if (current_server.nick) free(current_server.nick);
+	if (current_server.user) free(current_server.user);
+	if (current_server.host) free(current_server.host);
+	if (current_server.real_name) free(current_server.real_name);
+	if (current_server.pass) free(current_server.pass);
+	for (i = 0; i < current_server.nsupport; i++) {
+		free(current_server.support[i].name);
+		free(current_server.support[i].value);
 	}
+	if (current_server.support) free(current_server.support);
+	memset(&current_server, 0, sizeof(current_server));
+	current_server.idx = -1;
 
+	if (idx != -1) sockbuf_delete(idx);
 	if (connected) eggdrop_event("disconnect-server");
 }
 
----------------------- End of diff -----------------------


More information about the Changes mailing list