[cvslog] (2002-10-10 04:42:09 UTC) Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Wed Oct 9 23:43:00 CST 2002


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2002-10-10 04:42:09 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     lib/eggdrop/Makefile.am lib/eggdrop/eggdrop.h
     lib/eggdrop/eggtimer.c lib/eggdrop/module.h lib/eggdrop/users.c
     modules/javascript/javascript.c modules/perlscript/mod_iface.c
     modules/server/binds.c modules/server/dcc.c modules/server/dcc.h
     modules/server/input.c modules/server/server.c
     modules/server/servsock.c modules/tclscript/tclscript.c
     src/Makefile.am src/core_binds.c src/dcc.c src/dccutil.c
     src/main.c src/modules.c src/net.c src/scriptuser.c src/tcl.c
     src/tcldcc.c src/tcluser.c src/userrec.c testcode/match.c

Added files:
     lib/eggdrop/binds.c lib/eggdrop/binds.h src/scriptbind.c

Removed files:
     src/tclhash.c src/tclhash.h

Log message:

* Moved bind tables to libeggdrop

---------------------- diff included ----------------------
Index: eggdrop1.7/lib/eggdrop/Makefile.am
diff -u eggdrop1.7/lib/eggdrop/Makefile.am:1.10 eggdrop1.7/lib/eggdrop/Makefile.am:1.11
--- eggdrop1.7/lib/eggdrop/Makefile.am:1.10	Mon Oct  7 17:33:54 2002
+++ eggdrop1.7/lib/eggdrop/Makefile.am	Wed Oct  9 23:41:58 2002
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.10 2002/10/07 22:33:54 stdarg Exp $
+# $Id: Makefile.am,v 1.11 2002/10/10 04:41:58 stdarg Exp $
 
 MAINTAINERCLEANFILES	= Makefile.in
 
@@ -6,8 +6,8 @@
 
 lib_LTLIBRARIES 	= libeggdrop.la
 
-libeggdrop_la_SOURCES	= botnetutil.c \
-			botnetutil.h \
+libeggdrop_la_SOURCES	= binds.c binds.h \
+			botnetutil.c botnetutil.h \
 			common.h \
 			eggdrop.c \
 			eggdrop.h \
Index: eggdrop1.7/lib/eggdrop/binds.c
diff -u /dev/null eggdrop1.7/lib/eggdrop/binds.c:1.1
--- /dev/null	Wed Oct  9 23:42:09 2002
+++ eggdrop1.7/lib/eggdrop/binds.c	Wed Oct  9 23:41:58 2002
@@ -0,0 +1,382 @@
+#include <stdlib.h>
+#include <eggdrop/eggdrop.h>
+
+extern struct dcc_t *dcc;
+extern int dcc_total;
+
+/* The head of the bind table linked list. */
+static bind_table_t *bind_table_list_head = NULL;
+
+/* Garbage collection stuff. */
+static int check_bind_executing = 0;
+static int already_scheduled = 0;
+static void bind_table_really_del(bind_table_t *table);
+static void bind_entry_really_del(bind_table_t *table, bind_entry_t *entry);
+
+void binds_init(void)
+{
+	bind_table_list_head = NULL;
+}
+
+static int internal_bind_cleanup()
+{
+	bind_table_t *table, *next_table;
+	bind_entry_t *entry, *next_entry;
+
+	for (table = bind_table_list_head; table; table = next_table) {
+		next_table = table->next;
+		if (table->flags & BIND_DELETED) {
+			bind_table_really_del(table);
+			continue;
+		}
+		for (entry = table->entries; entry; entry = next_entry) {
+			next_entry = entry->next;
+			if (entry->flags & BIND_DELETED) bind_entry_really_del(table, entry);
+		}
+	}
+	already_scheduled = 0;
+	return(0);
+}
+
+static void schedule_bind_cleanup()
+{
+	egg_timeval_t when;
+
+	if (already_scheduled) return;
+	already_scheduled = 1;
+
+	when.sec = 0;
+	when.usec = 0;
+	timer_create(&when, internal_bind_cleanup);
+}
+
+void kill_binds(void)
+{
+	while (bind_table_list_head) bind_table_del(bind_table_list_head);
+}
+
+bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, int match_type, int flags)
+{
+	bind_table_t *table;
+
+	for (table = bind_table_list_head; table; table = table->next) {
+		if (!strcmp(table->name, name)) break;
+	}
+
+	/* If it doesn't exist, create it. */
+	if (!table) {
+		table = (bind_table_t *)calloc(1, sizeof(*table));
+		table->name = strdup(name);
+		table->next = bind_table_list_head;
+		bind_table_list_head = table;
+	}
+	else if (!(table->flags & BIND_FAKE)) return(table);
+
+	table->nargs = nargs;
+	if (syntax) table->syntax = strdup(syntax);
+	table->match_type = match_type;
+	table->flags = flags;
+	return(table);
+}
+
+void bind_table_del(bind_table_t *table)
+{
+	bind_table_t *cur, *prev;
+
+	for (prev = NULL, cur = bind_table_list_head; cur; prev = cur, cur = cur->next) {
+		if (!strcmp(table->name, cur->name)) break;
+	}
+
+	/* If it's found, remove it from the list. */
+	if (cur) {
+		if (prev) prev->next = cur->next;
+		else bind_table_list_head = cur->next;
+	}
+
+	/* Now delete it. */
+	if (check_bind_executing) {
+		table->flags |= BIND_DELETED;
+		schedule_bind_cleanup();
+	}
+	else {
+		bind_table_really_del(table);
+	}
+}
+
+static void bind_table_really_del(bind_table_t *table)
+{
+	bind_entry_t *entry, *next;
+
+	free(table->name);
+	for (entry = table->entries; entry; entry = next) {
+		next = entry->next;
+		free(entry->function_name);
+		free(entry->mask);
+		free(entry);
+	}
+	free(table);
+}
+
+bind_table_t *bind_table_lookup(const char *name)
+{
+	bind_table_t *table;
+
+	for (table = bind_table_list_head; table; table = table->next) {
+		if (!(table->flags & BIND_DELETED) && !strcmp(table->name, name)) break;
+	}
+	return(table);
+}
+
+bind_table_t *bind_table_lookup_or_fake(const char *name)
+{
+	bind_table_t *table;
+
+	table = bind_table_lookup(name);
+	if (!table) table = bind_table_add(name, 0, NULL, 0, BIND_FAKE);
+	return(table);
+}
+
+/* Look up a bind entry based on either function name or id. */
+bind_entry_t *bind_entry_lookup(bind_table_t *table, int id, const char *mask, const char *function_name)
+{
+	bind_entry_t *entry;
+
+	for (entry = table->entries; entry; entry = entry->next) {
+		if (entry->flags & BIND_DELETED) continue;
+		if (entry->id == id || (!strcmp(entry->mask, mask) && !strcmp(entry->function_name, function_name))) break;
+	}
+	return(entry);
+}
+
+int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, void *cdataptr)
+{
+	bind_entry_t *entry;
+
+	entry = bind_entry_lookup(table, id, mask, function_name);
+	if (!entry) return(-1);
+
+	if (cdataptr) *(void **)cdataptr = entry->client_data;
+
+	/* Delete it. */
+	if (check_bind_executing) {
+		entry->flags |= BIND_DELETED;
+		schedule_bind_cleanup();
+	}
+	else bind_entry_really_del(table, entry);
+	return(0);
+}
+
+static void bind_entry_really_del(bind_table_t *table, bind_entry_t *entry)
+{
+	if (entry->next) entry->next->prev = entry->prev;
+	if (entry->prev) entry->prev->next = entry->next;
+	else table->entries = entry->next;
+	free(entry->function_name);
+	free(entry->mask);
+	memset(entry, 0, sizeof(*entry));
+	free(entry);
+}
+
+/* Modify a bind entry's flags and mask. */
+int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char *function_name, const char *newflags, const char *newmask)
+{
+	bind_entry_t *entry;
+
+	entry = bind_entry_lookup(table, id, mask, function_name);
+	if (!entry) return(-1);
+
+	/* Modify it. */
+	free(entry->mask);
+	entry->mask = strdup(newmask);
+
+	return(0);
+}
+
+int bind_entry_add(bind_table_t *table, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data)
+{
+	bind_entry_t *entry, *old_entry;
+
+	old_entry = bind_entry_lookup(table, -1, mask, function_name);
+
+	if (old_entry) {
+		if (table->flags & BIND_STACKABLE) {
+			entry = (bind_entry_t *)calloc(1, sizeof(*entry));
+			entry->prev = old_entry;
+			entry->next = old_entry->next;
+			old_entry->next = entry;
+			if (entry->next) entry->next->prev = entry;
+		}
+		else {
+			entry = old_entry;
+			free(entry->function_name);
+			free(entry->mask);
+		}
+	}
+	else {
+		for (old_entry = table->entries; old_entry && old_entry->next; old_entry = old_entry->next) {
+			; /* empty loop */
+		}
+		entry = (bind_entry_t *)calloc(1, sizeof(*entry));
+		if (old_entry) old_entry->next = entry;
+		else table->entries = entry;
+		entry->prev = old_entry;
+	}
+
+	entry->mask = strdup(mask);
+	entry->function_name = strdup(function_name);
+	entry->callback = callback;
+	entry->client_data = client_data;
+	entry->flags = bind_flags;
+
+	//entry->user_flags.match = FR_GLOBAL | FR_CHAN;
+	//break_down_flags(flags, &(entry->user_flags), NULL);
+
+	return(0);
+}
+
+/* Execute a bind entry with the given argument list. */
+static int bind_entry_exec(bind_table_t *table, bind_entry_t *entry, void **al)
+{
+	bind_entry_t *prev;
+
+	/* Give this entry a hit. */
+	entry->nhits++;
+
+	/* Search for the last entry that isn't deleted. */
+	for (prev = entry->prev; prev; prev = prev->prev) {
+		if (!(prev->flags & BIND_DELETED) && (prev->nhits >= entry->nhits)) break;
+	}
+
+	/* See if this entry is more popular than the preceding one. */
+	if (entry->prev != prev) {
+		/* Remove entry. */
+		if (entry->prev) entry->prev->next = entry->next;
+		else table->entries = entry->next;
+		if (entry->next) entry->next->prev = entry->prev;
+
+		/* Re-add in correct position. */
+		if (prev) {
+			entry->next = prev->next;
+			if (prev->next) prev->next->prev = entry;
+			prev->next = entry;
+		}
+		else {
+			entry->next = table->entries;
+			table->entries = entry;
+		}
+		entry->prev = prev;
+		if (entry->next) entry->next->prev = entry;
+	}
+
+	/* Does the callback want client data? */
+	if (entry->flags & BIND_WANTS_CD) {
+		*al = entry->client_data;
+	}
+	else al++;
+
+	return entry->callback(al[0], al[1], al[2], al[3], al[4], al[5], al[6], al[7], al[8], al[9]);
+}
+
+int bind_check(bind_table_t *table, const char *match, ...)
+{
+	void *args[11];
+	bind_entry_t *entry, *next;
+	int i, cmp, retval;
+	va_list ap;
+
+	check_bind_executing++;
+
+	va_start(ap, match);
+	for (i = 1; i <= table->nargs; i++) {
+		args[i] = va_arg(ap, void *);
+	}
+	va_end(ap);
+
+	/* Default return value is 0 */
+	retval = 0;
+
+	/* If it's a partial bind, we have to find the closest match. */
+	if (table->match_type & MATCH_PARTIAL) {
+		int matchlen, masklen, tie;
+		bind_entry_t *winner;
+
+		matchlen = strlen(match);
+		tie = 0;
+		winner = NULL;
+		for (entry = table->entries; entry; entry = entry->next) {
+			if (entry->flags & BIND_DELETED) continue;
+			/*if (table->flags & BIND_USE_ATTR) {
+				if (table->flags & BIND_STRICT_ATTR) cmp = flagrec_eq(&entry->user_flags, flags);
+				else cmp = flagrec_ok(&entry->user_flags, flags);
+				if (!cmp) continue;
+			}*/
+			masklen = strlen(entry->mask);
+			if (!strncasecmp(match, entry->mask, masklen < matchlen ? masklen : matchlen)) {
+				winner = entry;
+				if (masklen == matchlen) break;
+				else if (tie) return(-1);
+				else tie = 1;
+			}
+		}
+		if (winner) retval = bind_entry_exec(table, winner, args);
+		else retval = -1;
+		check_bind_executing--;
+		return(retval);
+	}
+
+	for (entry = table->entries; entry; entry = next) {
+		next = entry->next;
+		if (entry->flags & BIND_DELETED) continue;
+
+		if (table->match_type & MATCH_MASK) {
+			cmp = !wild_match_per((unsigned char *)entry->mask, (unsigned char *)match);
+		}
+		else {
+			if (table->match_type & MATCH_CASE) cmp = strcmp(entry->mask, match);
+			else cmp = strcasecmp(entry->mask, match);
+		}
+		if (cmp) continue; /* Doesn't match. */
+
+		/* Check flags. */
+		/*if (table->flags & BIND_USE_ATTR) {
+			if (table->flags & BIND_STRICT_ATTR) cmp = flagrec_eq(&entry->user_flags, flags);
+			else cmp = flagrec_ok(&entry->user_flags, flags);
+			if (!cmp) continue;
+		}*/
+
+		retval = bind_entry_exec(table, entry, args);
+		if ((table->flags & BIND_BREAKABLE) && (retval & BIND_RET_BREAK)) {
+			check_bind_executing--;
+			return(retval);
+		}
+	}
+	check_bind_executing--;
+	return(retval);
+}
+
+void bind_add_list(const char *table_name, bind_list_t *cmds)
+{
+	char name[50];
+	bind_table_t *table;
+
+	table = bind_table_lookup_or_fake(table_name);
+
+	for (; cmds->mask; cmds++) {
+		snprintf(name, 50, "*%s:%s", table->name, cmds->mask);
+		bind_entry_add(table, cmds->mask, name, 0, cmds->callback, NULL);
+	}
+}
+
+void bind_rem_list(const char *table_name, bind_list_t *cmds)
+{
+	char name[50];
+	bind_table_t *table;
+
+	table = bind_table_lookup(table_name);
+	if (!table) return;
+
+	for (; cmds->mask; cmds++) {
+		snprintf(name, 50, "*%s:%s", table->name, cmds->mask);
+		bind_entry_del(table, -1, cmds->mask, name, NULL);
+	}
+}
Index: eggdrop1.7/lib/eggdrop/binds.h
diff -u /dev/null eggdrop1.7/lib/eggdrop/binds.h:1.1
--- /dev/null	Wed Oct  9 23:42:09 2002
+++ eggdrop1.7/lib/eggdrop/binds.h	Wed Oct  9 23:41:58 2002
@@ -0,0 +1,74 @@
+#ifndef _BINDS_H_
+#define _BINDS_H_
+
+/* Match type flags for bind tables. */
+#define MATCH_PARTIAL       1
+#define MATCH_EXACT         2
+#define MATCH_MASK          4
+#define MATCH_CASE          8
+
+/* Flags for binds. */
+/* Does the callback want their client_data inserted as the first argument? */
+#define BIND_WANTS_CD 1
+#define BIND_USE_ATTR	2
+#define BIND_STRICT_ATTR	4
+#define BIND_BREAKABLE	8
+#define BIND_STACKABLE	16
+#define BIND_DELETED	32
+#define BIND_FAKE	64
+
+/* Flags for return values from bind callbacks */
+#define BIND_RET_LOG 1
+#define BIND_RET_BREAK 2
+
+/* This lets you add a null-terminated list of binds all at once. */
+typedef struct {
+	const char *mask;
+	Function callback;
+} bind_list_t;
+
+/* This holds the information for a bind entry. */
+typedef struct bind_entry_b {
+	struct bind_entry_b *next, *prev;
+	char *mask;
+	char *function_name;
+	Function callback;
+	void *client_data;
+	int nhits;
+	int flags;
+	int id;
+} bind_entry_t;
+
+/* This is the highest-level structure. It's like the "msg" table
+   or the "pubm" table. */
+typedef struct bind_table_b {
+	struct bind_table_b *next;
+	bind_entry_t *entries;
+	char *name;
+	char *syntax;
+	int nargs;
+	int match_type;
+	int flags;
+} bind_table_t;
+
+void bind_killall();
+
+int bind_check(bind_table_t *table, const char *match, ...);
+
+bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, int match_type, int flags);
+
+void bind_table_del(bind_table_t *table);
+
+bind_table_t *bind_table_lookup(const char *name);
+
+int bind_entry_add(bind_table_t *table, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data);
+
+int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, void *cdataptr);
+
+int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char *function_name, const char *newflags, const char *newmask);
+
+void bind_add_list(const char *table_name, bind_list_t *cmds);
+
+void bind_rem_list(const char *table_name, bind_list_t *cmds);
+
+#endif
Index: eggdrop1.7/lib/eggdrop/eggdrop.h
diff -u eggdrop1.7/lib/eggdrop/eggdrop.h:1.11 eggdrop1.7/lib/eggdrop/eggdrop.h:1.12
--- eggdrop1.7/lib/eggdrop/eggdrop.h:1.11	Mon Oct  7 17:33:54 2002
+++ eggdrop1.7/lib/eggdrop/eggdrop.h	Wed Oct  9 23:41:59 2002
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: eggdrop.h,v 1.11 2002/10/07 22:33:54 stdarg Exp $
+ * $Id: eggdrop.h,v 1.12 2002/10/10 04:41:59 stdarg Exp $
  */
 
 #ifndef _EGGDROP_H
