[cvslog] (2005-05-08 04:40:23 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Sat May 7 22:40:23 CST 2005


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2005-05-08 04:40:23 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     lib/eggdrop/eggdrop.c lib/eggdrop/ircmasks.c
     lib/eggdrop/ircmasks.h lib/eggdrop/users.c
     modules/chanserv/chanserv.c modules/chanserv/events.c
     modules/script/scriptuser.c modules/server/channel_events.c
     modules/server/channels.c modules/server/channels.h
     modules/server/dcc.c modules/server/egg_server_api.h
     modules/server/egg_server_internal.h src/main.c

Log message:

* fix some bugs with initializing mode lists and arg lists for auto-joined channels
* experimental code to help user searching based on a host (in ircmasks.c)
* use random-replacement for userhost cache management (may need tuning)

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/eggdrop.c
diff -u eggdrop1.9/lib/eggdrop/eggdrop.c:1.24 eggdrop1.9/lib/eggdrop/eggdrop.c:1.25
--- eggdrop1.9/lib/eggdrop/eggdrop.c:1.24	Sun Oct 17 00:14:06 2004
+++ eggdrop1.9/lib/eggdrop/eggdrop.c	Sat May  7 23:40:12 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: eggdrop.c,v 1.24 2004/10/17 05:14:06 stdarg Exp $";
+static const char rcsid[] = "$Id: eggdrop.c,v 1.25 2005/05/08 04:40:12 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -32,6 +32,8 @@
 
 int eggdrop_init(void)
 {
+	BT_event = bind_table_add(BTN_EVENT, 1, "s", MATCH_MASK, BIND_STACKABLE);	/* DDD	*/
+
 	config_init();
 	timer_init();
 	egg_net_init();
@@ -41,7 +43,7 @@
 	partyline_init();
 	module_init();
 	help_init();
-	BT_event = bind_table_add(BTN_EVENT, 1, "s", MATCH_MASK, BIND_STACKABLE);	/* DDD	*/
+
 	
 	return 1;
 }
Index: eggdrop1.9/lib/eggdrop/ircmasks.c
diff -u eggdrop1.9/lib/eggdrop/ircmasks.c:1.13 eggdrop1.9/lib/eggdrop/ircmasks.c:1.14
--- eggdrop1.9/lib/eggdrop/ircmasks.c:1.13	Sat Mar  5 12:14:17 2005
+++ eggdrop1.9/lib/eggdrop/ircmasks.c	Sat May  7 23:40:12 2005
@@ -18,17 +18,18 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: ircmasks.c,v 1.13 2005/03/05 18:14:17 lordares Exp $";
+static const char rcsid[] = "$Id: ircmasks.c,v 1.14 2005/05/08 04:40:12 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
 
+static int compute_hash(const char *str, int *hash1, int *hash2);
+
 int ircmask_list_clear(ircmask_list_t *list)
 {
 	ircmask_list_entry_t *entry, *next;
 
-	if (list == NULL)
-		return -1;
+	if (list == NULL) return -1;
 
 	for (entry = list->head; entry; ) {
 		next = entry->next;
@@ -62,6 +63,7 @@
 	entry->ircmask = strdup(ircmask);
 	entry->len = len;
 	entry->data = data;
+	compute_hash(ircmask, &entry->hash1, &entry->hash2);
 	if (prev) {
 		entry->next = prev->next;
 		prev->next = entry;
@@ -94,12 +96,23 @@
 int ircmask_list_find(ircmask_list_t *list, const char *irchost, void *dataptr)
 {
 	ircmask_list_entry_t *entry;
+	int hash1, hash2;
+	// ################ see if this is effective... remove later
+	static int searches = 0, stops = 0, misses = 0;
 
+	compute_hash(irchost, &hash1, &hash2);
 	for (entry = list->head; entry; entry = entry->next) {
+		searches++;
+		if (searches % 1000 == 0) putlog(LOG_MISC, "*", "ircmask_list_find: %d successful stops, %d false hits, %d total searches... efficiency = %0.1f%%", stops, misses, searches, 100.0*(float)(searches-misses)/(float)searches);
+		if ((entry->hash1 & hash1) != entry->hash1 || (entry->hash2 & hash2) != entry->hash2) {
+			stops++;
+			continue;
+		}
 		if (wild_match(entry->ircmask, irchost) > 0) {
 			*(void **)dataptr = entry->data;
 			return(0);
 		}
+		misses++;
 	}
 	*(void **)dataptr = NULL;
 	return(-1);
@@ -196,3 +209,29 @@
 	free(buf);
 	return(mask);
 }
+
+static int compute_hash(const char *str, int *hash1, int *hash2)
+{
+	unsigned int pair;
+	int last = 0;
+
+	*hash1 = *hash2 = 0;
+	for (; *str; str++) {
+		if (*str == '*' || *str == '?') {
+			last = -1;
+			continue;
+		}
+		if (last != -1) {
+			pair = (last * 71317 + ((unsigned)tolower(*str)) * 1937) % 64;
+			if (pair > 31) *hash2 |= 1 << (pair-31);
+			else *hash1 |= 1 << pair;
+		}
+		last = (unsigned) tolower(*str);
+	}
+	if (last > 0) {
+		pair = (last * 3133719) % 64;
+		if (pair > 31) *hash2 |= 1 << (pair-31);
+		else *hash1 |= 1 << pair;
+	}
+	return(0);
+}
Index: eggdrop1.9/lib/eggdrop/ircmasks.h
diff -u eggdrop1.9/lib/eggdrop/ircmasks.h:1.5 eggdrop1.9/lib/eggdrop/ircmasks.h:1.6
--- eggdrop1.9/lib/eggdrop/ircmasks.h:1.5	Thu Mar  3 12:44:47 2005
+++ eggdrop1.9/lib/eggdrop/ircmasks.h	Sat May  7 23:40:12 2005
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: ircmasks.h,v 1.5 2005/03/03 18:44:47 stdarg Exp $
+ * $Id: ircmasks.h,v 1.6 2005/05/08 04:40:12 stdarg Exp $
  */
 
 #ifndef _EGG_IRCMASKS_H_
@@ -25,7 +25,7 @@
 typedef struct ircmask_list_entry {
 	struct ircmask_list_entry *next;
 	char *ircmask;
-	int len;
+	int len, hash1, hash2;
 	void *data;
 } ircmask_list_entry_t;
 
Index: eggdrop1.9/lib/eggdrop/users.c
diff -u eggdrop1.9/lib/eggdrop/users.c:1.44 eggdrop1.9/lib/eggdrop/users.c:1.45
--- eggdrop1.9/lib/eggdrop/users.c:1.44	Sun Oct 17 00:14:06 2004
+++ eggdrop1.9/lib/eggdrop/users.c	Sat May  7 23:40:12 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: users.c,v 1.44 2004/10/17 05:14:06 stdarg Exp $";
+static const char rcsid[] = "$Id: users.c,v 1.45 2005/05/08 04:40:12 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -29,7 +29,8 @@
 	user_t *u;
 	const char *ircmask;
 	const char **entries;
-	int nentries;
+	int nentries, maxentries;
+	int rand_delete;
 } walker_info_t;
 
 typedef struct {
@@ -71,6 +72,7 @@
 static int user_get_uid();
 static int cache_check_add(const void *key, void *dataptr, void *client_data);
 static int cache_check_del(const void *key, void *dataptr, void *client_data);
+static int cache_rand_cleanup(const char *event);
 static int cache_user_del(user_t *u, const char *ircmask);
 static void append_setting(user_t *u, const char *chan, const char *flag_str, xml_node_t *extended);
 
@@ -86,6 +88,10 @@
 	BT_uflags = bind_table_add(BTN_USER_CHANGE_FLAGS, 4, "ssss", MATCH_MASK, BIND_STACKABLE);	/* DDD	*/
 	BT_uset = bind_table_add(BTN_USER_CHANGE_SETTINGS, 4, "ssss", MATCH_MASK, BIND_STACKABLE);	/* DDD	*/
 	BT_udelete = bind_table_add(BTN_USER_DELETE, 1, "U", MATCH_NONE, BIND_STACKABLE);	/* DDD	*/
+
+	/* Add binds. */
+	bind_add_simple("event", NULL, "hourly", cache_rand_cleanup);
+
 	return(0);
 }
 
@@ -396,8 +402,11 @@
 	user_t *u = *(user_t **)dataptr;
 	walker_info_t *info = client_data;
 
-	if (u == info->u && wild_match(info->ircmask, irchost)) {
-		info->entries = realloc(info->entries, sizeof(*info->entries) * (info->nentries+1));
+	if ((info->rand_delete && (rand() & 1)) || (!info->rand_delete && u == info->u && wild_match(info->ircmask, irchost))) {
+		if (info->nentries >= info->maxentries) {
+			info->maxentries = 2*info->maxentries+1;
+			info->entries = realloc(info->entries, sizeof(*info->entries) * (info->maxentries+1));
+		}
 		info->entries[info->nentries] = irchost;
 		info->nentries++;
 	}
@@ -414,6 +423,8 @@
 	info.ircmask = ircmask;
 	info.entries = NULL;
 	info.nentries = 0;
+	info.maxentries = 0;
+	info.rand_delete = 0;
 	hash_table_walk(irchost_cache_ht, cache_check_del, &info);
 	for (i = 0; i < info.nentries; i++) {
 		hash_table_remove(irchost_cache_ht, info.entries[i], NULL);
@@ -426,6 +437,28 @@
 	return(0);
 }
 
+static int cache_rand_cleanup(const char *event)
+{
+	walker_info_t info;
+	int i;
+
+	/* Check irchost_cache_ht for changes in the users. */
+	info.u = NULL;
+	info.ircmask = NULL;
+	info.entries = NULL;
+	info.nentries = 0;
+	info.maxentries = 0;
+	info.rand_delete = 1;
+	hash_table_walk(irchost_cache_ht, cache_check_del, &info);
+	putlog(LOG_MISC, "*", "user_rand_cleanup: deleting %d entries from cache", info.nentries);
+	for (i = 0; i < info.nentries; i++) {
+		hash_table_remove(irchost_cache_ht, info.entries[i], NULL);
+		free((void *)info.entries[i]);
+	}
+	if (info.entries) free(info.entries);
+	return(0);
+}
+
 int user_add_ircmask(user_t *u, const char *ircmask)
 {
 	walker_info_t info;
Index: eggdrop1.9/modules/chanserv/chanserv.c
diff -u eggdrop1.9/modules/chanserv/chanserv.c:1.2 eggdrop1.9/modules/chanserv/chanserv.c:1.3
--- eggdrop1.9/modules/chanserv/chanserv.c:1.2	Thu Mar  3 12:45:26 2005
+++ eggdrop1.9/modules/chanserv/chanserv.c	Sat May  7 23:40:12 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: chanserv.c,v 1.2 2005/03/03 18:45:26 stdarg Exp $";
+static const char rcsid[] = "$Id: chanserv.c,v 1.3 2005/05/08 04:40:12 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -202,9 +202,11 @@
 	int diff;
 
 	if (stat < 0 || stat >= CHANSERV_STAT_LEN) return(-1);
+	if (!nick || !uhost) return(-1);
 
 	if (chan) chanstats = chanserv_probe_chan(chan, 1);
 	m = chanserv_probe_member(chanstats, nick, uhost, 1);
+	if (!m) return(-1);
 
 	/* Take care of channel stats first. */
 
Index: eggdrop1.9/modules/chanserv/events.c
diff -u eggdrop1.9/modules/chanserv/events.c:1.2 eggdrop1.9/modules/chanserv/events.c:1.3
--- eggdrop1.9/modules/chanserv/events.c:1.2	Thu Mar  3 12:45:26 2005
+++ eggdrop1.9/modules/chanserv/events.c	Sat May  7 23:40:12 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: events.c,v 1.2 2005/03/03 18:45:26 stdarg Exp $";
+static const char rcsid[] = "$Id: events.c,v 1.3 2005/05/08 04:40:12 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -110,7 +110,10 @@
 {
 	modefight_t *m;
 	for (m = modefight_head; m; m = m->next) {
-		if (m->mode == mode && !strcasecmp(target, m->target) && !strcasecmp(chan, m->chan)) return(m);
+		if (m->mode != mode || strcasecmp(chan, m->chan)) continue;
+		if ((target && !m->target) || (!target && m->target)) continue;
+		if ((target && m->target) && strcasecmp(target, m->target)) continue;
+		return(m);
 	}
 	if (!create) return(NULL);
 	m = calloc(1, sizeof(*m));
@@ -119,7 +122,7 @@
 	m->lastsource = strdup(nick);
 	m->lastdir = dir;
 	m->mode = mode;
-	m->target = strdup(target);
+	if (target) m->target = strdup(target);
 	m->next = modefight_head;
 	modefight_head = m;
 	return(m);
Index: eggdrop1.9/modules/script/scriptuser.c
diff -u eggdrop1.9/modules/script/scriptuser.c:1.10 eggdrop1.9/modules/script/scriptuser.c:1.11
--- eggdrop1.9/modules/script/scriptuser.c:1.10	Sun Oct 17 00:14:07 2004
+++ eggdrop1.9/modules/script/scriptuser.c	Sat May  7 23:40:12 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: scriptuser.c,v 1.10 2004/10/17 05:14:07 stdarg Exp $";
+static const char rcsid[] = "$Id: scriptuser.c,v 1.11 2005/05/08 04:40:12 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -164,6 +164,7 @@
 	{"", "user_validhandle", script_validhandle, NULL, 1, "s", "handle", SCRIPT_INTEGER, 0},	/* DDD */
 	{"", "user_validuid", script_validuid, NULL, 1, "i", "uid", SCRIPT_INTEGER, 0},			/* DDD */
 	{"", "user_add", script_adduser, NULL, 1, "s", "handle", SCRIPT_INTEGER, 0},			/* DDD */
+	{"", "user_delete", user_delete, NULL, 1, "U", "user", SCRIPT_INTEGER, 0},			/* DDD */
 	{"", "user_addmask", user_add_ircmask, NULL, 2, "Us", "user ircmask", SCRIPT_INTEGER, 0},	/* DDD */
 	{"", "user_getmasks", script_get_ircmasks, NULL, 1, "U", "user", 0, SCRIPT_PASS_RETVAL},	/* DDD */
 	{"", "user_delmask", user_del_ircmask, NULL, 2, "Us", "user ircmask", SCRIPT_INTEGER, 0},	/* DDD */
Index: eggdrop1.9/modules/server/channel_events.c
diff -u eggdrop1.9/modules/server/channel_events.c:1.3 eggdrop1.9/modules/server/channel_events.c:1.4
--- eggdrop1.9/modules/server/channel_events.c:1.3	Thu Mar  3 12:45:26 2005
+++ eggdrop1.9/modules/server/channel_events.c	Sat May  7 23:40:13 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: channel_events.c,v 1.3 2005/03/03 18:45:26 stdarg Exp $";
+static const char rcsid[] = "$Id: channel_events.c,v 1.4 2005/05/08 04:40:13 stdarg Exp $";
  #endif
 
 #include "server.h"
@@ -63,6 +63,9 @@
 	for (i = 0; i < chan->nlists; i++) {
 		clear_masklist(chan->lists[i]);
 	}
+	if (chan->lists) free(chan->lists);
+	chan->nlists = 0;
+	chan->lists = NULL;
 }
 
 static void clear_masklist(channel_mask_list_t *l)
@@ -102,10 +105,9 @@
 	if (chan->args) free(chan->args);
 
 	chan->topic = chan->topic_nick = chan->key = NULL;
-	chan->lists = NULL;
 	chan->args = NULL;
 	chan->member_head = NULL;
-	chan->status = chan->nlists = chan->nargs = chan->nmembers = 0;
+	chan->status = chan->nargs = chan->nmembers = 0;
 	chan->limit = -1;
 }
 
@@ -517,7 +519,6 @@
 static void parse_chan_mode(char *from_nick, char *from_uhost, user_t *u, int nargs, char *args[], int trigger_bind)
 {
 	int hasarg, curarg, modify_member, modify_channel, modify_list;
-	int i;
 	channel_member_t *m;
 	char changestr[3];
 	char *dest;
@@ -589,6 +590,9 @@
 			else channel_del_mask(chan, *change, arg);
 		}
 		else if (changestr[0] == '+') {
+			channel_mode_arg_t *modearg = channel_get_arg(chan, *change);
+			if (modearg) str_redup(&modearg->value, arg);
+
 			/* + flag change that requires special handling. */
 			switch (*change) {
 				case 'k':
@@ -598,14 +602,11 @@
 					chan->limit = atoi(arg);
 					break;
 			}
-			for (i = 0; i < chan->nargs; i++) {
-				if (chan->args[i].type == *change) {
-					str_redup(&chan->args[i].value, arg);
-					break;
-				}
-			}
 		}
 		else {
+			channel_mode_arg_t *modearg = channel_get_arg(chan, *change);
+			if (modearg) str_redup(&modearg->value, NULL);
+
 			/* - flag change that requires special handling. */
 			switch (*change) {
 				case 'k':
@@ -613,14 +614,8 @@
 					chan->key = NULL;
 					break;
 				case 'l':
-					chan->limit = 0;
-					break;
-			}
-			for (i = 0; i < chan->nargs; i++) {
-				if (chan->args[i].type == *change) {
-					str_redup(&chan->args[i].value, NULL);
+					chan->limit = -1;
 					break;
-				}
 			}
 		}
 
Index: eggdrop1.9/modules/server/channels.c
diff -u eggdrop1.9/modules/server/channels.c:1.35 eggdrop1.9/modules/server/channels.c:1.36
--- eggdrop1.9/modules/server/channels.c:1.35	Thu Mar  3 12:45:26 2005
+++ eggdrop1.9/modules/server/channels.c	Sat May  7 23:40:13 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: channels.c,v 1.35 2005/03/03 18:45:26 stdarg Exp $";
+static const char rcsid[] = "$Id: channels.c,v 1.36 2005/05/08 04:40:13 stdarg Exp $";
  #endif
 
 #include "server.h"
@@ -70,7 +70,6 @@
 channel_t *channel_probe(const char *chan_name, int create)
 {
 	channel_t *chan, *prev;
-	int i;
 
 	prev = NULL;
 	for (chan = channel_head; chan; chan = chan->next) {
@@ -86,23 +85,6 @@
 	chan->settings = xml_node_new();
 	chan->settings->name = strdup("settings");
 
-	if (current_server.type1modes) {
-		chan->nlists = strlen(current_server.type1modes);
-		chan->lists = calloc(chan->nlists, sizeof(*chan->lists));
-		for (i = 0; i < chan->nlists; i++) {
-			chan->lists[i] = calloc(1, sizeof(*chan->lists[i]));
-			chan->lists[i]->type = current_server.type1modes[i];
-		}
-	}
-
-	if (current_server.type2modes) {
-		chan->nargs = strlen(current_server.type2modes);
-		chan->args = calloc(chan->nargs, sizeof(*chan->args));
-		for (i = 0; i < chan->nargs; i++) {
-			chan->args[i].type = current_server.type2modes[i];
-		}
-	}
-
 	/* Link to list. */
 	if (prev) prev->next = chan;
 	else channel_head = chan;
@@ -137,13 +119,38 @@
 	return(0);
 }
 
-channel_mask_list_t *channel_get_mask_list(channel_t *chan, char type)
+channel_mode_arg_t *channel_get_arg(channel_t *chan, int type)
+{
+	int i;
+
+	if (!chan->args && current_server.type2modes) {
+		chan->nargs = strlen(current_server.type2modes);
+		chan->args = calloc(chan->nargs, sizeof(*chan->args));
+		for (i = 0; i < chan->nargs; i++) {
+			chan->args[i].type = current_server.type2modes[i];
+		}
+	}
+	for (i = 0; i < chan->nargs; i++) {
+		if (chan->args[i].type == type) return chan->args+i;
+	}
+	return(NULL);
+}
+
+channel_mask_list_t *channel_get_mask_list(channel_t *chan, int type)
 {
 	int i;
 
+	if (!chan->lists && current_server.type1modes) {
+		chan->nlists = strlen(current_server.type1modes);
+		chan->lists = calloc(chan->nlists, sizeof(*chan->lists));
+		for (i = 0; i < chan->nlists; i++) {
+			chan->lists[i] = calloc(1, sizeof(*chan->lists[i]));
+			chan->lists[i]->type = current_server.type1modes[i];
+		}
+	}
+
 	for (i = 0; i < chan->nlists; i++) {
-		if (chan->lists[i]->type == type)
-			return(chan->lists[i]);
+		if (chan->lists[i]->type == type) return(chan->lists[i]);
 	}
 	return(NULL);
 }
@@ -174,6 +181,8 @@
 	channel_mask_t *m, *prev;
 
 	l = channel_get_mask_list(chan, type);
+	if (!l) return;
+
 	prev = NULL;
 	for (m = l->head; m; m = m->next) {
 		if (m->mask && !strcasecmp(m->mask, mask)) {
Index: eggdrop1.9/modules/server/channels.h
diff -u eggdrop1.9/modules/server/channels.h:1.23 eggdrop1.9/modules/server/channels.h:1.24
--- eggdrop1.9/modules/server/channels.h:1.23	Thu Mar  3 12:45:26 2005
+++ eggdrop1.9/modules/server/channels.h	Sat May  7 23:40:13 2005
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: channels.h,v 1.23 2005/03/03 18:45:26 stdarg Exp $
+ * $Id: channels.h,v 1.24 2005/05/08 04:40:13 stdarg Exp $
  */
 
 #ifndef _EGG_MOD_SERVER_CHANNELS_H_
@@ -64,7 +64,8 @@
 extern xml_node_t *channel_get_node(channel_t *chan, ...);
 extern int channel_mode(const char *chan_name, const char *nick, char *buf);
 extern int channel_mode_arg(const char *chan_name, int type, const char **value);
-extern channel_mask_list_t *channel_get_mask_list(channel_t *chan, char type);
+extern channel_mode_arg_t *channel_get_arg(channel_t *chan, int type);
+extern channel_mask_list_t *channel_get_mask_list(channel_t *chan, int type);
 extern void channel_add_mask(channel_t *chan, char type, const char *mask, const char *set_by, int time);
 extern void channel_del_mask(channel_t *chan, char type, const char *mask);
 
Index: eggdrop1.9/modules/server/dcc.c
diff -u eggdrop1.9/modules/server/dcc.c:1.21 eggdrop1.9/modules/server/dcc.c:1.22
--- eggdrop1.9/modules/server/dcc.c:1.21	Thu Jun 24 01:19:56 2004
+++ eggdrop1.9/modules/server/dcc.c	Sat May  7 23:40:13 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: dcc.c,v 1.21 2004/06/24 06:19:56 wcc Exp $";
+static const char rcsid[] = "$Id: dcc.c,v 1.22 2005/05/08 04:40:13 stdarg Exp $";
 #endif
 
 #include <unistd.h>
@@ -49,10 +49,11 @@
 	/* A bunch of stats. */
 	int bytes_sent, bytes_left;
 	int snapshot_bytes[5];
-	int snapshot_counter, last_snapshot;
+	int snapshot_counter;
+	long last_snapshot;
 	int acks, bytes_acked;
-	int resumed_at;
-	int request_time, connect_time;
+	long resumed_at;
+	long request_time, connect_time;
 } dcc_send_t;
 
 static dcc_send_t *dcc_send_head = NULL;
@@ -434,7 +435,8 @@
 int dcc_send_info(int idx, int field, void *valueptr)
 {
 	dcc_send_t *send;
-	int i, n, now;
+	int i, n;
+	long now;
 
 	if (!valueptr)
 		return(-1);
Index: eggdrop1.9/modules/server/egg_server_api.h
diff -u eggdrop1.9/modules/server/egg_server_api.h:1.5 eggdrop1.9/modules/server/egg_server_api.h:1.6
--- eggdrop1.9/modules/server/egg_server_api.h:1.5	Thu Mar  3 12:45:26 2005
+++ eggdrop1.9/modules/server/egg_server_api.h	Sat May  7 23:40:13 2005
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: egg_server_api.h,v 1.5 2005/03/03 18:45:26 stdarg Exp $
+ * $Id: egg_server_api.h,v 1.6 2005/05/08 04:40:13 stdarg Exp $
  */
 
 #ifndef _EGG_MOD_SERVER_API_H_
@@ -53,7 +53,7 @@
 
 	char *nick;
 	char *uhost;
-	int join_time;
+	long join_time;
 	flags_t mode;
 } channel_member_t;
 
@@ -62,8 +62,8 @@
 	char *mask;
 	char *set_by;
 /* FIXME - these should be long, not int. (EGGTIMEVALT) */
-	int time;
-	int last_used;
+	long time;
+	long last_used;
 } channel_mask_t;
 
 typedef struct channel_mask_list {
@@ -84,7 +84,7 @@
 	char *name;
 
 	char *topic, *topic_nick;	/* Topic and who set it. */
-	int topic_time;			/* When it was set. */
+	long topic_time;		/* When it was set. */
 
 	flags_t mode;			/* Mode bits. */
 	int limit;			/* Channel limit. */
Index: eggdrop1.9/modules/server/egg_server_internal.h
diff -u eggdrop1.9/modules/server/egg_server_internal.h:1.8 eggdrop1.9/modules/server/egg_server_internal.h:1.9
--- eggdrop1.9/modules/server/egg_server_internal.h:1.8	Thu Mar  3 12:45:26 2005
+++ eggdrop1.9/modules/server/egg_server_internal.h	Sat May  7 23:40:13 2005
@@ -38,6 +38,7 @@
 #define channel_on_leave server_LTX_channel_on_leave
 #define channel_on_quit server_LTX_channel_on_quit
 #define channel_on_nick server_LTX_channel_on_nick
+#define channel_get_arg server_LTX_channel_get_arg
 #define channel_get_mask_list server_LTX_channel_get_mask_list
 #define channel_add_mask server_LTX_channel_add_mask
 #define channel_del_mask server_LTX_channel_del_mask
Index: eggdrop1.9/src/main.c
diff -u eggdrop1.9/src/main.c:1.186 eggdrop1.9/src/main.c:1.187
--- eggdrop1.9/src/main.c:1.186	Sun Oct 17 00:14:07 2004
+++ eggdrop1.9/src/main.c	Sat May  7 23:40:13 2005
@@ -19,7 +19,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: main.c,v 1.186 2004/10/17 05:14:07 stdarg Exp $";
+static const char rcsid[] = "$Id: main.c,v 1.187 2005/05/08 04:40:13 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -235,16 +235,15 @@
 		if (i > 1) putlog(LOG_MISC, "*", _("Warning: timer drift (%d minutes)."), i);
 
 		miltime = (nowtm.tm_hour * 100) + (nowtm.tm_min);
-		if (nowtm.tm_min % 5 == 0) { /* 5 minutes */
-			eggdrop_event("5minutely");
-			if (!miltime) { /* At midnight */
-				char s[25];
-
-				strlcpy(s, ctime(&now), sizeof s);
-				putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20);
-				eggdrop_event("backup");
-				eggdrop_event("daily");
-			}
+		if (nowtm.tm_min % 5 == 0) eggdrop_event("5minutely");
+		if (nowtm.tm_min == 0) eggdrop_event("hourly");
+		if (!miltime) { /* At midnight */
+			char s[25];
+
+			strlcpy(s, ctime(&now), sizeof s);
+			putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20);
+			eggdrop_event("backup");
+			eggdrop_event("daily");
 		}
 	}
 	return(0);
----------------------- End of diff -----------------------



More information about the Changes mailing list