[cvslog] (2003-06-18 04:10:33 UTC) Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Tue Jun 17 22:10:33 CST 2003


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2003-06-18 04:10:33 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     lib/eggdrop/Makefile.am lib/eggdrop/binds.c lib/eggdrop/eggdns.c
     lib/eggdrop/eggdns.h lib/eggdrop/eggnet.c lib/eggdrop/eggnet.h
     lib/eggdrop/partyline.h lib/eggdrop/partymember.c
     modules/server/dcc.c modules/telnetparty/telnetparty.c
     src/core_party.c

Log message:



---------------------- diff included ----------------------
Index: eggdrop1.7/lib/eggdrop/Makefile.am
diff -u eggdrop1.7/lib/eggdrop/Makefile.am:1.22 eggdrop1.7/lib/eggdrop/Makefile.am:1.23
--- eggdrop1.7/lib/eggdrop/Makefile.am:1.22	Wed Jun 11 03:37:38 2003
+++ eggdrop1.7/lib/eggdrop/Makefile.am	Tue Jun 17 23:10:22 2003
@@ -1,8 +1,8 @@
-# $Id: Makefile.am,v 1.22 2003/06/11 08:37:38 stdarg Exp $
+# $Id: Makefile.am,v 1.23 2003/06/18 04:10:22 stdarg Exp $
 
 MAINTAINERCLEANFILES	= Makefile.in
 
-INCLUDES		= -I$(top_srcdir) -I$(top_srcdir)/lib
+INCLUDES		= -I$(top_srcdir) -I$(top_srcdir)/lib $(INCLTDL)
 
 lib_LTLIBRARIES 	= libeggdrop.la
 
@@ -40,6 +40,4 @@
 			xml.c xmlread.c xmlwrite.c xml.h
 
 libeggdrop_la_LIBADD	= @LIBLTDL@ \
-			$(top_builddir)/lib/compat/libcompat.la \
-		   	$(top_builddir)/lib/egglib/libegg.la
-
+			$(top_builddir)/lib/compat/libcompat.la
Index: eggdrop1.7/lib/eggdrop/binds.c
diff -u eggdrop1.7/lib/eggdrop/binds.c:1.7 eggdrop1.7/lib/eggdrop/binds.c:1.8
--- eggdrop1.7/lib/eggdrop/binds.c:1.7	Sun Jun 15 00:43:23 2003
+++ eggdrop1.7/lib/eggdrop/binds.c	Tue Jun 17 23:10:22 2003
@@ -302,7 +302,7 @@
 	void *args[11];
 	bind_entry_t *entry, *next, *winner = NULL;
 	int i, cmp, retval;
-	int tie = 0, matchlen = 0, masklen = 0;
+	int tie = 0, matchlen = 0;
 	va_list ap;
 
 	check_bind_executing++;