@@ -29,6 +29,7 @@
 
 #include "../egglib/egglib.h"
 #include <eggdrop/common.h>
+#include <eggdrop/binds.h>
 #include <eggdrop/botnetutil.h>
 #include <eggdrop/memutil.h>
 #include <eggdrop/fileutil.h>
Index: eggdrop1.7/lib/eggdrop/eggtimer.c
diff -u eggdrop1.7/lib/eggdrop/eggtimer.c:1.1 eggdrop1.7/lib/eggdrop/eggtimer.c:1.2
--- eggdrop1.7/lib/eggdrop/eggtimer.c:1.1	Thu Sep 19 21:06:25 2002
+++ eggdrop1.7/lib/eggdrop/eggtimer.c	Wed Oct  9 23:41:59 2002
@@ -21,7 +21,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: eggtimer.c,v 1.1 2002/09/20 02:06:25 stdarg Exp $";
+static const char rcsid[] = "$Id: eggtimer.c,v 1.2 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include <stdio.h> /* NULL */
@@ -30,7 +30,6 @@
 #include <sys/time.h> /* gettimeofday() */
 
 #include <eggdrop/eggdrop.h>
-#include "eggtimer.h"
 
 static egg_timeval_t now;
 
Index: eggdrop1.7/lib/eggdrop/module.h
diff -u eggdrop1.7/lib/eggdrop/module.h:1.31 eggdrop1.7/lib/eggdrop/module.h:1.32
--- eggdrop1.7/lib/eggdrop/module.h:1.31	Mon Oct  7 17:33:54 2002
+++ eggdrop1.7/lib/eggdrop/module.h	Wed Oct  9 23:41:59 2002
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: module.h,v 1.31 2002/10/07 22:33:54 stdarg Exp $
+ * $Id: module.h,v 1.32 2002/10/10 04:41:59 stdarg Exp $
  */
 
 #ifndef _EGG_MOD_MODULE_H
@@ -55,7 +55,6 @@
 #include "src/net.h"
 #include "src/tclegg.h"
 #include "src/tcl.h"
-#include "src/tclhash.h"
 #include "src/traffic.h"
 #include "src/userent.h"
 #include "src/userrec.h"
@@ -96,13 +95,6 @@
 #define module_depend ((Function *(*)(char *,char *,int,int))egg->global[6])
 #define module_undepend ((int(*)(char *))egg->global[7])
 /* 8 - 11 */
-/* #define add_bind_table ((p_tcl_bind_list(*)(const char *,int,Function))egg->global[8]) */
-/* #define del_bind_table ((void (*) (p_tcl_bind_list))egg->global[9]) */
-/* #define find_bind_table ((p_tcl_bind_list(*)(const char *))egg->global[10]) */
-/* #define check_bind_bind ((int (*) (p_tcl_bind_list,const char *,struct flag_record *,const char *, int))egg->global[11]) */
-/* 12 - 15 */
-/* #define add_builtins ((int (*) (p_tcl_bind_list, cmd_t *))egg->global[12]) */
-/* #define rem_builtins ((int (*) (p_tcl_bind_list, cmd_t *))egg->global[13]) */
 #define add_tcl_commands ((void (*) (tcl_cmds *))egg->global[14])
 #define rem_tcl_commands ((void (*) (tcl_cmds *))egg->global[15])
 /* 16 - 19 */
@@ -110,32 +102,7 @@
 #define rem_tcl_ints ((void (*) (tcl_ints *))egg->global[17])
 #define add_tcl_strings ((void (*) (tcl_strings *))egg->global[18])
 #define rem_tcl_strings ((void (*) (tcl_strings *))egg->global[19])
-/* 20 - 23 */
-/* #define base64_to_int ((int (*) (char *))egg->global[20]) */
-/* #define int_to_base64 ((char * (*) (int))egg->global[21]) */
-/* #define int_to_base10 ((char * (*) (int))egg->global[22]) */
-/* #define simple_sprintf ((int (*)())egg->global[23]) */
-/* 24 - 27 */
-/* #define botnet_send_zapf ((void (*)(int, char *, char *, char *))egg->global[24]) */
-/* #define botnet_send_zapf_broad ((void (*)(int, char *, char *, char *))egg->global[25]) */
-/* #define botnet_send_unlinked ((void (*)(int, char *, char *))egg->global[26]) */
-/* #define botnet_send_bye ((void(*)(void))egg->global[27]) */
-/* 28 - 31 */
-/* #define botnet_send_chat ((void(*)(int,char*,char*))egg->global[28]) */
-/* #define botnet_send_filereject ((void(*)(int,char*,char*,char*))egg->global[29]) */
-/* #define botnet_send_filesend ((void(*)(int,char*,char*,char*))egg->global[30]) */
-/* #define botnet_send_filereq ((void(*)(int,char*,char*,char*))egg->global[31]) */
-/* 32 - 35 */
-/* #define botnet_send_join_idx ((void(*)(int,int))egg->global[32]) */
-/* #define botnet_send_part_idx ((void(*)(int,char *))egg->global[33]) */
-/* #define updatebot ((void(*)(int,char*,char,int))egg->global[34]) */
-/* #define nextbot ((int (*)(char *))egg->global[35]) */
-/* 36 - 39 */
-/* #define zapfbot ((void (*)(int))egg->global[36]) */
-/* 37: n_free -- UNUSED (Tothwolf) */
 #define u_pass_match ((int (*)(struct userrec *,char *))egg->global[38])
-/* 39: user_malloc -- UNUSED (Tothwolf) */
-/* 40 - 43 */
 #define get_user ((void *(*)(struct user_entry_type *,struct userrec *))egg->global[40])
 #define set_user ((int(*)(struct user_entry_type *,struct userrec *,void *))egg->global[41])
 #define add_entry_type ((int (*) ( struct user_entry_type * ))egg->global[42])
@@ -193,13 +160,9 @@
 /* 84 - 87 */
 #define open_listen ((int (*) (int *,int))egg->global[84])
 #define open_telnet_dcc ((int (*) (int,char *,char *))egg->global[85])
-/* 86: get_data_ptr -- UNUSED (Tothwolf) */
 #define open_telnet ((int (*) (char *, int))egg->global[87])
 /* 88 - 91 */
 #define check_bind_event ((void * (*) (const char *))egg->global[88])
-/* #define memcpy ((void * (*) (void *, const void *, size_t))egg->global[89]) */
-/* #define my_atoul ((IP(*)(char *))egg->global[90]) */
-/* #define my_strcpy ((int (*)(char *, const char *))egg->global[91]) */
 /* 92 - 95 */
 #define dcc (*(struct dcc_t **)egg->global[92])
 #define chanset (*(struct chanset_t **)(egg->global[93]))
@@ -303,23 +266,6 @@
 /* 172 - 175 */
 #define add_hook(a,b) (((void (*) (int, Function))egg->global[172])(a,b))
 #define del_hook(a,b) (((void (*) (int, Function))egg->global[173])(a,b))
-/* 174: H_dcc -- UNUSED (stdarg) */
-/* 175: H_filt -- UNUSED (oskar) */
-/* 176 - 179 */
-/* 176: H_chon -- UNUSED (oskar) */
-/* 177: H_chof -- UNUSED (oskar) */
-/*#define H_load (*(p_tcl_bind_list *)(egg->global[178])) */
-/*#define H_unld (*(p_tcl_bind_list *)(egg->global[179])) */
-/* 180 - 183 */
-/* 180: H_chat -- UNUSED (oskar) */
-/* 181: H_act -- UNUSED (oskar) */
-/* 182: H_bcst -- UNUSED (oskar) */
-/* 183: H_bot -- UNUSED (oskar) */
-/* 184 - 187 */
-/* 184: H_link -- UNUSED (oskar) */
-/* 185: H_disc -- UNUSED (oskar) */
-/* 186: H_away -- UNUSED (oskar) */
-/* 187: H_nkch -- UNUSED (oskar) */
 /* 188 - 191 */
 #define USERENTRY_BOTADDR (*(struct user_entry_type *)(egg->global[188]))
 #define USERENTRY_BOTFL (*(struct user_entry_type *)(egg->global[189]))
@@ -338,8 +284,6 @@
 /* 200 - 203 */
 #define logmodes ((int(*)(char *))egg->global[200])
 #define masktype ((const char *(*)(int))egg->global[201])
-/* #define stripmodes ((int(*)(char *))egg->global[202]) */
-/* #define stripmasktype ((const char *(*)(int))egg->global[203]) */
 /* 204 - 207 */
 #define sub_lang ((void(*)(int,char *))egg->global[204])
 #define online_since (*(int *)(egg->global[205]))
@@ -363,17 +307,11 @@
 /* 220 - 223 */
 #define global_exempts (*(maskrec **)(egg->global[220]))
 #define global_invites (*(maskrec **)(egg->global[221]))
-/* 222: ginvite_total -- UNUSED (Eule) */
-/* 223: gexempt_total -- UNUSED (Eule) */
 /* 224 - 227 */
-/* 224: H_event -- UNUSED (stdarg) */
 #define use_exempts (*(int *)(egg->global[225]))	/* drummer/Jason */
 #define use_invites (*(int *)(egg->global[226]))	/* drummer/Jason */
 #define force_expire (*(int *)(egg->global[227]))	/* Rufus */
 /* 228 - 231 */
-/* 228: add_lang_section() -- UNUSED */
-/* 229: user_realloc -- UNUSED (Tothwolf) */
-/* 230: nrealloc -- UNUSED (Tothwolf) */
 #define xtra_set ((int(*)(struct userrec *,struct user_entry *, void *))egg->global[231])
 /* 232 - 235 */
 /* #define ContextNote(note) (egg->global[232](__FILE__, __LINE__, MODULE_NAME, note)) */
@@ -399,12 +337,6 @@
 #define sock_has_data ((int(*)(int, int))egg->global[248])
 #define bots_in_subtree ((int (*)(tand_t *))egg->global[249])
 #define users_in_subtree ((int (*)(tand_t *))egg->global[250])
-/* #define inet_aton ((int (*)(const char *cp, struct in_addr *addr))egg->global[251]) */
-/* 252 - 255 */
-/* #define snprintf (egg->global[252]) */
-/* #define vsnprintf ((int (*)(char *, size_t, const char *, va_list))egg->global[253]) */
-/* #define memset ((void *(*)(void *, int, size_t))egg->global[254]) */
-/* #define strcasecmp ((int (*)(const char *, const char *))egg->global[255]) */
 /* 256 - 259 */
 #define fixfrom ((char *(*)(char *))egg->global[256])
 /* #define is_file ((int (*)(const char *))egg->global[257]) */
@@ -413,11 +345,6 @@
 /* 260 - 263 */
 #define party (*(party_t **)(egg->global[260]))
 #define open_address_listen ((int (*)(char *addr, int *port))egg->global[261])
-/* #define str_escape ((char *(*)(const char *, const char, const char))egg->global[262]) */
-/* #define strchr_unescape ((char *(*)(char *, const char, register const char))egg->global[263]) */
-/* 264 - 267 */
-/* #define str_unescape ((void (*)(char *, register const char))egg->global[264]) */
-/* #define egg_strcatn ((int (*)(char *dst, const char *src, size_t max))egg->global[265]) */
 #define clear_chanlist_member ((void (*)(const char *nick))egg->global[266])
 /* 268 - 271 */
 /* Please don't modify socklist directly, unless there's no other way.
@@ -434,14 +361,8 @@
 #define getlocaladdr ((char* (*) (int))egg->global[272])
 #define kill_bot ((void (*)(char *, char *))egg->global[273])
 #define quit_msg ((char *)(egg->global[274]))
-#define bind_table_add ((bind_table_t *(*)(const char *, int, char *, int, int))egg->global[275])
 /* 276 - 279 */
-#define bind_table_del ((void (*)(bind_table_t *))egg->global[276])
-#define add_builtins ((void (*)(const char *, cmd_t *))egg->global[277])
-#define rem_builtins ((void (*)(const char *, cmd_t *))egg->global[278])
-#define bind_table_lookup ((bind_table_t *(*)(const char *))egg->global[279]) 
 /* 280 - 283 */
-#define check_bind ((int (*)(bind_table_t *, const char *, struct flag_record *, ...))egg->global[280])
 #define egg_timeval_now (*(egg_timeval_t *)egg->global[281])
 
 /* This is for blowfish module, couldnt be bothered making a whole new .h
Index: eggdrop1.7/lib/eggdrop/users.c
diff -u eggdrop1.7/lib/eggdrop/users.c:1.2 eggdrop1.7/lib/eggdrop/users.c:1.3
--- eggdrop1.7/lib/eggdrop/users.c:1.2	Wed Oct  9 04:09:40 2002
+++ eggdrop1.7/lib/eggdrop/users.c	Wed Oct  9 23:41:59 2002
@@ -201,6 +201,10 @@
 	if (!uid) uid = user_get_uid();
 	u->uid = uid;
 
+	/* All users have the global setting by default. */
+	u->settings = calloc(1, sizeof(*u->settings));
+	u->nsettings = 1;
+
 	hash_table_insert(handle_ht, u->handle, u);
 	hash_table_insert(uid_ht, (void *)u->uid, u);
 	hash_table_check_resize(&handle_ht);
@@ -248,6 +252,7 @@
 			if (setting->extended[j].value) free(setting->extended[j].value);
 		}
 		if (setting->extended) free(setting->extended);
+		if (setting->chan) free(setting->chan);
 	}
 	if (u->settings) free(u->settings);
 	u->settings = NULL;
Index: eggdrop1.7/modules/javascript/javascript.c
diff -u eggdrop1.7/modules/javascript/javascript.c:1.12 eggdrop1.7/modules/javascript/javascript.c:1.13
--- eggdrop1.7/modules/javascript/javascript.c:1.12	Sat Sep 21 02:40:16 2002
+++ eggdrop1.7/modules/javascript/javascript.c	Wed Oct  9 23:41:59 2002
@@ -20,7 +20,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: javascript.c,v 1.12 2002/09/21 07:40:16 stdarg Exp $";
+static const char rcsid[] = "$Id: javascript.c,v 1.13 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include <stdio.h>
@@ -685,8 +685,8 @@
 	dprintf(idx, "    Using JavaScript version %s\n", version_str);
 }
 
-static cmd_t dcc_commands[] = {
-	{"js", 	"n", 	(Function) cmd_js,	NULL},
+static bind_list_t dcc_commands[] = {
+	{"js", (Function) cmd_js},
 	{0}
 };
 
@@ -717,7 +717,7 @@
 	script_register_module(&my_script_interface);
 	script_playback(&my_script_interface);
 
-	add_builtins("dcc", dcc_commands);
+	bind_add_list("dcc", dcc_commands);
 
 	return(NULL);
 }
@@ -729,7 +729,7 @@
 
 	script_unregister_module(&my_script_interface);
 
-	rem_builtins("dcc", dcc_commands);
+	bind_rem_list("dcc", dcc_commands);
 
 	module_undepend("javascript");
 	return(NULL);
Index: eggdrop1.7/modules/perlscript/mod_iface.c
diff -u eggdrop1.7/modules/perlscript/mod_iface.c:1.8 eggdrop1.7/modules/perlscript/mod_iface.c:1.9
--- eggdrop1.7/modules/perlscript/mod_iface.c:1.8	Fri May 17 02:29:24 2002
+++ eggdrop1.7/modules/perlscript/mod_iface.c	Wed Oct  9 23:41:59 2002
@@ -20,7 +20,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: mod_iface.c,v 1.8 2002/05/17 07:29:24 stdarg Exp $";
+static const char rcsid[] = "$Id: mod_iface.c,v 1.9 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include <stdio.h>
@@ -74,8 +74,8 @@
 	return(0);
 }
 
-static cmd_t my_dcc_cmds[] = {
-	{"perl", "n", (Function) dcc_cmd_perl, NULL},
+static bind_list_t my_dcc_cmds[] = {
+	{"perl", (Function) dcc_cmd_perl},
 	{0}
 };
 
@@ -105,13 +105,13 @@
 	script_register_module(&my_script_interface);
 	script_playback(&my_script_interface);
 
-	add_builtins("dcc", my_dcc_cmds);
+	bind_add_list("dcc", my_dcc_cmds);
 	return(NULL);
 }
 
 static char *perlscript_close()
 {
-	rem_builtins("dcc", my_dcc_cmds);
+	bind_rem_list("dcc", my_dcc_cmds);
 
 	/* Destroy interpreter. */
 	perlscript_destroy();
Index: eggdrop1.7/modules/server/binds.c
diff -u eggdrop1.7/modules/server/binds.c:1.3 eggdrop1.7/modules/server/binds.c:1.4
--- eggdrop1.7/modules/server/binds.c:1.3	Mon Oct  7 17:36:36 2002
+++ eggdrop1.7/modules/server/binds.c	Wed Oct  9 23:41:59 2002
@@ -51,32 +51,26 @@
 	BT_dcc_chat = bind_table_add("dcc_chat", 6, "ssUssi", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
 	BT_dcc_recv = bind_table_add("dcc_recv", 7, "ssUssii", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
 
-	add_builtins("ctcp", ctcp_dcc_binds);
+	bind_add_list("ctcp", ctcp_dcc_binds);
 }
 
 void check_tcl_notc(char *nick, char *uhost, struct userrec *u, char *dest, char *arg)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
-
-  get_user_flagrec(u, &fr, NULL);
-  check_bind(BT_notice, arg, &fr, nick, uhost, u, arg, dest);
+  bind_check(BT_notice, arg, nick, uhost, u, arg, dest);
 }
 
 static int check_tcl_ctcpr(char *nick, char *uhost, struct userrec *u,
 			   char *dest, char *keyword, char *args,
 			   bind_table_t *table)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
-  get_user_flagrec(u, &fr, NULL);
-
-  return check_bind(table, keyword, &fr, nick, uhost, u, dest, keyword, args);
+  return bind_check(table, keyword, nick, uhost, u, dest, keyword, args);
 }
 
 static int check_tcl_wall(char *from, char *msg)
 {
   int x;
 
-  x = check_bind(BT_wall, msg, NULL, from, msg);
+  x = bind_check(BT_wall, msg, from, msg);
   if (x & BIND_RET_LOG) {
     putlog(LOG_WALL, "*", "!%s! %s", from, msg);
     return 1;
Index: eggdrop1.7/modules/server/dcc.c
diff -u eggdrop1.7/modules/server/dcc.c:1.2 eggdrop1.7/modules/server/dcc.c:1.3
--- eggdrop1.7/modules/server/dcc.c:1.2	Mon Oct  7 17:36:36 2002
+++ eggdrop1.7/modules/server/dcc.c	Wed Oct  9 23:41:59 2002
@@ -594,7 +594,6 @@
 
 static void got_chat(char *nick, char *uhost, user_t *u, char *text)
 {
-	struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
 	char type[256], ip[256], port[32];
 	int nport;
 
@@ -611,8 +610,7 @@
 
 	nport = atoi(port);
 
-	get_user_flagrec(u, &fr, NULL);
-	check_bind(BT_dcc_chat, nick, &fr, nick, uhost, u, type, ip, nport);
+	bind_check(BT_dcc_chat, nick, nick, uhost, u, type, ip, nport);
 }
 
 static void got_resume(char *nick, char *uhost, struct userrec *u, char *text)
@@ -706,7 +704,7 @@
 	}
 
 	get_user_flagrec(u, &fr, NULL);
-	check_bind(BT_dcc_recv, nick, &fr, nick, uhost, u, fname, ip, port, size);
+	bind_check(BT_dcc_recv, nick, nick, uhost, u, fname, ip, port, size);
 }
 
 /* PRIVMSG ((target) :^ADCC CHAT ((type) ((longip) ((port)^A */
@@ -727,7 +725,7 @@
 	return(0);
 }
 