@@ -340,10 +340,10 @@
 		}
 		else if (table->match_type & MATCH_PARTIAL) {
 			cmp = 1;
-			masklen = strlen(entry->mask);
-			if (!strncasecmp(match, entry->mask, masklen < matchlen ? masklen : matchlen)) {
+			if (!strncasecmp(match, entry->mask, matchlen)) {
 				winner = entry;
-				if (masklen == matchlen) {
+				/* Is it an exact match? */
+				if (!entry->mask[matchlen]) {
 					tie = 1;
 					break;
 				}
Index: eggdrop1.7/lib/eggdrop/eggdns.c
diff -u eggdrop1.7/lib/eggdrop/eggdns.c:1.7 eggdrop1.7/lib/eggdrop/eggdns.c:1.8
--- eggdrop1.7/lib/eggdrop/eggdns.c:1.7	Mon Jun  9 23:43:18 2003
+++ eggdrop1.7/lib/eggdrop/eggdns.c	Tue Jun 17 23:10:22 2003
@@ -10,17 +10,76 @@
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
-#include "my_socket.h"
-#include "sockbuf.h"
-#include "eggnet.h"
-#include "eggdns.h"
+#include <eggdrop/eggdrop.h>
 
+typedef struct {
+	char **list;
+	int len;
+} dns_answer_t;
+
+typedef struct dns_query {
+	struct dns_query *next;
+	char *query;
+	int id;
+	int remaining;
+	dns_answer_t answer;
+	dns_callback_t callback;
+	void *client_data;
+} dns_query_t;
+
+typedef struct {
+	unsigned short id;
+	unsigned short flags;
+	unsigned short question_count;
+	unsigned short answer_count;
+	unsigned short ns_count;
+	unsigned short ar_count;
+} dns_header_t;
+
+typedef struct {
+	/* char name[]; */
+	unsigned short type;
+	unsigned short class;
+	int ttl;
+	unsigned short rdlength;
+	/* char rdata[]; */
+} dns_rr_t;
+
+/* Entries from resolv.conf */
+typedef struct dns_server {
+	char *ip;
+	int idx;
+} dns_server_t;
+
+/* Entries from hosts */
+typedef struct {
+	char *host, *ip;
+} dns_host_t;
+
+static int query_id = 1;
+static dns_header_t _dns_header = {0};
+static dns_query_t *query_head = NULL;
+static dns_host_t *hosts = NULL;
+static int nhosts = 0;
+static dns_server_t *servers = NULL;
+static int nservers = 0;
+static int cur_server = -1;
+
+static char separators[] = " ,\t\r\n";
+
+static int dns_idx = -1;
+static const char *dns_ip = NULL;
+
+static int make_header(char *buf, int id);
+static int cut_host(const char *host, char *query);
+static int reverse_ip(const char *host, char *reverse);
+static void read_resolv(char *fname);
+static void read_hosts(char *fname);
 static void get_dns_idx();
 static int dns_on_read(void *client_data, int idx, char *buf, int len);
 static int dns_on_eof(void *client_data, int idx, int err, const char *errmsg);
 static const char *dns_next_server();
 static void parse_reply(char *response, int nbytes);
-static int dns_make_query(const char *host, int type, char **buf, int *query_len, int (*callback)(), void *client_data);
 
 static sockbuf_handler_t dns_handler = {
 	"dns",
@@ -28,8 +87,24 @@
 	dns_on_read, NULL
 };
 
-static int dns_idx = -1;
-static const char *dns_ip = NULL;
+static void answer_init(dns_answer_t *answer)
+{
+	memset(answer, 0, sizeof(*answer));
+}
+
+static void answer_add(dns_answer_t *answer, const char *what)
+{
+	answer->list = realloc(answer->list, sizeof(*answer->list) * (answer->len+1));
+	answer->list[answer->len] = strdup(what);
+	answer->len++;
+}
+
+static void answer_free(dns_answer_t *answer)
+{
+	int i;
+	for (i = 0; i < answer->len; i++) free(answer->list[i]);
+	if (answer->list) free(answer->list);
+}
 
 static void get_dns_idx()
 {
@@ -63,45 +138,132 @@
 /* Perform an async dns lookup. This is host -> ip. For ip -> host, use
  * egg_dns_reverse(). We return a dns id that you can use to cancel the
  * lookup. */
-int egg_dns_lookup(const char *host, int timeout, int (*callback)(), void *client_data)
+int egg_dns_lookup(const char *host, int timeout, dns_callback_t callback, void *client_data)
 {
-	char *query;
-	int len, id;
+	char buf[512];
+	dns_query_t *q;
+	int i, len;
 
 	if (socket_valid_ip(host)) {
 		/* If it's already an ip, we're done. */
-		callback(client_data, host, host);
+		dns_answer_t answer;
+
+		answer_init(&answer);
+		answer_add(&answer, host);
+		callback(client_data, host, answer.list);
+		answer_free(&answer);
 		return(-1);
 	}
-	/* Nope, we have to actually do a lookup. */
-	id = dns_make_query(host, DNS_IPV4, &query, &len, callback, client_data);
-	if (id != -1) {
-		egg_dns_send(query, len);
-		free(query);
+
+	/* Ok, now see if it's in our host cache. */
+	for (i = 0; i < nhosts; i++) {
+		if (!strcasecmp(host, hosts[i].host)) {
+			dns_answer_t answer;
+
+			answer_init(&answer);
+			answer_add(&answer, hosts[i].ip);
+			callback(client_data, host, answer.list);
+			answer_free(&answer);
+			return(-1);
+		}
 	}
-	return(id);
+
+	/* Allocate our query struct. */
+	q = calloc(1, sizeof(*q));
+	q->id = query_id;
+	query_id++;
+	q->query = strdup(host);
+	q->callback = callback;
+	q->client_data = client_data;
+	q->next = query_head;
+	query_head = q;
+
+	/* Send the ipv4 query. */
+	q->remaining = 1;
+	len = make_header(buf, q->id);
+	len += cut_host(host, buf + len);
+	buf[len] = 0; len++; buf[len] = 1; len++;
+	buf[len] = 0; len++; buf[len] = 1; len++;
+
+	egg_dns_send(buf, len);
+
+#ifdef IPV6
+	/* Now send the ipv6 query. */
+	q->remaining++;
+	len = make_header(buf, q->id);
+	len += cut_host(host, buf + len);
+	buf[len] = 0; len++; buf[len] = 28; len++;
+	buf[len] = 0; len++; buf[len] = 1; len++;
+
+	egg_dns_send(buf, len);
+#endif
+
+	return(q->id);
 }
 
 /* Perform an async dns reverse lookup. This does ip -> host. For host -> ip
  * use egg_dns_lookup(). We return a dns id that you can use to cancel the
  * lookup. */
-int egg_dns_reverse(const char *ip, int timeout, int (*callback)(), void *client_data)
+int egg_dns_reverse(const char *ip, int timeout, dns_callback_t callback, void *client_data)
 {
-	char *query;
-	int len, id;
+	dns_query_t *q;
+	char buf[512], *reversed_ip;
+	int i, len;
 
 	if (!socket_valid_ip(ip)) {
 		/* If it's not a valid ip, don't even make the request. */
 		callback(client_data, ip, NULL);
 		return(-1);
 	}
-	/* Nope, we have to actually do a lookup. */
-	id = dns_make_query(ip, DNS_REVERSE, &query, &len, callback, client_data);
-	if (id != -1) {
-		egg_dns_send(query, len);
-		free(query);
+
+	/* Ok, see if we have it in our host cache. */
+	for (i = 0; i < nhosts; i++) {
+		if (!strcasecmp(hosts[i].ip, ip)) {
+			dns_answer_t answer;
+
+			answer_init(&answer);
+			answer_add(&answer, hosts[i].host);
+			callback(client_data, ip, answer.list);
+			answer_free(&answer);
+			return(-1);
+		}
+	}
+
+	/* We need to transform the ip address into the proper form
+	 * for reverse lookup. */
+	if (strchr(ip, ':')) {
+		char temp[65];
+
+		socket_ipv6_to_dots(ip, temp);
+		reversed_ip = malloc(strlen(temp) + 10);
+		reverse_ip(temp, reversed_ip);
+		strcat(reversed_ip, ".in6.arpa");
+	}
+	else {
+		reversed_ip = malloc(strlen(ip) + 14);
+		reverse_ip(ip, reversed_ip);
+		strcat(reversed_ip, ".in-addr.arpa");
 	}
-	return(id);
+
+	len = make_header(buf, query_id);
+	len += cut_host(reversed_ip, buf + len);
+	buf[len] = 0; len++; buf[len] = 12; len++;
+	buf[len] = 0; len++; buf[len] = 1; len++;
+
+	free(reversed_ip);
+
+	q = calloc(1, sizeof(*q));
+	q->id = query_id;
+	query_id++;
+	q->query = strdup(ip);
+	q->callback = callback;
+	q->client_data = client_data;
+	q->next = query_head;
+	query_head = q;
+
+	egg_dns_send(buf, len);
+
+	return(q->id);
 }
 
 static int dns_on_read(void *client_data, int idx, char *buf, int len)
@@ -118,62 +280,11 @@
 	return(0);
 }
 
-typedef struct dns_query {
-	struct dns_query *next;
-	char *query;
-	int id;
-	int (*callback)(void *client_data, const char *query, const char *result);
-	void *client_data;
-} dns_query_t;
-
-typedef struct {
-	unsigned short id;
-	unsigned short flags;
-	unsigned short question_count;
-	unsigned short answer_count;
-	unsigned short ns_count;
-	unsigned short ar_count;
-} dns_header_t;
-
-typedef struct {
-	/* char name[]; */
-	unsigned short type;
-	unsigned short class;
-	int ttl;
-	unsigned short rdlength;
-	/* char rdata[]; */
-} dns_rr_t;
-
-/* Entries from resolv.conf */
-typedef struct dns_server {
-	char *ip;
-	int idx;
-} dns_server_t;
-
-/* Entries from hosts */
-typedef struct {
-	char *host, *ip;
-} dns_host_t;
-
-static int query_id = 1;
-static dns_header_t _dns_header = {0};
-static dns_query_t *query_head = NULL;
-static dns_host_t *hosts = NULL;
-static int nhosts = 0;
-static dns_server_t *servers = NULL;
-static int nservers = 0;
-static int cur_server = -1;
-
-static char separators[] = " ,\t\r\n";
-
-static void read_resolv(char *fname);
-static void read_hosts(char *fname);
 
 /* Read in .hosts and /etc/hosts and .resolv.conf and /etc/resolv.conf */
 int egg_dns_init()
 {
 	_dns_header.flags = htons(1 << 8 | 1 << 7);
-	_dns_header.question_count = htons(1);
 	read_resolv("/etc/resolv.conf");
 	read_resolv(".resolv.conf");
 	read_hosts("/etc/hosts");
@@ -254,6 +365,7 @@
 
 static int make_header(char *buf, int id)
 {
+	_dns_header.question_count = htons(1);
 	_dns_header.id = htons(id);
 	memcpy(buf, &_dns_header, 12);
 	return(12);
@@ -304,77 +416,6 @@
 	}
 }
 
-static int dns_make_query(const char *host, int type, char **buf, int *query_len, int (*callback)(), void *client_data)
-{
-	char *newhost;
-	int len = 0;
-	int ns_type = 0;
-	int i;
-	dns_query_t *q;
-
-	*buf = NULL;
-	*query_len = 0;
-	if (type == DNS_REVERSE) {
-		/* First see if we have it in our host cache. */
-		for (i = 0; i < nhosts; i++) {
-			if (!strcasecmp(hosts[i].ip, host)) {
-				callback(client_data, host, hosts[i].host);
-				return(-1);
-			}
-		}
-
-		/* We need to transform the ip address into the proper form
-		 * for reverse lookup. */
-		if (strchr(host, ':')) {
-			char temp[65];
-
-			socket_ipv6_to_dots(host, temp);
-			newhost = malloc(strlen(temp) + 10);
-			reverse_ip(temp, newhost);
-			strcat(newhost, ".in6.arpa");
-		}
-		else {
-			newhost = (char *)malloc(strlen(host) + 14);
-			reverse_ip(host, newhost);
-			strcat(newhost, ".in-addr.arpa");
-		}
-		ns_type = 12; /* PTR (reverse lookup) */
-	}
-	else {
-		/* First see if it's in our host cache. */
-		for (i = 0; i < nhosts; i++) {
-			if (!strcasecmp(host, hosts[i].host)) {
-				callback(client_data, host, hosts[i].ip);
-				return(-1);
-			}
-		}
-		if (type == DNS_IPV4) ns_type = 1; /* IPv4 */
-		else if (type == DNS_IPV6) ns_type = 28; /* IPv6 */
-		else return(-1);
-
-		newhost = (char *)host;
-	}
-
-	*buf = (char *)malloc(strlen(newhost) + 512);
-	len = make_header(*buf, query_id);
-	len += cut_host(newhost, *buf + len);
-	(*buf)[len] = 0; len++; (*buf)[len] = ns_type; len++;
-	(*buf)[len] = 0; len++; (*buf)[len] = 1; len++;
-	*query_len = len;
-
-	if (newhost != host) free(newhost);
-
-	q = calloc(1, sizeof(*q));
-	q->id = query_id;
-	query_id++;
-	q->query = strdup(host);
-	q->callback = callback;
-	q->client_data = client_data;
-	if (query_head) q->next = query_head->next;
-	query_head = q;
-	return(q->id);
-}
-
 int egg_dns_cancel(int id, int issue_callback)
 {
 	dns_query_t *q, *prev;
@@ -410,29 +451,11 @@
 	return(ptr - start);
 }
 
-static void got_answer(int id, char *answer)
-{
-	dns_query_t *q, *prev;
-
-	prev = NULL;
-	for (q = query_head; q; q = q->next) {
-		if (q->id == id) break;
-		prev = q;
-	}
-	if (!q) return;
-
-	if (prev) prev->next = q->next;
-	else query_head = q->next;
-
-	q->callback(q->client_data, q->query, answer);
-	free(q->query);
-	free(q);
-}
-
 static void parse_reply(char *response, int nbytes)
 {
 	dns_header_t header;
 	dns_rr_t reply;
+	dns_query_t *q, *prev;
 	char result[512];
 	unsigned char *ptr;
 	int i;
@@ -442,13 +465,24 @@
 	ptr += 12;
 
 	header.id = ntohs(header.id);
+	header.flags = ntohs(header.flags);
 	header.question_count = ntohs(header.question_count);
 	header.answer_count = ntohs(header.answer_count);
 
-	/* Pass over the question. */
-	ptr += skip_name(ptr);
-	ptr += 4;
-	/* End of question. */
+	/* Find our copy of the query. */
+	prev = NULL;
+	for (q = query_head; q; q = q->next) {
+		if (q->id == header.id) break;
+		prev = q;
+	}
+	if (!q) return;
+
+	/* Pass over the questions. */
+	for (i = 0; i < header.question_count; i++) {
+		ptr += skip_name(ptr);
+		ptr += 4;
+	}
+	/* End of questions. */
 
 	for (i = 0; i < header.answer_count; i++) {
 		result[0] = 0;
@@ -461,13 +495,12 @@
 		if (reply.type == 1) {
 			/*fprintf(fp, "ipv4 reply\n");*/
 			inet_ntop(AF_INET, ptr, result, 512);
-			got_answer(header.id, result);
-			return;
+			answer_add(&q->answer, result);
 		}
 		else if (reply.type == 28) {
 			/*fprintf(fp, "ipv6 reply\n");*/
 			inet_ntop(AF_INET6, ptr, result, 512);
-			got_answer(header.id, result);
+			answer_add(&q->answer, result);
 			return;
 		}
 		else if (reply.type == 12) {
@@ -493,12 +526,23 @@
 			}
 			if (strlen(result)) {
 				result[strlen(result)-1] = 0;
-				got_answer(header.id, result);
-				return;
+				answer_add(&q->answer, result);
 			}
 			ptr = placeholder;
 		}
 		ptr += reply.rdlength;
 	}
-	got_answer(header.id, NULL);
+
+	q->remaining--;
+	/* Don't continue if we haven't gotten all expected replies. */
+	if (q->remaining > 0) return;
+
+	/* Ok, we have, so now issue the callback with the answers. */
+	if (prev) prev->next = q->next;
+	else query_head = q->next;
+
+	q->callback(q->client_data, q->query, q->answer.list);
+	answer_free(&q->answer);
+	free(q->query);
+	free(q);
 }
Index: eggdrop1.7/lib/eggdrop/eggdns.h
diff -u eggdrop1.7/lib/eggdrop/eggdns.h:1.1 eggdrop1.7/lib/eggdrop/eggdns.h:1.2
--- eggdrop1.7/lib/eggdrop/eggdns.h:1.1	Thu Sep 19 21:06:25 2002
+++ eggdrop1.7/lib/eggdrop/eggdns.h	Tue Jun 17 23:10:22 2003
@@ -7,10 +7,11 @@
 
 #define DNS_PORT	53
 
+typedef int (*dns_callback_t)(void *client_data, const char *query, char **result);
 int egg_dns_init();
 void egg_dns_send(char *query, int len);
-int egg_dns_lookup(const char *host, int timeout, int (*callback)(), void *client_data);
-int egg_dns_reverse(const char *ip, int timeout, int (*callback)(), void *client_data);
+int egg_dns_lookup(const char *host, int timeout, dns_callback_t callback, void *client_data);
+int egg_dns_reverse(const char *ip, int timeout, dns_callback_t callback, void *client_data);
 int egg_dns_cancel(int id, int issue_callback);
 
 #endif /* _EGGDNS_H_ */
Index: eggdrop1.7/lib/eggdrop/eggnet.c
diff -u eggdrop1.7/lib/eggdrop/eggnet.c:1.6 eggdrop1.7/lib/eggdrop/eggnet.c:1.7
--- eggdrop1.7/lib/eggdrop/eggnet.c:1.6	Mon May 12 06:54:53 2003
+++ eggdrop1.7/lib/eggdrop/eggnet.c	Tue Jun 17 23:10:22 2003
@@ -22,7 +22,7 @@
 	int port;
 } connect_info_t;
 
-static int connect_host_resolved(void *client_data, const char *host, const char *ip);
+static int connect_host_resolved(void *client_data, const char *host, char **ips);
 static int egg_connect_timeout(void *client_data);
 static int egg_on_connect(void *client_data, int idx, const char *peer_ip, int peer_port);
 static int egg_on_eof(void *client_data, int idx, int err, const char *errmsg);
@@ -115,7 +115,7 @@
 	connect_info->idx = idx;
 	sockbuf_attach_filter(connect_info->idx, &eggnet_connect_filter, connect_info);
 	connect_info->timer_id = -1;
-	connect_info->dns_id = egg_dns_lookup(host, DNS_IPV4, connect_host_resolved, connect_info);
+	connect_info->dns_id = egg_dns_lookup(host, -1, connect_host_resolved, connect_info);
 	if (timeout > 0) {
 		char buf[128];
 
@@ -136,14 +136,14 @@
 	return(idx);
 }
 
-static int connect_host_resolved(void *client_data, const char *host, const char *ip)
+static int connect_host_resolved(void *client_data, const char *host, char **ips)
 {
 	connect_info_t *connect_info = client_data;
 	int sock, idx;
 
 	connect_info->dns_id = -1;
 
-	if (!ip) {
+	if (!ips || !ips[0]) {
 		idx = connect_info->idx;
 		detach(client_data, idx);
 		sockbuf_on_eof(idx, EGGNET_LEVEL, -1, "Could not resolve host");
@@ -152,7 +152,7 @@
 
 	/* Proxy/firewall/vhost code goes here. */
 
-	sock = socket_create(ip, connect_info->port, NULL, 0, SOCKET_CLIENT|SOCKET_TCP|SOCKET_NONBLOCK);
+	sock = socket_create(ips[0], connect_info->port, NULL, 0, SOCKET_CLIENT|SOCKET_TCP|SOCKET_NONBLOCK);
 	if (sock < 0) {
 		idx = connect_info->idx;
 		detach(client_data, idx);
Index: eggdrop1.7/lib/eggdrop/eggnet.h
diff -u eggdrop1.7/lib/eggdrop/eggnet.h:1.4 eggdrop1.7/lib/eggdrop/eggnet.h:1.5
--- eggdrop1.7/lib/eggdrop/eggnet.h:1.4	Tue Feb 25 00:52:19 2003
+++ eggdrop1.7/lib/eggdrop/eggnet.h	Tue Jun 17 23:10:22 2003
@@ -9,6 +9,5 @@
 int egg_connect(const char *host, int port, int timeout);
 int egg_reconnect(int idx, const char *host, int port, int timeout);
 int egg_ident_lookup(const char *ip, int their_port, int our_port, int timeout, int (*callback)(), void *client_data);
-int egg_dns_lookup(const char *host_or_ip, int timeout, int (*callback)(), void *client_data);
 
 #endif /* _EGGNET_H_ */
Index: eggdrop1.7/lib/eggdrop/partyline.h
diff -u eggdrop1.7/lib/eggdrop/partyline.h:1.8 eggdrop1.7/lib/eggdrop/partyline.h:1.9
--- eggdrop1.7/lib/eggdrop/partyline.h:1.8	Sun Jun 15 00:43:23 2003
+++ eggdrop1.7/lib/eggdrop/partyline.h	Tue Jun 17 23:10:22 2003
@@ -81,9 +81,9 @@
 partymember_common_t *partychan_get_common(partymember_t *p);
 int partychan_free_common(partymember_common_t *common);
 
-
 partymember_t *partymember_lookup_pid(int pid);
 partymember_t *partymember_new(int pid, user_t *user, const char *nick, const char *ident, const char *host, partyline_event_t *handler, void *client_data);
+int partymember_delete(partymember_t *p, const char *text);
 int partymember_update_info(partymember_t *p, const char *ident, const char *host);
 int partymember_who(int **pids, int *len);
 int partymember_write_pid(int pid, const char *text, int len);
Index: eggdrop1.7/lib/eggdrop/partymember.c
diff -u eggdrop1.7/lib/eggdrop/partymember.c:1.5 eggdrop1.7/lib/eggdrop/partymember.c:1.6
--- eggdrop1.7/lib/eggdrop/partymember.c:1.5	Sun Jun 15 00:43:23 2003
+++ eggdrop1.7/lib/eggdrop/partymember.c	Tue Jun 17 23:10:22 2003
@@ -68,6 +68,11 @@
 {
 	int pid;
 
+	for (pid = 0; partymember_lookup_pid(pid); pid++) {
+		;
+	}
+	return(pid);
+#if 0
 	while (partymember_lookup_pid(g_pid)) {
 		g_pid++;
 		if (g_pid >= PID_WRAPAROUND) g_pid = 0;
@@ -75,6 +80,7 @@
 	pid = g_pid++;
 	if (g_pid >= PID_WRAPAROUND) g_pid = 0;
 	return(pid);
+#endif
 }
 
 partymember_t *partymember_new(int pid, user_t *user, const char *nick, const char *ident, const char *host, partyline_event_t *handler, void *client_data)
Index: eggdrop1.7/modules/server/dcc.c
diff -u eggdrop1.7/modules/server/dcc.c:1.14 eggdrop1.7/modules/server/dcc.c:1.15
--- eggdrop1.7/modules/server/dcc.c:1.14	Thu Jun 12 22:35:15 2003
+++ eggdrop1.7/modules/server/dcc.c	Tue Jun 17 23:10:23 2003
@@ -94,9 +94,9 @@
 	NULL, dcc_recv_delete
 };
 
-static int dcc_dns_callback(void *client_data, const char *host, const char *ip)
+static int dcc_dns_callback(void *client_data, const char *host, char **ips)
 {
-	if (ip) str_redup(&current_server.myip, ip);
+	if (ips && ips[0]) str_redup(&current_server.myip, ips[0]);
 	else str_redup(&current_server.myip, "127.0.0.1");
 	socket_ip_to_uint(current_server.myip, &current_server.mylongip);
 	return(0);
Index: eggdrop1.7/modules/telnetparty/telnetparty.c
diff -u eggdrop1.7/modules/telnetparty/telnetparty.c:1.1 eggdrop1.7/modules/telnetparty/telnetparty.c:1.2
--- eggdrop1.7/modules/telnetparty/telnetparty.c:1.1	Sat Jun  7 22:21:23 2003
+++ eggdrop1.7/modules/telnetparty/telnetparty.c	Tue Jun 17 23:10:23 2003
@@ -24,12 +24,13 @@
 static int telnet_on_newclient(void *client_data, int idx, int newidx, const char *peer_ip, int peer_port);
 static int telnet_on_read(void *client_data, int idx, char *data, int len);
 static int telnet_on_eof(void *client_data, int idx, int err, const char *errmsg);
+static int telnet_on_delete(void *client_data, int idx);
 static int telnet_filter_read(void *client_data, int idx, char *data, int len);
 static int telnet_filter_write(void *client_data, int idx, const char *data, int len);
 static int telnet_filter_delete(void *client_data, int idx);
 
 static int ident_result(void *client_data, const char *ip, int port, const char *reply);
-static int dns_result(void *client_data, const char *ip, const char *host);
+static int dns_result(void *client_data, const char *ip, char **hosts);
 static int process_results(telnet_session_t *session);
 
 static sockbuf_handler_t server_handler = {
@@ -50,7 +51,8 @@
 static sockbuf_handler_t client_handler = {
 	"telnet",
 	NULL, telnet_on_eof, NULL,
-	telnet_on_read, NULL
+	telnet_on_read, NULL,
+	telnet_on_delete
 };
 
 int telnet_init()
@@ -114,11 +116,14 @@
 	return(0);
 }
 
-static int dns_result(void *client_data, const char *ip, const char *host)
+static int dns_result(void *client_data, const char *ip, char **hosts)
 {
 	telnet_session_t *session = client_data;
+	const char *host;
+
+	if (!hosts || !hosts[0]) host = ip;
+	else host = hosts[0];
 
-	if (!host) host = ip;
 	session->host = strdup(host);
 	process_results(session);
 	return(0);
@@ -203,7 +208,7 @@
 	return(0);
 }
 
-static int telnet_on_delete(void *client_data)
+static int telnet_on_delete(void *client_data, int idx)
 {
 	telnet_session_t *session = client_data;
 
Index: eggdrop1.7/src/core_party.c
diff -u eggdrop1.7/src/core_party.c:1.7 eggdrop1.7/src/core_party.c:1.8
--- eggdrop1.7/src/core_party.c:1.7	Sun Jun 15 00:43:24 2003
+++ eggdrop1.7/src/core_party.c	Tue Jun 17 23:10:23 2003
@@ -72,7 +72,7 @@
 	qsort(pids, len, sizeof(int), intsorter);
 	for (i = 0; i < len; i++) {
 		who = partymember_lookup_pid(pids[i]);
-		partymember_printf(p, "  [%.5d] %s (%s@%s)", who->pid, who->nick, who->ident, who->host);
+		partymember_printf(p, "  [%5d] %s (%s@%s)", who->pid, who->nick, who->ident, who->host);
 	}
 	free(pids);
 	return(0);
----------------------- End of diff -----------------------


More information about the Changes mailing list