-cmd_t ctcp_dcc_binds[] = {
-	{"DCC", "", (Function) got_dcc, NULL},
-	{NULL, NULL, NULL, NULL}
+bind_list_t ctcp_dcc_binds[] = {
+	{"DCC", (Function) got_dcc},
+	{0}
 };
Index: eggdrop1.7/modules/server/dcc.h
diff -u eggdrop1.7/modules/server/dcc.h:1.2 eggdrop1.7/modules/server/dcc.h:1.3
--- eggdrop1.7/modules/server/dcc.h:1.2	Mon Oct  7 17:36:36 2002
+++ eggdrop1.7/modules/server/dcc.h	Wed Oct  9 23:41:59 2002
@@ -12,6 +12,6 @@
 int dcc_send_info(int idx, int field, void *valueptr);
 int dcc_accept_send(char *nick, char *localfname, char *fname, int size, int resume, char *ip, int port, int timeout);
 
-extern cmd_t ctcp_dcc_binds[];
+extern bind_list_t ctcp_dcc_binds[];
 
 #endif
Index: eggdrop1.7/modules/server/input.c
diff -u eggdrop1.7/modules/server/input.c:1.1 eggdrop1.7/modules/server/input.c:1.2
--- eggdrop1.7/modules/server/input.c:1.1	Thu Sep 19 21:06:25 2002
+++ eggdrop1.7/modules/server/input.c	Wed Oct  9 23:41:59 2002
@@ -62,7 +62,6 @@
 
 static int check_ctcp_ctcr(int which, int to_channel, struct userrec *u, char *nick, char *uhost, char *dest, char *trailing)
 {
-	struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
 	char *cmd, *space, *logdest, *text, *ctcptype;
 	bind_table_t *table;
 	int r, len, flags;
@@ -85,9 +84,7 @@
 	if (which == 0) table = BT_ctcp;
 	else table = BT_ctcr;
 
-	get_user_flagrec(u, &fr, dest);
-
-	r = check_bind(table, cmd, &fr, nick, uhost, u, dest, cmd, text);
+	r = bind_check(table, cmd, nick, uhost, u, dest, cmd, text);
 
 	trailing[len-1] = 1;
 
@@ -162,13 +159,13 @@
 
 	get_user_flagrec(u, &fr, dest);
 	if (to_channel) {
-		r = check_bind(BT_pub, first, &fr, from_nick, from_uhost, u, dest, text);
+		r = bind_check(BT_pub, first, from_nick, from_uhost, u, dest, text);
 		if (r & BIND_RET_LOG) {
 			putlog(LOG_CMDS, dest, "<<%s>> !%s! %s %s", from_nick, u ? u->handle : "*", first, text);
 		}
 	}
 	else {
-		r = check_bind(BT_msg, first, &fr, from_nick, from_uhost, u, text);
+		r = bind_check(BT_msg, first, from_nick, from_uhost, u, text);
 		if (r & BIND_RET_LOG) {
 			putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %s", from_nick, from_uhost, u ? u->handle : "*", first, text);
 		}
@@ -180,10 +177,10 @@
 
 	/* And now the stackable version. */
 	if (to_channel) {
-		r = check_bind(BT_pubm, trailing, &fr, from_nick, from_uhost, u, dest, trailing);
+		r = bind_check(BT_pubm, trailing, from_nick, from_uhost, u, dest, trailing);
 	}
 	else {
-		r = check_bind(BT_msg, trailing, &fr, from_nick, from_uhost, u, trailing);
+		r = bind_check(BT_msg, trailing, from_nick, from_uhost, u, trailing);
 	}
 
 	if (!(r & BIND_RET_BREAK)) {
@@ -232,7 +229,7 @@
 	if (r) return(0);
 
 	get_user_flagrec(u, &fr, NULL);
-	r = check_bind(BT_notice, trailing, &fr, from_nick, from_uhost, u, dest, trailing);
+	r = bind_check(BT_notice, trailing, from_nick, from_uhost, u, dest, trailing);
 
 	if (!(r & BIND_RET_BREAK)) {
 		/* This should probably go in the partyline module later. */
@@ -255,7 +252,7 @@
 	int r;
 
 	msg = args[1];
-	r = check_bind(BT_wall, msg, NULL, from_nick, msg);
+	r = bind_check(BT_wall, msg, from_nick, msg);
 	if (!(r & BIND_RET_BREAK)) {
 		if (from_uhost) putlog(LOG_WALL, "*", "!%s (%s)! %s", from_nick, from_uhost, msg);
 		else putlog(LOG_WALL, "*", "!%s! %s", from_nick, msg);
@@ -391,21 +388,21 @@
 	return(0);
 }
 
-cmd_t my_new_raw_binds[] = {
-	{"PRIVMSG", "", (Function) gotmsg, NULL},
-	{"NOTICE", "", (Function) gotnotice, NULL},
-	{"WALLOPS", "", (Function) gotwall, NULL},
-	{"PING", "", (Function) gotping, NULL},
-	{"NICK", "", (Function) gotnick, NULL},
-	{"ERROR", "", (Function) goterror, NULL},
-	{"001", "", (Function) got001, NULL},
-	{"432",	 "", (Function) got432,  NULL},
-	{"433",	 "", (Function) got433,  NULL},
-	{"435",  "", (Function) got435,  NULL},
-	{"438",  "", (Function) got438,  NULL},
-	{"437",	 "", (Function) got437,	 NULL},
-	{"451",	 "", (Function) got451,	 NULL},
-	{"442",	 "", (Function) got442,	 NULL},
-	{"311", "", (Function) got311, NULL},
+bind_list_t my_new_raw_binds[] = {
+	{"PRIVMSG", (Function) gotmsg},
+	{"NOTICE", (Function) gotnotice},
+	{"WALLOPS", (Function) gotwall},
+	{"PING", (Function) gotping},
+	{"NICK", (Function) gotnick},
+	{"ERROR", (Function) goterror},
+	{"001", (Function) got001},
+	{"432",	(Function) got432},
+	{"433",	(Function) got433},
+	{"435", (Function) got435},
+	{"438", (Function) got438},
+	{"437",	(Function) got437},
+	{"451",	(Function) got451,},
+	{"442",	(Function) got442,},
+	{"311", (Function) got311,},
 	{NULL, NULL, NULL, NULL}
 };
Index: eggdrop1.7/modules/server/server.c
diff -u eggdrop1.7/modules/server/server.c:1.37 eggdrop1.7/modules/server/server.c:1.38
--- eggdrop1.7/modules/server/server.c:1.37	Sun Sep 22 03:50:46 2002
+++ eggdrop1.7/modules/server/server.c	Wed Oct  9 23:41:59 2002
@@ -41,7 +41,7 @@
 extern void dequeue_messages();
 
 /* From input.c */
-extern cmd_t my_new_raw_binds[];
+extern bind_list_t my_new_raw_binds[];
 
 /* From dcc_cmd.c */
 extern cmd_t my_dcc_commands[];
@@ -102,7 +102,7 @@
 	kill_server("Server module unloading");
 	cycle_delay = 100;
 
-	rem_builtins("newraw", my_new_raw_binds);
+	bind_rem_list("newraw", my_new_raw_binds);
 
 	server_binds_destroy();
 
@@ -148,7 +148,7 @@
 	for (cmd = my_dcc_commands; cmd->name; cmd++) {
 		putlog(LOG_MISC, "*", "Making bind: %s", cmd->name);
 	}
-	add_builtins("newraw", my_new_raw_binds);
+	bind_add_list("newraw", my_new_raw_binds);
 	//add_builtins("dcc", my_dcc_commands);
 
 	script_create_commands(server_script_cmds);
Index: eggdrop1.7/modules/server/servsock.c
diff -u eggdrop1.7/modules/server/servsock.c:1.2 eggdrop1.7/modules/server/servsock.c:1.3
--- eggdrop1.7/modules/server/servsock.c:1.2	Sat Sep 21 02:40:16 2002
+++ eggdrop1.7/modules/server/servsock.c	Wed Oct  9 23:41:59 2002
@@ -145,7 +145,7 @@
 		}
 	}
 
-	check_bind(BT_new_raw, msg.cmd, NULL, from_nick, from_uhost, u, msg.cmd, msg.nargs, msg.args);
+	bind_check(BT_new_raw, msg.cmd, from_nick, from_uhost, u, msg.cmd, msg.nargs, msg.args);
 
 	/* For now, let's emulate the old style. */
 
@@ -158,7 +158,7 @@
 	irc_msg_cleanup(&msg);
 	if (text[-1] == ':') text--;
 	text[-1] = 0;
-	check_bind(BT_raw, msg.cmd, NULL, prefix, msg.cmd, text);
+	bind_check(BT_raw, msg.cmd, prefix, msg.cmd, text);
 	free(prefix);
 	return(0);
 }
Index: eggdrop1.7/modules/tclscript/tclscript.c
diff -u eggdrop1.7/modules/tclscript/tclscript.c:1.21 eggdrop1.7/modules/tclscript/tclscript.c:1.22
--- eggdrop1.7/modules/tclscript/tclscript.c:1.21	Sat Sep 21 02:40:16 2002
+++ eggdrop1.7/modules/tclscript/tclscript.c	Wed Oct  9 23:41:59 2002
@@ -20,7 +20,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: tclscript.c,v 1.21 2002/09/21 07:40:16 stdarg Exp $";
+static const char rcsid[] = "$Id: tclscript.c,v 1.22 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include "lib/eggdrop/module.h"
@@ -601,8 +601,8 @@
 	dprintf(idx, "%s\n", reported);
 }
 
-static cmd_t dcc_commands[] = {
-	{"tcl", 	"n", 	(Function) cmd_tcl,	NULL},
+static bind_list_t dcc_commands[] = {
+	{"tcl", (Function) cmd_tcl},
 	{0}
 };
 
@@ -636,7 +636,7 @@
 	script_register_module(&my_script_interface);
 	script_playback(&my_script_interface);
 
-	add_builtins("dcc", dcc_commands);
+	bind_add_list("dcc", dcc_commands);
 
 	return(NULL);
 }
@@ -646,7 +646,7 @@
 	/* When tcl is gone from the core, this will be uncommented. */
 	/* Tcl_DeleteInterp(ginterp); */
 
-	rem_builtins("dcc", dcc_commands);
+	bind_rem_list("dcc", dcc_commands);
 
 	module_undepend("tclscript");
 	script_unregister_module(&my_script_interface);
Index: eggdrop1.7/src/Makefile.am
diff -u eggdrop1.7/src/Makefile.am:1.30 eggdrop1.7/src/Makefile.am:1.31
--- eggdrop1.7/src/Makefile.am:1.30	Mon Oct  7 17:36:36 2002
+++ eggdrop1.7/src/Makefile.am	Wed Oct  9 23:41:59 2002
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.30 2002/10/07 22:36:36 stdarg Exp $
+# $Id: Makefile.am,v 1.31 2002/10/10 04:41:59 stdarg Exp $
 
 # FIXME: optionally allow a system wide install by ignoring the line below.
 bindir			= $(exec_prefix)
@@ -28,10 +28,10 @@
 			core_binds.c core_binds.h \
 			dcc.c dcc.h \
 			dccutil.c dccutil.h \
+			egg_timer.c egg_timer.h \
 			debug.h \
 			dns.c dns.h \
 			egg.h \
-			egg_timer.c \
 			flags.c \
 			flags.h \
 			irccmp.c \
@@ -51,6 +51,7 @@
 			net.c \
 			net.h \
 			patch.h \
+			scriptbind.c \
 			scriptnet.c \
 			scriptuser.c \
 			tcl.c \
@@ -58,8 +59,6 @@
 			tcldcc.c \
 			tcldcc.h \
 			tclegg.h \
-			tclhash.c \
-			tclhash.h \
 			tclmisc.c \
 			tcluser.c \
 			traffic.c \
Index: eggdrop1.7/src/core_binds.c
diff -u eggdrop1.7/src/core_binds.c:1.6 eggdrop1.7/src/core_binds.c:1.7
--- eggdrop1.7/src/core_binds.c:1.6	Mon Oct  7 17:36:36 2002
+++ eggdrop1.7/src/core_binds.c	Wed Oct  9 23:41:59 2002
@@ -1,33 +1,8 @@
-/*
- * core_binds.c --
- */
-/*
- * Copyright (C) 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA	02111-1307, USA.
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id: core_binds.c,v 1.6 2002/10/07 22:36:36 stdarg Exp $";
-#endif
-
+#include <eggdrop/eggdrop.h>
 #include "main.h"
 #include "users.h"
 #include "logfile.h"
 #include "cmdt.h"
-#include "tclhash.h"
 #include "userrec.h"
 
 static bind_table_t *BT_time, *BT_event;
@@ -79,105 +54,33 @@
 {
 	char full[32];
 	snprintf(full, sizeof(full), "%02d %02d %02d %02d %04d", tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
-	check_bind(BT_time, full, NULL, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
+	bind_check(BT_time, full, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
 }
 
 void check_bind_event(char *event)
 {
-	check_bind(BT_event, event, NULL, event);
-}
-
-void check_bind_away(const char *bot, int idx, const char *msg)
-{
-	check_bind(BT_away, bot, NULL, bot, idx, msg);
+	bind_check(BT_event, event, NULL, event);
 }
 
 void check_bind_dcc(const char *cmd, int idx, const char *text)
 {
-	struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
 	int x;
 
-	get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
-
-	x = check_bind(BT_dcc, cmd, &fr, dcc[idx].user, idx, text);
+	x = bind_check(BT_dcc, cmd, dcc[idx].user, idx, text);
 	if (x & BIND_RET_LOG) {
 		putlog(LOG_CMDS, "*", "#%s# %s %s", dcc[idx].nick, cmd, text);
 	}
 }
 
-void check_bind_bot(const char *nick, const char *code, const char *param)
-{
-	check_bind(BT_bot, code, NULL, nick, code, param);
-}
-
-void check_bind_chon(char *hand, int idx)
-{
-	struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-	struct userrec *u;
-
-	u = get_user_by_handle(userlist, hand);
-	touch_laston(u, "partyline", now);
-	get_user_flagrec(u, &fr, NULL);
-	check_bind(BT_chon, hand, &fr, hand, idx);
-}
-
-void check_bind_chof(char *hand, int idx)
-{
-	struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-	struct userrec *u;
-
-	u = get_user_by_handle(userlist, hand);
-	touch_laston(u, "partyline", now);
-	get_user_flagrec(u, &fr, NULL);
-	check_bind(BT_chof, hand, &fr, hand, idx);
-}
-
-int check_bind_chat(const char *from, int chan, const char *text)
-{
-	return check_bind(BT_chat, text, NULL, from, chan, text);
-}
-
-void check_bind_act(const char *from, int chan, const char *text)
-{
-	check_bind(BT_act, text, NULL, from, chan, text);
-}
-
-void check_bind_bcst(const char *from, int chan, const char *text)
-{
-	check_bind(BT_bcst, text, NULL, from, chan, text);
-}
-
-void check_bind_nkch(const char *ohand, const char *nhand)
-{
-	check_bind(BT_nkch, ohand, NULL, ohand, nhand);
-}
-
-void check_bind_link(const char *bot, const char *via)
-{
-	check_bind(BT_link, bot, NULL, bot, via);
-}
-
-void check_bind_disc(const char *bot)
-{
-	check_bind(BT_disc, bot, NULL, bot);
-}
-
 const char *check_bind_filt(int idx, const char *text)
 {
 	int x;
-	struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
 
-	get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
 	global_filt_string = strdup(text);
-	x = check_bind(BT_filt, text, &fr, idx, text);
+	x = bind_check(BT_filt, text, idx, text);
 	return(global_filt_string);
 }
 
-int check_bind_note(const char *from, const char *to, const char *text)
-{
-	return check_bind(BT_note, to, NULL, from, to, text);
-}
-
 void check_bind_listen(const char *cmd, int idx)
 {
 	putlog(LOG_MISC, "*", "check_bind_listen: unsupported right now");
@@ -194,36 +97,3 @@
 */
 
 }
-
-void check_bind_chjn(const char *bot, const char *nick, int chan,
-				const char type, int sock, const char *host)
-{
-	struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
-	char s[11], t[2];
-
-	t[0] = type;
-	t[1] = 0;
-	switch (type) {
-	case '*':
-		fr.global = USER_OWNER;
-		break;
-	case '+':
-		fr.global = USER_MASTER;
-		break;
-	case '@':
-		fr.global = USER_OP;
-		break;
-	case '%':
-		fr.global = USER_BOTMAST;
-	}
-	snprintf(s, sizeof s, "%d", chan);
-	check_bind(BT_chjn, s, &fr, bot, nick, chan, t, sock, host);
-}
-
-void check_bind_chpt(const char *bot, const char *hand, int sock, int chan)
-{
-	char v[11];
-	
-	snprintf(v, sizeof v, "%d", chan);
-	check_bind(BT_chpt, v, NULL, bot, hand, sock, chan);
-}	 
Index: eggdrop1.7/src/dcc.c
diff -u eggdrop1.7/src/dcc.c:1.93 eggdrop1.7/src/dcc.c:1.94
--- eggdrop1.7/src/dcc.c:1.93	Mon Oct  7 17:36:36 2002
+++ eggdrop1.7/src/dcc.c	Wed Oct  9 23:41:59 2002
@@ -25,7 +25,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: dcc.c,v 1.93 2002/10/07 22:36:36 stdarg Exp $";
+static const char rcsid[] = "$Id: dcc.c,v 1.94 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include "main.h"
@@ -36,11 +36,6 @@
 #include "dns.h"
 #include "misc.h"
 #include "cmdt.h"	/* cmd_t				*/
-#include "tclhash.h"	/* BIND_RET_BREAK	*/
-#include "core_binds.h"	/* check_bind_chof, check_bind_filt, 
-			   check_bind_dcc, check_bind_chat, 
-			   check_bind_chjn, check_bind_chon,
-			   check_bind_listen				*/
 #include "users.h"	/* match_ignore, addignore, get_user_by_host	*/
 //#include "chanprog.h"	/* reaffirm_owners				*/
 //#include "cmds.h"	/* check_dcc_attrs				*/
@@ -54,6 +49,7 @@
 			   deluser					*/
 #include "match.h"	/* wild_match					*/
 #include "dcc.h"	/* prototypes					*/
+#include "core_binds.h"
 
 extern struct userrec	*userlist;
 extern struct chanset_t	*chanset;
@@ -357,10 +353,7 @@
   if (dcc[idx].u.chat->channel >= 0) {
     chanout_but(idx, dcc[idx].u.chat->channel, "*** %s lost dcc link.\n",
 		dcc[idx].nick);
-    check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
-		   dcc[idx].u.chat->channel);
   }
-  check_bind_chof(dcc[idx].nick, idx);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -380,8 +373,6 @@
 
   dcc[idx].timeval = now;
 
-  strcpy(buf, check_bind_filt(idx, buf));
-
     /* Check for beeps and cancel annoying ones */
     v = buf;
     d = buf;
@@ -464,9 +455,8 @@
 	  }
 	}
     } else {
-	int r;
+	int r = 0;
 
-	r = check_bind_chat(dcc[idx].nick, dcc[idx].u.chat->channel, buf);
 	if (r & BIND_RET_BREAK) return;
 
 	if (dcc[idx].u.chat->away != NULL)
@@ -1044,10 +1034,7 @@
     if (dcc[idx].type == &DCC_CHAT) {
       if (dcc[idx].u.chat->channel >= 0) {
 	chanout_but(-1, dcc[idx].u.chat->channel, _("*** %s has joined the party line.\n"), dcc[idx].nick);
-	check_bind_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
-		       geticon(dcc[idx].user), dcc[idx].sock, dcc[idx].host);
       }
-      check_bind_chon(dcc[idx].nick, idx);
     }
   }
 }
@@ -1319,7 +1306,7 @@
     dcc[i].type = &DCC_SOCKET;
     dcc[i].u.other = NULL;
     strcpy(dcc[i].nick, "*");
-    check_bind_listen(dcc[idx].host, dcc[i].sock);
+    //check_bind_listen(dcc[idx].host, dcc[i].sock);
     return;
   }
   /* Do not buffer data anymore. All received and stored data is passed
Index: eggdrop1.7/src/dccutil.c
diff -u eggdrop1.7/src/dccutil.c:1.55 eggdrop1.7/src/dccutil.c:1.56
--- eggdrop1.7/src/dccutil.c:1.55	Fri Sep 20 16:41:49 2002
+++ eggdrop1.7/src/dccutil.c	Wed Oct  9 23:41:59 2002
@@ -27,7 +27,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: dccutil.c,v 1.55 2002/09/20 21:41:49 stdarg Exp $";
+static const char rcsid[] = "$Id: dccutil.c,v 1.56 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include <sys/stat.h>
@@ -39,8 +39,6 @@
 #include "misc.h"
 #include "cmdt.h"		/* cmd_t				*/
 #include "net.h"		/* tputs, killsock			*/
-#include "core_binds.h"		/* check_bind_chon, check_bind_chjn,
-				   check_bind_chof, check_bind_away	*/
 #include "dccutil.h"		/* prototypes				*/
 #include "users.h" /* get_user_by_handle */
 
@@ -212,7 +210,6 @@
   dcc[idx].u.chat->channel = 234567;
   j = dcc[idx].sock;
   strcpy(dcc[idx].u.chat->con_chan, "***");
-  check_bind_chon(dcc[idx].nick, idx);
   /* Still there? */
   if ((idx >= dcc_total) || (dcc[idx].sock != j))
     return;			/* Nope */
@@ -228,8 +225,6 @@
       if (i == -2)
 	i = 0;
       dcc[idx].u.chat->channel = i;
-      check_bind_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
-		     geticon(dcc[idx].user), dcc[idx].sock, dcc[idx].host);
     }
     /* But *do* bother with sending it locally */
     if (!dcc[idx].u.chat->channel) {
@@ -344,7 +339,6 @@
   }
   dprintf(idx, "You're not away any more.\n");
   free_null(dcc[idx].u.chat->away);
-  check_bind_away(botnetnick, dcc[idx].sock, NULL);
 }
 
 void set_away(int idx, char *s)
@@ -365,7 +359,6 @@
 		"*** %s is now away: %s\n", dcc[idx].nick, s);
   }
   dprintf(idx, "You are now away.\n");
-  check_bind_away(botnetnick, dcc[idx].sock, s);
 }
 
 /* Make a password, 10-15 random letters and digits
@@ -460,7 +453,6 @@
 	snprintf(x, sizeof x, _("%s has been forcibly removed for flooding.\n"), dcc[idx].nick);
 	chanout_but(idx, chat->channel, "*** %s", x);
       }
-      check_bind_chof(dcc[idx].nick, dcc[idx].sock);
       if ((dcc[idx].sock != STDOUT) || backgrd) {
 	killsock(dcc[idx].sock);
 	lostdcc(idx);
@@ -494,7 +486,6 @@
 		 reason[0] ? ": " : "", reason);
     chanout_but(idx, dcc[idx].u.chat->channel, "*** %s.\n", x);
   }
-  check_bind_chof(dcc[idx].nick, dcc[idx].sock);
   if ((dcc[idx].sock != STDOUT) || backgrd) {
     killsock(dcc[idx].sock);
     lostdcc(idx);
@@ -526,11 +517,6 @@
     sock = atoi(ss);
   /* Don't process if there's a note binding for it */
   if (idx != (-2)) {		/* Notes from bots don't trigger it */
-    if (check_bind_note(from, to, msg)) {
-      if ((idx >= 0) && (echo))
-	dprintf(idx, "-> %s: %s\n", to, msg);
-      return NOTE_TCL;
-    }
   }
   if (!(u = get_user_by_handle(userlist, to))) {
     if (idx >= 0)
Index: eggdrop1.7/src/main.c
diff -u eggdrop1.7/src/main.c:1.124 eggdrop1.7/src/main.c:1.125
--- eggdrop1.7/src/main.c:1.124	Mon Oct  7 17:36:37 2002
+++ eggdrop1.7/src/main.c	Wed Oct  9 23:41:59 2002
@@ -30,9 +30,10 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: main.c,v 1.124 2002/10/07 22:36:37 stdarg Exp $";
+static const char rcsid[] = "$Id: main.c,v 1.125 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
+#include <eggdrop/eggdrop.h>
 #include "main.h"
 #include <fcntl.h>
 #include <time.h>
@@ -456,7 +457,6 @@
 void dns_init();
 void binds_init();
 void dcc_init();
-int user_init();
 
 void patch(const char *str)
 {
Index: eggdrop1.7/src/modules.c
diff -u eggdrop1.7/src/modules.c:1.120 eggdrop1.7/src/modules.c:1.121
--- eggdrop1.7/src/modules.c:1.120	Mon Oct  7 17:36:37 2002
+++ eggdrop1.7/src/modules.c	Wed Oct  9 23:41:59 2002
@@ -25,9 +25,10 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: modules.c,v 1.120 2002/10/07 22:36:37 stdarg Exp $";
+static const char rcsid[] = "$Id: modules.c,v 1.121 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
+#include <eggdrop/eggdrop.h>
 #include "main.h"		/* NOTE: when removing this, include config.h */
 #include "modules.h"
 #include "core_binds.h"
@@ -35,7 +36,6 @@
 #include "misc.h"
 #include "dns.h"
 #include "cmdt.h"		/* cmd_t				*/
-#include "tclhash.h"
 #include "core_binds.h"
 #include "chanprog.h"		/* clear_chanlist, reaffirm_owners, 
 				   logmodes, masktype, isowner, 
@@ -50,7 +50,7 @@
 				   open_telnet, open_telnet_dcc, 
 				   killsock, open_listen, getsock,
 				   tputs, neterror, getmyip, answer	*/
-#include "tcl.h"		/* findanyidx, do_tcl, readtclprog	*/
+#include "tcl.h"		/* do_tcl, readtclprog	*/
 #include "users.h"		/* list_type				*/
 #include "userent.h"		/* list_type_kill, xtra_set		*/
 #include "userrec.h"		/* fixfrom, user_del_chan, touch_laston,
@@ -328,7 +328,7 @@
   /* 128 - 131 */
   (Function) & interp,		 /* Tcl_Interp *			*/
   (Function) & now,		 /* time_t				*/
-  (Function) findanyidx,
+  (Function) 0,
   (Function) findchan,
   /* 132 - 135 */
   (Function) 0,
@@ -379,7 +379,7 @@
   (Function) 0,
   (Function) 0,
   (Function) & do_restart,	/* int					*/
-  (Function) check_bind_filt,
+  0,
   /* 172 - 175 */
   (Function) add_hook,
   (Function) del_hook,
@@ -432,7 +432,7 @@
   (Function) &botname,
   /* 212 - 215 */
   (Function) 0,			/* remove_gunk() -- UNUSED! (drummer)	*/
-  (Function) check_bind_chjn,
+  (Function) 0,
   (Function) 0,
   (Function) isowner,
   /* 216 - 219 */
@@ -513,14 +513,14 @@
   (Function) getlocaladdr,
   (Function) kill_bot,
   (Function) quit_msg,                /* char *				  */
-  (Function) bind_table_add,
+  0,
   /* 276 - 279 */
-  (Function) bind_table_del,
-  (Function) add_builtins,
-  (Function) rem_builtins,
-  (Function) bind_table_lookup,
+  0,
+  0,
+  0,
+  0,
   /* 280 - 283 */
-  (Function) check_bind,
+  0,
   (Function) &egg_timeval_now,
   0,
 };
@@ -619,7 +619,7 @@
     free(p);
     return e;
   }
-  check_bind(BT_load, name, NULL, name);
+  bind_check(BT_load, name, name);
   putlog(LOG_MISC, "*", _("Module loaded: %-16s"), name);
   return NULL;
 }
@@ -642,7 +642,7 @@
       if (f && !f[MODCALL_CLOSE])
 	return _("No close function");
       if (f) {
-	check_bind(BT_unload, name, NULL, name);
+	bind_check(BT_unload, name, name);
 	e = (((char *(*)()) f[MODCALL_CLOSE]) (user));
 	if (e != NULL)
 	  return e;
Index: eggdrop1.7/src/net.c
diff -u eggdrop1.7/src/net.c:1.63 eggdrop1.7/src/net.c:1.64
--- eggdrop1.7/src/net.c:1.63	Thu Sep 19 21:06:25 2002
+++ eggdrop1.7/src/net.c	Wed Oct  9 23:41:59 2002
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: net.c,v 1.63 2002/09/20 02:06:25 stdarg Exp $";
+static const char rcsid[] = "$Id: net.c,v 1.64 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include <fcntl.h>
@@ -1172,10 +1172,6 @@
        * dcc entry wants it.
        */
       if (!socklist[i].outbuf) {
-	int idx = findanyidx(socklist[i].sock);
-
-	if (idx > 0 && dcc[idx].type && dcc[idx].type->outdone)
-	  dcc[idx].type->outdone(idx);
       }
     }
   }
Index: eggdrop1.7/src/scriptbind.c
diff -u /dev/null eggdrop1.7/src/scriptbind.c:1.1
--- /dev/null	Wed Oct  9 23:42:09 2002
+++ eggdrop1.7/src/scriptbind.c	Wed Oct  9 23:41:59 2002
@@ -0,0 +1,51 @@
+#include <eggdrop/eggdrop.h>
+
+/* Prototypes for the commands we create in this file. */
+static int script_bind(char *table_name, char *mask, script_callback_t *callback);
+static int script_unbind(char *table_name, char *flags, char *mask, char *name);
+//static int script_rebind(char *table_name, char *mask, char *command, char *newflags, char *newmask);
+
+script_command_t script_bind_cmds[] = {
+	{"", "bind", script_bind, NULL, 3, "ssc", "table mask command", SCRIPT_INTEGER, 0},
+	{"", "unbind", script_unbind, NULL, 3, "sss", "table mask command", SCRIPT_INTEGER, 0},
+//	{"", "rebind", script_rebind, NULL, 6, "ssssss", "table flags mask command newflags newmask", SCRIPT_INTEGER, 0},
+	{0}
+};
+
+static int script_bind(char *table_name, char *mask, script_callback_t *callback)
+{
+	bind_table_t *table;
+	int retval;
+
+	table = bind_table_lookup(table_name);
+	if (!table) return(1);
+
+	callback->syntax = strdup(table->syntax);
+	retval = bind_entry_add(table, mask, callback->name, BIND_WANTS_CD, callback->callback, callback);
+	return(retval);
+}
+
+static int script_unbind(char *table_name, char *flags, char *mask, char *name)
+{
+	bind_table_t *table;
+	script_callback_t *callback;
+	int retval;
+
+	table = bind_table_lookup(table_name);
+	if (!table) return(1);
+
+	retval = bind_entry_del(table, -1, mask, name, &callback);
+	if (callback) callback->del(callback);
+	return(retval);
+}
+
+/*
+static int script_rebind(char *table_name, char *flags, char *mask, char *command, char *newflags, char *newmask)
+{
+	bind_table_t *table;
+
+	table = bind_table_lookup(table_name);
+	if (!table) return(-1);
+	return bind_entry_modify(table, -1, mask, command, newflags, newmask);
+}
+*/
Index: eggdrop1.7/src/scriptuser.c
diff -u eggdrop1.7/src/scriptuser.c:1.1 eggdrop1.7/src/scriptuser.c:1.2
--- eggdrop1.7/src/scriptuser.c:1.1	Mon Oct  7 17:37:27 2002
+++ eggdrop1.7/src/scriptuser.c	Wed Oct  9 23:41:59 2002
@@ -48,7 +48,7 @@
 	return(0);
 }
 
-static char *script_lookup_by_irchost(char *irchost)
+static char *script_user_find(char *irchost)
 {
 	user_t *u;
 	
@@ -100,6 +100,30 @@
 	return(0);
 }
 
+static int script_setflags(int uid, char *chan, char *flags)
+{
+	user_t *u;
+
+	u = user_lookup_by_uid(uid);
+	if (!u) return(-1);
+
+	if (!flags) {
+		flags = chan;
+		chan = NULL;
+	}
+
+	//user_setflags(u, chan, flags);
+	return(0);
+}
+
+static char *script_getflags(int uid, char *chan)
+{
+	user_t *u;
+
+	u = user_lookup_by_uid(uid);
+	if (!u) return(-1);
+}
+
 script_command_t script_new_user_cmds[] = {
 	{"", "user_uid_to_handle", script_uid_to_handle, NULL, 1, "i", "uid", SCRIPT_STRING, 0},
 	{"", "user_handle_to_uid", script_handle_to_uid, NULL, 1, "s", "handle", SCRIPT_INTEGER, 0},
@@ -107,7 +131,7 @@
 	{"", "user_validuid", script_validuid, NULL, 1, "i", "uid", SCRIPT_INTEGER, 0},
 	{"", "user_add", script_adduser, NULL, 1, "s", "handle", SCRIPT_INTEGER, 0},
 	{"", "user_addmask", script_user_addmask, NULL, 2, "is", "uid ircmask", SCRIPT_INTEGER, 0},
-	{"", "user_lookup_by_irchost", script_lookup_by_irchost, NULL, 1, "s", "irchost", SCRIPT_STRING, 0},
+	{"", "user_find", script_user_find, NULL, 1, "s", "irchost", SCRIPT_STRING, 0},
 	{"", "user_get", script_user_get, NULL, 2, "iss", "uid ?channel? setting", SCRIPT_STRING, SCRIPT_VAR_ARGS | SCRIPT_PASS_COUNT},
 	{"", "user_set", script_user_set, NULL, 3, "isss", "uid ?channel? setting value", SCRIPT_INTEGER, SCRIPT_VAR_ARGS | SCRIPT_PASS_COUNT},
 	{"", "user_save", script_user_save, NULL, 0, "s", "?fname?", SCRIPT_INTEGER, SCRIPT_VAR_ARGS},
Index: eggdrop1.7/src/tcl.c
diff -u eggdrop1.7/src/tcl.c:1.85 eggdrop1.7/src/tcl.c:1.86
--- eggdrop1.7/src/tcl.c:1.85	Mon Oct  7 17:36:37 2002
+++ eggdrop1.7/src/tcl.c	Wed Oct  9 23:41:59 2002
@@ -25,7 +25,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: tcl.c,v 1.85 2002/10/07 22:36:37 stdarg Exp $";
+static const char rcsid[] = "$Id: tcl.c,v 1.86 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include <stdlib.h>		/* getenv()				*/
@@ -33,8 +33,6 @@
 #include "main.h"
 #include "logfile.h"
 #include "misc.h"
-#include "cmdt.h"		/* cmd_t				*/
-#include "tclhash.h"		/* kill_bind2				*/
 #include "chanprog.h"		/* masktype				*/
 
 /* Used for read/write to internal strings */
@@ -336,14 +334,14 @@
   rem_tcl_coups(def_tcl_coups);
   rem_tcl_strings(def_tcl_strings);
   rem_tcl_ints(def_tcl_ints);
-  kill_binds();
   Tcl_DeleteInterp(interp);
 }
 
-extern tcl_cmds tcluser_cmds[], tcldcc_cmds[];
+extern tcl_cmds tcldcc_cmds[];
 extern script_command_t script_dcc_cmds[];
 extern script_command_t script_user_cmds[];
 extern script_command_t script_new_user_cmds[];
+extern script_command_t script_bind_cmds[];
 extern script_command_t script_misc_cmds[];
 
 /* Not going through Tcl's crazy main() system (what on earth was he
@@ -395,10 +393,10 @@
   init_traces();
 
   /* Add new commands */
-  add_tcl_commands(tcluser_cmds);
   script_create_commands(script_dcc_cmds);
   script_create_commands(script_user_cmds);
   script_create_commands(script_new_user_cmds);
+  script_create_commands(script_bind_cmds);
   script_create_commands(script_misc_cmds);
 }
 
Index: eggdrop1.7/src/tcldcc.c
diff -u eggdrop1.7/src/tcldcc.c:1.67 eggdrop1.7/src/tcldcc.c:1.68
--- eggdrop1.7/src/tcldcc.c:1.67	Fri Sep 20 16:41:49 2002
+++ eggdrop1.7/src/tcldcc.c	Wed Oct  9 23:41:59 2002
@@ -23,7 +23,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: tcldcc.c,v 1.67 2002/09/20 21:41:49 stdarg Exp $";
+static const char rcsid[] = "$Id: tcldcc.c,v 1.68 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include "main.h"
@@ -31,8 +31,6 @@
 #include "logfile.h"
 #include "misc.h"
 #include "cmdt.h"		/* cmd_t				*/
-#include "core_binds.h"		/* check_bind_chpt, check_bind_chjn,
-				   check_bind_bcst, check_bind_chof	*/
 #include "chanprog.h"		/* masktype, logmodes			*/
 #include "dccutil.h"		/* chatout, chanout_but, lostdcc
 				   not_away, set_away, new_dcc		*/
@@ -213,10 +211,7 @@
     if (dcc[idx].u.chat->channel >= 0) {
       chanout_but(idx, dcc[idx].u.chat->channel, "*** %s has gone.\n",
 		  dcc[idx].nick);
-      check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
-		     dcc[idx].u.chat->channel);
     }
-    check_bind_chof(dcc[idx].nick, dcc[idx].sock);
   }
 
 	if (dcc[idx].type == &DCC_SCRIPT) {
@@ -267,7 +262,6 @@
     chanout_but(idx, dcc[idx].u.chat->channel, "*** %s has left the %s%s%s\n",
 		dcc[idx].nick, dcc[idx].u.chat ? "channel" : "partyline",
 		reason ? ": " : "", reason ? reason : "");
-    check_bind_chof(dcc[idx].nick, dcc[idx].sock);
     /* Notice is sent to the party line, the script can add a reason. */
   }
   killsock(dcc[idx].sock);
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.74 eggdrop1.7/src/tclhash.c:removed
--- eggdrop1.7/src/tclhash.c:1.74	Thu Sep 19 21:06:25 2002
+++ eggdrop1.7/src/tclhash.c	Wed Oct  9 23:42:09 2002
@@ -1,522 +0,0 @@
-/*
- * tclhash.c --
- *
- *	bind and unbind
- *	checking and triggering the various in-bot bindings
- *	listing current bindings
- *	adding/removing new binding tables
- *	(non-Tcl) procedure lookups for msg/dcc/file commands
- *	(Tcl) binding internal procedures to msg/dcc/file commands
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id: tclhash.c,v 1.74 2002/09/20 02:06:25 stdarg Exp $";
-#endif
-
-#include "main.h"
-#include "chan.h"
-#include "users.h"
-#include "logfile.h"
-#include "cmdt.h"		/* cmd_t			*/
-#include "userrec.h"		/* touch_laston			*/
-#include "match.h"		/* wild_match_per		*/
-#include "tclhash.h"		/* prototypes			*/
-
-extern struct dcc_t *dcc;
-extern int dcc_total;
-
-/* The head of the bind table linked list. */
-static bind_table_t *bind_table_list_head = NULL;
-
-/* Garbage collection stuff. */
-static int check_bind_executing = 0;
-static int already_scheduled = 0;
-static void bind_table_really_del(bind_table_t *table);
-static void bind_entry_really_del(bind_table_t *table, bind_entry_t *entry);
-
-/* Prototypes for the commands we create in this file. */
-static int script_bind(char *table_name, char *flags, char *mask, script_callback_t *callback);
-static int script_unbind(char *table_name, char *flags, char *mask, char *name);
-static int script_rebind(char *table_name, char *flags, char *mask, char *command, char *newflags, char *newmask);
-static int script_binds(script_var_t *retval, char *tablename);
-
-static script_command_t tclhash_script_cmds[] = {
-	{"", "binds", script_binds, NULL, 0, "s", "?bind-table?", 0, SCRIPT_PASS_RETVAL | SCRIPT_VAR_ARGS},
-	{"", "bind", script_bind, NULL, 4, "sssc", "table flags mask command", SCRIPT_INTEGER, 0},
-	{"", "unbind", script_unbind, NULL, 4, "ssss", "table flags mask command", SCRIPT_INTEGER, 0},
-	{"", "rebind", script_rebind, NULL, 6, "ssssss", "table flags mask command newflags newmask", SCRIPT_INTEGER, 0},
-	{0}
-};
-
-void binds_init(void)
-{
-	bind_table_list_head = NULL;
-	script_create_commands(tclhash_script_cmds);
-}
-
-static int internal_bind_cleanup()
-{
-	bind_table_t *table, *next_table;
-	bind_entry_t *entry, *next_entry;
-
-	for (table = bind_table_list_head; table; table = next_table) {
-		next_table = table->next;
-		if (table->flags & BIND_DELETED) {
-			bind_table_really_del(table);
-			continue;
-		}
-		for (entry = table->entries; entry; entry = next_entry) {
-			next_entry = entry->next;
-			if (entry->flags & BIND_DELETED) bind_entry_really_del(table, entry);
-		}
-	}
-	already_scheduled = 0;
-	return(0);
-}
-
-static void schedule_bind_cleanup()
-{
-	egg_timeval_t when;
-
-	if (already_scheduled) return;
-	already_scheduled = 1;
-
-	when.sec = 0;
-	when.usec = 0;
-	timer_create(&when, internal_bind_cleanup);
-}
-
-void kill_binds(void)
-{
-	while (bind_table_list_head) bind_table_del(bind_table_list_head);
-}
-
-bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, int match_type, int flags)
-{
-	bind_table_t *table;
-
-	for (table = bind_table_list_head; table; table = table->next) {
-		if (!strcmp(table->name, name)) break;
-	}
-
-	/* If it doesn't exist, create it. */
-	if (!table) {
-		table = (bind_table_t *)calloc(1, sizeof(*table));
-		table->name = strdup(name);
-		table->next = bind_table_list_head;
-		bind_table_list_head = table;
-	}
-	else if (!(table->flags & BIND_FAKE)) return(table);
-
-	table->nargs = nargs;
-	if (syntax) table->syntax = strdup(syntax);
-	table->match_type = match_type;
-	table->flags = flags;
-	return(table);
-}
-
-void bind_table_del(bind_table_t *table)
-{
-	bind_table_t *cur, *prev;
-
-	for (prev = NULL, cur = bind_table_list_head; cur; prev = cur, cur = cur->next) {
-		if (!strcmp(table->name, cur->name)) break;
-	}
-
-	/* If it's found, remove it from the list. */
-	if (cur) {
-		if (prev) prev->next = cur->next;
-		else bind_table_list_head = cur->next;
-	}
-
-	/* Now delete it. */
-	if (check_bind_executing) {
-		table->flags |= BIND_DELETED;
-		schedule_bind_cleanup();
-	}
-	else {
-		bind_table_really_del(table);
-	}
-}
-
-static void bind_table_really_del(bind_table_t *table)
-{
-	bind_entry_t *entry, *next;
-
-	free(table->name);
-	for (entry = table->entries; entry; entry = next) {
-		next = entry->next;
-		free(entry->function_name);
-		free(entry->mask);
-		free(entry);
-	}
-	free(table);
-}
-
-bind_table_t *bind_table_lookup(const char *name)
-{
-	bind_table_t *table;
-
-	for (table = bind_table_list_head; table; table = table->next) {
-		if (!(table->flags & BIND_DELETED) && !strcmp(table->name, name)) break;
-	}
-	return(table);
-}
-
-bind_table_t *bind_table_lookup_or_fake(const char *name)
-{
-	bind_table_t *table;
-
-	table = bind_table_lookup(name);
-	if (!table) table = bind_table_add(name, 0, NULL, 0, BIND_FAKE);
-	return(table);
-}
-
-/* Look up a bind entry based on either function name or id. */
-bind_entry_t *bind_entry_lookup(bind_table_t *table, int id, const char *mask, const char *function_name)
-{
-	bind_entry_t *entry;
-
-	for (entry = table->entries; entry; entry = entry->next) {
-		if (entry->flags & BIND_DELETED) continue;
-		if (entry->id == id || (!strcmp(entry->mask, mask) && !strcmp(entry->function_name, function_name))) break;
-	}
-	return(entry);
-}
-
-int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, void *cdata)
-{
-	bind_entry_t *entry;
-
-	entry = bind_entry_lookup(table, id, mask, function_name);
-	if (!entry) return(-1);
-
-	if (cdata) *(void **)cdata = entry->client_data;
-
-	/* Delete it. */
-	if (check_bind_executing) {
-		entry->flags |= BIND_DELETED;
-		schedule_bind_cleanup();
-	}
-	else bind_entry_really_del(table, entry);
-	return(0);
-}
-
-static void bind_entry_really_del(bind_table_t *table, bind_entry_t *entry)
-{
-	if (entry->next) entry->next->prev = entry->prev;
-	if (entry->prev) entry->prev->next = entry->next;
-	else table->entries = entry->next;
-	free(entry->function_name);
-	free(entry->mask);
-	memset(entry, 0, sizeof(*entry));
-	free(entry);
-}
-
-/* Modify a bind entry's flags and mask. */
-int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char *function_name, const char *newflags, const char *newmask)
-{
-	bind_entry_t *entry;
-
-	entry = bind_entry_lookup(table, id, mask, function_name);
-	if (!entry) return(-1);
-
-	/* Modify it. */
-	free(entry->mask);
-	entry->mask = strdup(newmask);
-	entry->user_flags.match = FR_GLOBAL | FR_CHAN;
-	break_down_flags(newflags, &(entry->user_flags), NULL);
-
-	return(0);
-}
-
-int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data)
-{
-	bind_entry_t *entry, *old_entry;
-
-	old_entry = bind_entry_lookup(table, -1, mask, function_name);
-
-	if (old_entry) {
-		if (table->flags & BIND_STACKABLE) {
-			entry = (bind_entry_t *)calloc(1, sizeof(*entry));
-			entry->prev = old_entry;
-			entry->next = old_entry->next;
-			old_entry->next = entry;
-			if (entry->next) entry->next->prev = entry;
-		}
-		else {
-			entry = old_entry;
-			free(entry->function_name);
-			free(entry->mask);
-		}
-	}
-	else {
-		for (old_entry = table->entries; old_entry && old_entry->next; old_entry = old_entry->next) {
-			; /* empty loop */
-		}
-		entry = (bind_entry_t *)calloc(1, sizeof(*entry));
-		if (old_entry) old_entry->next = entry;
-		else table->entries = entry;
-		entry->prev = old_entry;
-	}
-
-	entry->mask = strdup(mask);
-	entry->function_name = strdup(function_name);
-	entry->callback = callback;
-	entry->client_data = client_data;
-	entry->flags = bind_flags;
-
-	entry->user_flags.match = FR_GLOBAL | FR_CHAN;
-	break_down_flags(flags, &(entry->user_flags), NULL);
-
-	return(0);
-}
-
-static int script_bind(char *table_name, char *flags, char *mask, script_callback_t *callback)
-{
-	bind_table_t *table;
-	int retval;
-
-	table = bind_table_lookup(table_name);
-	if (!table) return(1);
-
-	callback->syntax = strdup(table->syntax);
-	retval = bind_entry_add(table, flags, mask, callback->name, BIND_WANTS_CD, callback->callback, callback);
-	return(retval);
-}
-
-static int script_unbind(char *table_name, char *flags, char *mask, char *name)
-{
-	bind_table_t *table;
-	script_callback_t *callback;
-	int retval;
-
-	table = bind_table_lookup(table_name);
-	if (!table) return(1);
-
-	retval = bind_entry_del(table, -1, mask, name, &callback);
-	if (callback) callback->del(callback);
-	return(retval);
-}
-
-static int script_rebind(char *table_name, char *flags, char *mask, char *command, char *newflags, char *newmask)
-{
-	bind_table_t *table;
-
-	table = bind_table_lookup(table_name);
-	if (!table) return(-1);
-	return bind_entry_modify(table, -1, mask, command, newflags, newmask);
-}
-
-int findanyidx(register int z)
-{
-  register int j;
-
-  for (j = 0; j < dcc_total; j++)
-    if (dcc[j].type && dcc[j].sock == z)
-      return j;
-  return -1;
-}
-
-/* Returns a list of binds in a given table, or the list of bind tables. */
-static int script_binds(script_var_t *retval, char *tablename)
-{
-	bind_table_t *table;
-	bind_entry_t *entry;
-	script_var_t *sublist, *func, *flags, *mask, *nhits;
-	char flagbuf[128];
-
-	retval->type = SCRIPT_ARRAY | SCRIPT_FREE | SCRIPT_VAR;
-	retval->len = 0;
-	retval->value = NULL;
-
-	/* No table name? Then return the list of tables. */
-	if (!tablename) {
-		for (table = bind_table_list_head; table; table = table->next) {
-			if (table->flags & BIND_DELETED) return(0);
-			script_list_append(retval, script_string(table->name, -1));
-		}
-		return(0);
-	}
-
-	table = bind_table_lookup(tablename);
-	if (!table) return(0);
-
-	for (entry = table->entries; entry; entry = entry->next) {
-		if (entry->flags & BIND_DELETED) continue;
-
-		mask = script_string(entry->mask, -1);
-		build_flags(flagbuf, &entry->user_flags, NULL);
-		flags = script_copy_string(flagbuf, -1);
-		nhits = script_int(entry->nhits);
-		func = script_string(entry->function_name, -1);
-		sublist = script_list(4, flags, mask, nhits, func);
-		script_list_append(retval, sublist);
-	}
-	return(0);
-}
-
-/* Execute a bind entry with the given argument list. */
-static int bind_entry_exec(bind_table_t *table, bind_entry_t *entry, void **al)
-{
-	bind_entry_t *prev;
-
-	/* Give this entry a hit. */
-	entry->nhits++;
-
-	/* Search for the last entry that isn't deleted. */
-	for (prev = entry->prev; prev; prev = prev->prev) {
-		if (!(prev->flags & BIND_DELETED) && (prev->nhits >= entry->nhits)) break;
-	}
-
-	/* See if this entry is more popular than the preceding one. */
-	if (entry->prev != prev) {
-		/* Remove entry. */
-		if (entry->prev) entry->prev->next = entry->next;
-		else table->entries = entry->next;
-		if (entry->next) entry->next->prev = entry->prev;
-
-		/* Re-add in correct position. */
-		if (prev) {
-			entry->next = prev->next;
-			if (prev->next) prev->next->prev = entry;
-			prev->next = entry;
-		}
-		else {
-			entry->next = table->entries;
-			table->entries = entry;
-		}
-		entry->prev = prev;
-		if (entry->next) entry->next->prev = entry;
-	}
-
-	/* Does the callback want client data? */
-	if (entry->flags & BIND_WANTS_CD) {
-		*al = entry->client_data;
-	}
-	else al++;
-
-	return entry->callback(al[0], al[1], al[2], al[3], al[4], al[5], al[6], al[7], al[8], al[9]);
-}
-
-int check_bind(bind_table_t *table, const char *match, struct flag_record *flags, ...)
-{
-	void *args[11];
-	bind_entry_t *entry, *next;
-	int i, cmp, retval;
-	va_list ap;
-
-	check_bind_executing++;
-
-	va_start(ap, flags);
-	for (i = 1; i <= table->nargs; i++) {
-		args[i] = va_arg(ap, void *);
-	}
-	va_end(ap);
-
-	/* Default return value is 0 */
-	retval = 0;
-
-	/* If it's a partial bind, we have to find the closest match. */
-	if (table->match_type & MATCH_PARTIAL) {
-		int matchlen, masklen, tie;
-		bind_entry_t *winner;
-
-		matchlen = strlen(match);
-		tie = 0;
-		winner = NULL;
-		for (entry = table->entries; entry; entry = entry->next) {
-			if (entry->flags & BIND_DELETED) continue;
-			if (table->flags & BIND_USE_ATTR) {
-				if (table->flags & BIND_STRICT_ATTR) cmp = flagrec_eq(&entry->user_flags, flags);
-				else cmp = flagrec_ok(&entry->user_flags, flags);
-				if (!cmp) continue;
-			}
-			masklen = strlen(entry->mask);
-			if (!strncasecmp(match, entry->mask, masklen < matchlen ? masklen : matchlen)) {
-				winner = entry;
-				if (masklen == matchlen) break;
-				else if (tie) return(-1);
-				else tie = 1;
-			}
-		}
-		if (winner) retval = bind_entry_exec(table, winner, args);
-		else retval = -1;
-		check_bind_executing--;
-		return(retval);
-	}
-
-	for (entry = table->entries; entry; entry = next) {
-		next = entry->next;
-		if (entry->flags & BIND_DELETED) continue;
-
-		if (table->match_type & MATCH_MASK) {
-			cmp = !wild_match_per((unsigned char *)entry->mask, (unsigned char *)match);
-		}
-		else {
-			if (table->match_type & MATCH_CASE) cmp = strcmp(entry->mask, match);
-			else cmp = strcasecmp(entry->mask, match);
-		}
-		if (cmp) continue; /* Doesn't match. */
-
-		/* Check flags. */
-		if (table->flags & BIND_USE_ATTR) {
-			if (table->flags & BIND_STRICT_ATTR) cmp = flagrec_eq(&entry->user_flags, flags);
-			else cmp = flagrec_ok(&entry->user_flags, flags);
-			if (!cmp) continue;
-		}
-
-		retval = bind_entry_exec(table, entry, args);
-		if ((table->flags & BIND_BREAKABLE) && (retval & BIND_RET_BREAK)) {
-			check_bind_executing--;
-			return(retval);
-		}
-	}
-	check_bind_executing--;
-	return(retval);
-}
-
-void add_builtins(const char *table_name, cmd_t *cmds)
-{
-	char name[50];
-	bind_table_t *table;
-
-	table = bind_table_lookup_or_fake(table_name);
-
-	for (; cmds->name; cmds++) {
-		snprintf(name, 50, "*%s:%s", table->name, cmds->funcname ? cmds->funcname : cmds->name);
-		bind_entry_add(table, cmds->flags, cmds->name, name, 0, cmds->func, NULL);
-	}
-}
-
-void rem_builtins(const char *table_name, cmd_t *cmds)
-{
-	char name[50];
-	bind_table_t *table;
-
-	table = bind_table_lookup(table_name);
-	if (!table) return;
-
-	for (; cmds->name; cmds++) {
-		sprintf(name, "*%s:%s", table->name, cmds->funcname ? cmds->funcname : cmds->name);
-		bind_entry_del(table, -1, cmds->name, name, NULL);
-	}
-}
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.33 eggdrop1.7/src/tclhash.h:removed
--- eggdrop1.7/src/tclhash.h:1.33	Fri Aug  9 18:44:07 2002
+++ eggdrop1.7/src/tclhash.h	Wed Oct  9 23:42:09 2002
@@ -1,100 +0,0 @@
-/*
- * tclhash.h --
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-/*
- * $Id: tclhash.h,v 1.33 2002/08/09 23:44:07 stdarg Exp $
- */
-
-#ifndef _TCLHASH_H_
-#define _TCLHASH_H_
-
-#include "flags.h"		/* flag_record		*/
-
-/* Match type flags for bind tables. */
-#define MATCH_PARTIAL       1
-#define MATCH_EXACT         2
-#define MATCH_MASK          4
-#define MATCH_CASE          8
-
-/* Flags for binds. */
-/* Does the callback want their client_data inserted as the first argument? */
-#define BIND_WANTS_CD 1
-#define BIND_USE_ATTR	2
-#define BIND_STRICT_ATTR	4
-#define BIND_BREAKABLE	8
-#define BIND_STACKABLE	16
-#define BIND_DELETED	32
-#define BIND_FAKE	64
-
-/* Flags for return values from bind callbacks */
-#define BIND_RET_LOG 1
-#define BIND_RET_BREAK 2
-
-/* This holds the information for a bind entry. */
-typedef struct bind_entry_b {
-	struct bind_entry_b *next, *prev;
-	struct flag_record user_flags;
-	char *mask;
-	char *function_name;
-	Function callback;
-	void *client_data;
-	int nhits;
-	int flags;
-	int id;
-} bind_entry_t;
-
-/* This is the highest-level structure. It's like the "msg" table
-   or the "pubm" table. */
-typedef struct bind_table_b {
-	struct bind_table_b *next;
-	bind_entry_t *entries;
-	char *name;
-	char *syntax;
-	int nargs;
-	int match_type;
-	int flags;
-} bind_table_t;
-
-#ifndef MAKING_MODS
-
-void kill_binds(void);
-
-int check_bind(bind_table_t *table, const char *match, struct flag_record *_flags, ...);
-
-bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, int match_type, int flags);
-
-void bind_table_del(bind_table_t *table);
-
-bind_table_t *bind_table_lookup(const char *name);
-
-int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data);
-
-int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, void *cdata);
-
-int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char *function_name, const char *newflags, const char *newmask);
-
-void add_builtins(const char *table_name, cmd_t *cmds);
-
-void rem_builtins(const char *table_name, cmd_t *cmds);
-
-#endif				/* !MAKING_MODS */
-
-#endif				/* !_TCLHASH_H_ */
Index: eggdrop1.7/src/tcluser.c
diff -u eggdrop1.7/src/tcluser.c:1.44 eggdrop1.7/src/tcluser.c:1.45
--- eggdrop1.7/src/tcluser.c:1.44	Mon Oct  7 17:36:37 2002
+++ eggdrop1.7/src/tcluser.c	Wed Oct  9 23:41:59 2002
@@ -23,7 +23,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: tcluser.c,v 1.44 2002/10/07 22:36:37 stdarg Exp $";
+static const char rcsid[] = "$Id: tcluser.c,v 1.45 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include "main.h"
@@ -351,71 +351,6 @@
   return(0);
 }
 
-static int tcl_getuser STDVAR
-{
-  struct user_entry_type *et;
-  struct userrec *u;
-  struct user_entry *e;
-
-  BADARGS(3, 999, " handle type");
-  if (!(et = find_entry_type(argv[2])) && strcasecmp(argv[2], "HANDLE")) {
-    Tcl_AppendResult(irp, "No such info type: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
-  if (!(u = get_user_by_handle(userlist, argv[1]))) {
-    if (argv[1][0] != '*') {
-      Tcl_AppendResult(irp, "No such user.", NULL);
-      return TCL_ERROR;
-    } else
-      return TCL_OK;		/* silently ignore user * */
-  }
-  if (!strcasecmp(argv[2], "HANDLE")) {
-    Tcl_AppendResult(irp,u->handle, NULL);
-  } else {
-  e = find_user_entry(et, u);
-  if (e)
-    return et->tcl_get(irp, u, e, argc, argv);
-  }
-  return TCL_OK;
-}
-
-static int tcl_setuser STDVAR
-{
-  struct user_entry_type *et;
-  struct userrec *u;
-  struct user_entry *e;
-  int r;
-
-  BADARGS(3, 999, " handle type ?setting....?");
-  if (!(et = find_entry_type(argv[2]))) {
-    Tcl_AppendResult(irp, "No such info type: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
-  if (!(u = get_user_by_handle(userlist, argv[1]))) {
-    if (argv[1][0] != '*') {
-      Tcl_AppendResult(irp, "No such user.", NULL);
-      return TCL_ERROR;
-    } else
-      return TCL_OK;		/* Silently ignore user * */
-  }
-  if (!(e = find_user_entry(et, u))) {
-    e = malloc(sizeof(struct user_entry));
-    e->type = et;
-    e->name = NULL;
-    e->u.list = NULL;
-    list_insert((&(u->entries)), e);
-  }
-  r = et->tcl_set(irp, u, e, argc, argv);
-  /* Yeah... e is freed, and we read it... (tcl: setuser hand HOSTS none) */
-  if (!e->u.list) {
-    if (list_delete((struct list_type **) &(u->entries),
-		    (struct list_type *) e))
-      free(e);
-    /* else maybe already freed... (entry_type==HOSTS) <drummer> */
-  }
-  return r;
-}
-
 script_command_t script_user_cmds[] = {
 	{"", "countusers", script_countusers, NULL, 0, "", "", SCRIPT_INTEGER, 0},
 	{"", "validuser", script_validuser, NULL, 1, "s", "handle", SCRIPT_INTEGER, 0},
@@ -437,11 +372,4 @@
 	{"", "killignore", (Function) script_killignore, NULL, 1, "s", "hostmask", SCRIPT_INTEGER, 0},
 	{"", "ignorelist", (Function) script_ignorelist, NULL, 0, "", "", 0, SCRIPT_PASS_RETVAL},
 	{0}
-};
-
-tcl_cmds tcluser_cmds[] =
-{
-  {"getuser",		tcl_getuser},
-  {"setuser",		tcl_setuser},
-  {NULL,		NULL}
 };
Index: eggdrop1.7/src/userrec.c
diff -u eggdrop1.7/src/userrec.c:1.52 eggdrop1.7/src/userrec.c:1.53
--- eggdrop1.7/src/userrec.c:1.52	Fri Sep 20 16:41:49 2002
+++ eggdrop1.7/src/userrec.c	Wed Oct  9 23:41:59 2002
@@ -25,7 +25,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: userrec.c,v 1.52 2002/09/20 21:41:49 stdarg Exp $";
+static const char rcsid[] = "$Id: userrec.c,v 1.53 2002/10/10 04:41:59 stdarg Exp $";
 #endif
 
 #include <sys/stat.h>
@@ -39,7 +39,6 @@
 #include "chanprog.h"		/* clear_chanlist, set_chanlist		*/
 #include "dccutil.h"		/* shareout, chanout_but		*/
 #include "irccmp.h"		/* irccmp				*/
-#include "core_binds.h"		/* check_bind_nkch			*/
 #include "flags.h"
 #include "match.h"		/* wild_match				*/
 #include "userrec.h"		/* prototypes				*/
@@ -401,7 +400,6 @@
   /* Nothing that will confuse the userfile */
   if (!newh[1] && strchr(BADHANDCHARS, newh[0]))
     return 0;
-  check_bind_nkch(u->handle, newh);
   /* Yes, even send bot nick changes now: */
   if (!noshare && !(u->flags & USER_UNSHARED))
     shareout(NULL, "h %s %s\n", u->handle, newh);
Index: eggdrop1.7/testcode/match.c
diff -u eggdrop1.7/testcode/match.c:1.1 eggdrop1.7/testcode/match.c:1.2
--- eggdrop1.7/testcode/match.c:1.1	Sun May  5 23:52:11 2002
+++ eggdrop1.7/testcode/match.c	Wed Oct  9 23:41:59 2002
@@ -27,6 +27,9 @@
 #define WILDQ '?'		/* matches exactly one character */
 #define WILDT '~'		/* matches any number of spaces */
 
+#include <ctype.h>
+#define irctoupper toupper
+
 /* matching for binds */
 int wild_match_per(char *wild, char *matchtext) {
   char *fallback=0;
----------------------- End of diff -----------------------



More information about the Changes mailing list