[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sat Oct 6 23:04:01 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-10-07 04:03:05 UTC
Commited by: stdarg

Modified files:
     src/botcmd.c src/botnet.c src/cmds.c src/dccutil.c src/tclhash.c
     src/tclhash.h src/mod/modvals.h src/mod/ctcp.mod/ctcp.c
     src/mod/irc.mod/irc.c src/mod/irc.mod/irc.h
     src/mod/server.mod/server.c src/mod/server.mod/server.h
     src/mod/server.mod/servmsg.c

Log message:

Got rid of bind tables in the exported irc function table. They're not used anywhere in the core or other normal modules. Other people should use find_bind_table(), not #define's.
Got rid of H_* bind tables in irc module. All are BT_* now.
Integrated the new bind tables in with the normal bind/unbind command.
Made tcl callbacks work with the normal data types (string, int, user (handle)).
Got rid of old bind tables in server.mod
Made ctcp.mod use the new bind tables.
Wrote down most of the stuff I did so that ITE could see a detailed report :) hehe (although I have a feeling I've left something out)

---------------------- diff included ----------------------
Index: eggdrop1.7/src/botcmd.c
diff -u eggdrop1.7/src/botcmd.c:1.23 eggdrop1.7/src/botcmd.c:1.24
--- eggdrop1.7/src/botcmd.c:1.23	Thu Sep 27 22:15:34 2001
+++ eggdrop1.7/src/botcmd.c	Sat Oct  6 23:02:54 2001
@@ -3,7 +3,7 @@
  *   commands that comes across the botnet
  *   userfile transfer and update commands from sharebots
  *
- * $Id: botcmd.c,v 1.23 2001/09/28 03:15:34 stdarg Exp $
+ * $Id: botcmd.c,v 1.24 2001/10/07 04:02:54 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1252,13 +1252,11 @@
 	chanout_but(-1, i, "*** (%s) %s %s %s.\n", bot, nick, _("has left the"),
 		    i ? "channel" : "party line");
       check_tcl_chpt(bot, nick, sock, i);
-      check_chpt(bot, nick, sock, i);
     }
     if ((b_numver(idx) >= NEAT_BOTNET) && !linking)
       chanout_but(-1, chan, "*** (%s) %s %s %s.\n", bot, nick, _("has joined the"),
 		  chan ? "channel" : "party line");
     check_tcl_chjn(bot, nick, chan, y[0], sock, par);
-    check_chjn(bot, nick, chan, y[0], sock, par);
   }
 }
 
@@ -1297,7 +1295,6 @@
   if ((partyidx = getparty(bot, sock)) != -1) {
     if (party[partyidx].chan >= 0) {
       check_tcl_chpt(bot, nick, sock, party[partyidx].chan);
-      check_chpt(bot, nick, sock, party[partyidx].chan);
     }
     if ((b_numver(idx) >= NEAT_BOTNET) && !silent) {
       register int chan = party[partyidx].chan;
Index: eggdrop1.7/src/botnet.c
diff -u eggdrop1.7/src/botnet.c:1.39 eggdrop1.7/src/botnet.c:1.40
--- eggdrop1.7/src/botnet.c:1.39	Thu Sep 27 22:15:34 2001
+++ eggdrop1.7/src/botnet.c	Sat Oct  6 23:02:54 2001
@@ -7,7 +7,7 @@
  *   linking, unlinking, and relaying to another bot
  *   pinging the bots periodically and checking leaf status
  *
- * $Id: botnet.c,v 1.39 2001/09/28 03:15:34 stdarg Exp $
+ * $Id: botnet.c,v 1.40 2001/10/07 04:02:54 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -372,7 +372,6 @@
     if (!egg_strcasecmp(party[i].bot, bot)) {
       if (party[i].chan >= 0) {
         check_tcl_chpt(bot, party[i].nick, party[i].sock, party[i].chan);
-        check_chpt(bot, party[i].nick, party[i].sock, party[i].chan);
       }
       remparty(bot, party[i].sock);
       i--;
@@ -980,7 +979,6 @@
       if (party[i].chan >= 0) {
         check_tcl_chpt(party[i].bot, party[i].nick, party[i].sock,
 		       party[i].chan);
-        check_chpt(party[i].bot, party[i].nick, party[i].sock, party[i].chan);
       }
     }
     strcpy(s, "killassoc &");
@@ -1371,7 +1369,6 @@
       botnet_send_part_idx(uidx, NULL);
     check_tcl_chpt(botnetnick, dcc[uidx].nick, dcc[uidx].sock,
 		   dcc[uidx].u.chat->channel);
-    check_chpt(botnetnick, dcc[uidx].nick, dcc[uidx].sock, dcc[uidx].u.chat->channel);
   }
   check_tcl_chof(dcc[uidx].nick, dcc[uidx].sock);
   dcc[uidx].type = &DCC_RELAYING;
@@ -1411,7 +1408,6 @@
   check_tcl_chon(dcc[j].nick, dcc[j].sock);
   check_tcl_chjn(botnetnick, dcc[j].nick, dcc[j].u.chat->channel,
 		 geticon(j), dcc[j].sock, dcc[j].host);
-  check_chjn(botnetnick, dcc[j].nick, dcc[j].u.chat->channel, geticon(j), dcc[j].sock, dcc[j].host);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -1508,7 +1504,6 @@
   if (dcc[idx].u.chat->channel >= 0) {
     check_tcl_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
 		   geticon(idx), dcc[idx].sock, dcc[idx].host);
-    check_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel, geticon(idx), dcc[idx].sock, dcc[idx].host);
   }
   killsock(dcc[j].sock);
   lostdcc(j);
@@ -1712,40 +1707,10 @@
       check_tcl_chon(dcc[i].nick, dcc[i].sock);
       check_tcl_chjn(botnetnick, dcc[i].nick, dcc[i].u.chat->channel,
 		     geticon(i), dcc[i].sock, dcc[i].host);
-      check_chjn(botnetnick, dcc[i].nick, dcc[i].u.chat->channel, geticon(i), dcc[i].sock, dcc[i].host);
-      check_chjn(botnetnick, dcc[i].nick, dcc[i].u.chat->channel, geticon(i),
-		     dcc[i].sock, dcc[i].host);
     }
   }
   for (i = 0; i < parties; i++) {
     check_tcl_chjn(party[i].bot, party[i].nick, party[i].chan,
 		   party[i].flag, party[i].sock, party[i].from);
-    check_chjn(party[i].bot, party[i].nick, party[i].chan, party[i].flag, party[i].sock, party[i].from);
   }
-}
-
-void check_chjn(const char *bot, const char *nick, int chan, const char type, int sock, const char *host)
-{
-	char buf[32];
-	char stype[2];
-	struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
-
-	sprintf(buf, "%d", chan);
-	stype[0] = type;
-	stype[1] = (char) 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; break;
-	}
-	check_bind(BT_chjn, buf, NULL, bot, nick, chan, stype, sock, host);
-}
-
-void check_chpt(const char *bot, const char *hand, int sock, int chan)
-{
-	char buf[32];
-
-	sprintf(buf, "%d", chan);
-	check_bind(BT_chpt, buf, NULL, bot, hand, sock, chan);
 }
Index: eggdrop1.7/src/cmds.c
diff -u eggdrop1.7/src/cmds.c:1.68 eggdrop1.7/src/cmds.c:1.69
--- eggdrop1.7/src/cmds.c:1.68	Thu Oct  4 23:28:48 2001
+++ eggdrop1.7/src/cmds.c	Sat Oct  6 23:02:54 2001
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.68 2001/10/05 04:28:48 guppy Exp $
+ * $Id: cmds.c,v 1.69 2001/10/07 04:02:54 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -2728,7 +2728,7 @@
 	flush_lines(idx, dcc[idx].u.chat);
 	putlog(LOG_MISC, "*", _("DCC connection closed (%s!%s)"), dcc[idx].nick, dcc[idx].host);
 	if (dcc[idx].u.chat->channel >= 0) {
-		chanout_but(-1, dcc[idx].u.chat->channel, "*** %s left the party line%s%s\n", dcc[idx].nick, text[0] ? ": " : ".", buf);
+		chanout_but(-1, dcc[idx].u.chat->channel, "*** %s left the party line%s%s\n", dcc[idx].nick, text[0] ? ": " : ".", text);
 		if (dcc[idx].u.chat->channel < 100000) {
 			botnet_send_part_idx(idx, text);
 		}
Index: eggdrop1.7/src/dccutil.c
diff -u eggdrop1.7/src/dccutil.c:1.35 eggdrop1.7/src/dccutil.c:1.36
--- eggdrop1.7/src/dccutil.c:1.35	Thu Sep 27 22:15:34 2001
+++ eggdrop1.7/src/dccutil.c	Sat Oct  6 23:02:54 2001
@@ -6,7 +6,7 @@
  *   memory management for dcc structures
  *   timeout checking for dcc connections
  *
- * $Id: dccutil.c,v 1.35 2001/09/28 03:15:34 stdarg Exp $
+ * $Id: dccutil.c,v 1.36 2001/10/07 04:02:54 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -248,7 +248,6 @@
       }
       check_tcl_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
 		     geticon(idx), dcc[idx].sock, dcc[idx].host);
-      check_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel, geticon(idx), dcc[idx].sock, dcc[idx].host);
     }
     /* But *do* bother with sending it locally */
     if (!dcc[idx].u.chat->channel) {
Index: eggdrop1.7/src/mod/ctcp.mod/ctcp.c
diff -u eggdrop1.7/src/mod/ctcp.mod/ctcp.c:1.17 eggdrop1.7/src/mod/ctcp.mod/ctcp.c:1.18
--- eggdrop1.7/src/mod/ctcp.mod/ctcp.c:1.17	Thu Jul 26 12:04:33 2001
+++ eggdrop1.7/src/mod/ctcp.mod/ctcp.c	Sat Oct  6 23:02:55 2001
@@ -2,7 +2,7 @@
  * ctcp.c -- part of ctcp.mod
  *   all the ctcp handling (except DCC, it's special ;)
  *
- * $Id: ctcp.c,v 1.17 2001/07/26 17:04:33 drummer Exp $
+ * $Id: ctcp.c,v 1.18 2001/10/07 04:02:55 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -31,6 +31,9 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+/* Import this bind table from server.mod */
+static bind_table_t *BT_ctcp;
+
 static Function *global = NULL, *server_funcs = NULL;
 
 static char ctcp_version[121];
@@ -39,7 +42,7 @@
 static int ctcp_mode = 0;
 
 
-static int ctcp_FINGER(char *nick, char *uhost, char *handle,
+static int ctcp_FINGER(char *nick, char *uhost, struct userrec *u,
 		       char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && ctcp_finger[0])
@@ -47,7 +50,7 @@
   return 1;
 }
 
-static int ctcp_ECHOERR(char *nick, char *uhost, char *handle,
+static int ctcp_ECHOERR(char *nick, char *uhost, struct userrec *u,
 			char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && strlen(text) <= 80)
@@ -55,10 +58,9 @@
   return 1;
 }
 
-static int ctcp_PING(char *nick, char *uhost, char *handle,
+static int ctcp_PING(char *nick, char *uhost, struct userrec *u,
 		     char *object, char *keyword, char *text)
 {
-  struct userrec *u = get_user_by_handle(userlist, handle);
   int atr = u ? u->flags : 0;
 
   if ((ctcp_mode != 1 || (atr & USER_OP)) && strlen(text) <= 80)
@@ -66,7 +68,7 @@
   return 1;
 }
 
-static int ctcp_VERSION(char *nick, char *uhost, char *handle,
+static int ctcp_VERSION(char *nick, char *uhost, struct userrec *u,
 			char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && ctcp_version[0])
@@ -75,7 +77,7 @@
   return 1;
 }
 
-static int ctcp_USERINFO(char *nick, char *uhost, char *handle,
+static int ctcp_USERINFO(char *nick, char *uhost, struct userrec *u,
 			 char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && ctcp_userinfo[0])
@@ -84,7 +86,7 @@
   return 1;
 }
 
-static int ctcp_CLIENTINFO(char *nick, char *uhosr, char *handle,
+static int ctcp_CLIENTINFO(char *nick, char *uhosr, struct userrec *u,
 			   char *object, char *keyword, char *msg)
 {
   char *p = NULL;
@@ -126,7 +128,7 @@
   return 1;
 }
 
-static int ctcp_TIME(char *nick, char *uhost, char *handle, char *object,
+static int ctcp_TIME(char *nick, char *uhost, struct userrec *u, char *object,
 		     char *keyword, char *text)
 {
   char tms[25];
@@ -139,10 +141,9 @@
   return 1;
 }
 
-static int ctcp_CHAT(char *nick, char *uhost, char *handle, char *object,
+static int ctcp_CHAT(char *nick, char *uhost, struct userrec *u, char *object,
 		     char *keyword, char *text)
 {
-  struct userrec *u = get_user_by_handle(userlist, handle);
   int atr = u ? u->flags : 0, i;
 
   if ((atr & (USER_PARTY | USER_XFER)) ||
@@ -198,7 +199,7 @@
 {
   rem_tcl_strings(mystrings);
   rem_tcl_ints(myints);
-  rem_builtins(H_ctcp, myctcp);
+  if (BT_ctcp) rem_builtins2(BT_ctcp, myctcp);
   rem_help_reference("ctcp.help");
   module_undepend(MODULE_NAME);
   return NULL;
@@ -229,7 +230,8 @@
   }
   add_tcl_strings(mystrings);
   add_tcl_ints(myints);
-  add_builtins(H_ctcp, myctcp);
+  BT_ctcp = find_bind_table2("ctcp");
+  if (BT_ctcp) add_builtins2(BT_ctcp, myctcp);
   add_help_reference("ctcp.help");
   if (!ctcp_version[0]) {
     strncpy(ctcp_version, ver, 120);
Index: eggdrop1.7/src/mod/irc.mod/irc.c
diff -u eggdrop1.7/src/mod/irc.mod/irc.c:1.62 eggdrop1.7/src/mod/irc.mod/irc.c:1.63
--- eggdrop1.7/src/mod/irc.mod/irc.c:1.62	Thu Sep 27 22:15:35 2001
+++ eggdrop1.7/src/mod/irc.mod/irc.c	Sat Oct  6 23:02:55 2001
@@ -2,7 +2,7 @@
  * irc.c -- part of irc.mod
  *   support for channels within the bot
  *
- * $Id: irc.c,v 1.62 2001/09/28 03:15:35 stdarg Exp $
+ * $Id: irc.c,v 1.63 2001/10/07 04:02:55 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -26,21 +26,19 @@
 #define MODULE_NAME "irc"
 #define MAKING_IRC
 #include "src/mod/module.h"
-#include "irc.h"
 #include "server.mod/server.h"
+#include "irc.h"
 #include "channels.mod/channels.h"
 #ifdef HAVE_UNAME
 #include <sys/utsname.h>
 #endif
 
 /* We import some bind tables from server.mod */
-static bind_table_t *BT_raw, *BT_msg;
+static bind_table_t *BT_dcc, *BT_raw, *BT_msg, *BT_ctcp, *BT_ctcr;
 
 /* We also create a few. */
-static bind_table_t *BT_pub, *BT_pubm;
+static bind_table_t *BT_topic, *BT_split, *BT_rejoin, *BT_quit, *BT_join, *BT_part, *BT_kick, *BT_nick, *BT_mode, *BT_need, *BT_pub, *BT_pubm;
 
-static p_tcl_bind_list H_topc, H_splt, H_sign, H_rejn, H_part, H_pub, H_pubm;
-static p_tcl_bind_list H_nick, H_mode, H_kick, H_join, H_need;
 static Function *global = NULL, *channels_funcs = NULL, *server_funcs = NULL;
 
 static int ctcp_mode;
@@ -519,7 +517,6 @@
 static void check_lonely_channel(struct chanset_t *chan)
 {
   memberlist *m;
-  char s[UHOSTLEN];
   int i = 0;
 
   if (channel_pending(chan) || !channel_active(chan) || me_op(chan) ||
@@ -649,62 +646,16 @@
   }
 }
 
-static int channels_6char STDVAR
-{
-  Function F = (Function) cd;
-  char x[20];
-
-  BADARGS(7, 7, " nick user at host handle desto/chan keyword/nick text");
-  CHECKVALIDITY(channels_6char);
-  sprintf(x, "%d", F(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]));
-  Tcl_AppendResult(irp, x, NULL);
-  return TCL_OK;
-}
-
-static int channels_5char STDVAR
-{
-  Function F = (Function) cd;
-
-  BADARGS(6, 6, " nick user at host handle channel text");
-  CHECKVALIDITY(channels_5char);
-  F(argv[1], argv[2], argv[3], argv[4], argv[5]);
-  return TCL_OK;
-}
-
-static int channels_4char STDVAR
-{
-  Function F = (Function) cd;
-
-  BADARGS(5, 5, " nick uhost hand chan/param");
-  CHECKVALIDITY(channels_4char);
-  F(argv[1], argv[2], argv[3], argv[4]);
-  return TCL_OK;
-}
-
-static int channels_2char STDVAR
-{
-  Function F = (Function) cd;
-
-  BADARGS(3, 3, " channel type");
-  CHECKVALIDITY(channels_2char);
-  F(argv[1], argv[2]);
-  return TCL_OK;
-}
-
 static void check_tcl_joinspltrejn(char *nick, char *uhost, struct userrec *u,
-			       char *chname, p_tcl_bind_list table)
+			       char *chname, bind_table_t *table)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   char args[1024];
 
   simple_sprintf(args, "%s %s!%s", chname, nick, uhost);
   get_user_flagrec(u, &fr, chname);
-  Tcl_SetVar(interp, "_jp1", nick, 0);
-  Tcl_SetVar(interp, "_jp2", uhost, 0);
-  Tcl_SetVar(interp, "_jp3", u ? u->handle : "*", 0);
-  Tcl_SetVar(interp, "_jp4", chname, 0);
-  check_tcl_bind(table, args, &fr, " $_jp1 $_jp2 $_jp3 $_jp4",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+
+  check_bind(table, args, &fr, nick, uhost, u, chname);
 }
 
 /* we handle part messages now *sigh* (guppy 27Jan2000) */
@@ -717,86 +668,66 @@
 
   simple_sprintf(args, "%s %s!%s", chname, nick, uhost);
   get_user_flagrec(u, &fr, chname);
-  Tcl_SetVar(interp, "_p1", nick, 0);
-  Tcl_SetVar(interp, "_p2", uhost, 0);
-  Tcl_SetVar(interp, "_p3", u ? u->handle : "*", 0);
-  Tcl_SetVar(interp, "_p4", chname, 0);
-  Tcl_SetVar(interp, "_p5", text ? text : "", 0);
-  check_tcl_bind(H_part, args, &fr, " $_p1 $_p2 $_p3 $_p4 $_p5",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+
+  check_bind(BT_part, args, &fr, nick, uhost, u, chname, text);
 }
 
 static void check_tcl_signtopcnick(char *nick, char *uhost, struct userrec *u,
 				   char *chname, char *reason,
-				   p_tcl_bind_list table)
+				   bind_table_t *table)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   char args[1024];
 
-  if (table == H_sign)
+  if (table == BT_quit) {
     simple_sprintf(args, "%s %s!%s", chname, nick, uhost);
-  else
+  }
+  else {
     simple_sprintf(args, "%s %s", chname, reason);
+  }
   get_user_flagrec(u, &fr, chname);
-  Tcl_SetVar(interp, "_stnm1", nick, 0);
-  Tcl_SetVar(interp, "_stnm2", uhost, 0);
-  Tcl_SetVar(interp, "_stnm3", u ? u->handle : "*", 0);
-  Tcl_SetVar(interp, "_stnm4", chname, 0);
-  Tcl_SetVar(interp, "_stnm5", reason, 0);
-  check_tcl_bind(table, args, &fr, " $_stnm1 $_stnm2 $_stnm3 $_stnm4 $_stnm5",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  check_bind(table, args, &fr, nick, uhost, u, chname, reason);
 }
 
 static void check_tcl_kickmode(char *nick, char *uhost, struct userrec *u,
 			       char *chname, char *dest, char *reason,
-			       p_tcl_bind_list table)
+			       bind_table_t *table)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  char args[512];
+  char args[1024];
 
   get_user_flagrec(u, &fr, chname);
-  if (table == H_mode)
+  if (table == BT_mode) {
     simple_sprintf(args, "%s %s", chname, dest);
-  else
+  }
+  else {
     simple_sprintf(args, "%s %s %s", chname, dest, reason);
-  Tcl_SetVar(interp, "_kick1", nick, 0);
-  Tcl_SetVar(interp, "_kick2", uhost, 0);
-  Tcl_SetVar(interp, "_kick3", u ? u->handle : "*", 0);
-  Tcl_SetVar(interp, "_kick4", chname, 0);
-  Tcl_SetVar(interp, "_kick5", dest, 0);
-  Tcl_SetVar(interp, "_kick6", reason, 0);
-  check_tcl_bind(table, args, &fr, " $_kick1 $_kick2 $_kick3 $_kick4 $_kick5 $_kick6",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  }
+  check_bind(table, args, &fr, nick, uhost, u, chname, dest, reason);
 }
 
 static int check_tcl_pub(char *nick, char *from, char *chname, char *msg)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   int x;
-  char buf[512], *args = buf, *cmd, host[161], *hand;
+  char *cmd, *text, host[161];
   struct userrec *u;
 
-  strcpy(args, msg);
-  cmd = newsplit(&args);
+  text = msg;
+  cmd = newsplit(&text);
   simple_sprintf(host, "%s!%s", nick, from);
   u = get_user_by_host(host);
-  hand = u ? u->handle : "*";
   get_user_flagrec(u, &fr, chname);
 
-  check_bind(BT_pub, cmd, &fr, nick, from, hand, chname, args);
+  x = check_bind(BT_pub, cmd, &fr, nick, from, u, chname, text);
 
-  Tcl_SetVar(interp, "_pub1", nick, 0);
-  Tcl_SetVar(interp, "_pub2", from, 0);
-  Tcl_SetVar(interp, "_pub3", hand, 0);
-  Tcl_SetVar(interp, "_pub4", chname, 0);
-  Tcl_SetVar(interp, "_pub5", args, 0);
-  x = check_tcl_bind(H_pub, cmd, &fr, " $_pub1 $_pub2 $_pub3 $_pub4 $_pub5",
-		     MATCH_EXACT | BIND_USE_ATTR | BIND_HAS_BUILTINS);
-  if (x == BIND_NOMATCH)
-    return 0;
-  if (x == BIND_EXEC_LOG)
-    putlog(LOG_CMDS, chname, "<<%s>> !%s! %s %s", nick, hand, cmd, args);
-  return 1;
+  if (x & BIND_RET_LOG) {
+    putlog(LOG_CMDS, chname, "<<%s>> !%s! %s %s", nick, u ? u->handle : "*", cmd, text);
+  }
+  /* This should work.. undoes the "newsplit" */
+  if (text > cmd) *(text-1) = ' ';
+  if (x & BIND_RET_BREAK) return(1);
+  return(0);
 }
 
 static void check_tcl_pubm(char *nick, char *from, char *chname, char *msg)
@@ -804,24 +735,13 @@
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   char buf[1024], host[161];
   struct userrec *u;
-  char *hand;
 
   simple_sprintf(buf, "%s %s", chname, msg);
   simple_sprintf(host, "%s!%s", nick, from);
   u = get_user_by_host(host);
   get_user_flagrec(u, &fr, chname);
-  if (u) hand = u->handle;
-  else hand = "*";
 
-  check_bind(BT_pubm, buf, &fr, nick, from, hand, chname, msg);
-
-  Tcl_SetVar(interp, "_pubm1", nick, 0);
-  Tcl_SetVar(interp, "_pubm2", from, 0);
-  Tcl_SetVar(interp, "_pubm3", hand, 0);
-  Tcl_SetVar(interp, "_pubm4", chname, 0);
-  Tcl_SetVar(interp, "_pubm5", msg, 0);
-  check_tcl_bind(H_pubm, buf, &fr, " $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  check_bind(BT_pubm, buf, &fr, nick, from, u, chname, msg);
 }
 
 static void check_tcl_need(char *chname, char *type)
@@ -829,9 +749,7 @@
   char buf[1024];
 
   simple_sprintf(buf, "%s %s", chname, type);
-  Tcl_SetVar(interp, "_need1", chname, 0);
-  Tcl_SetVar(interp, "_need2", type, 0);
-  check_tcl_bind(H_need, buf, 0, " $_need1 $_need2", MATCH_MASK | BIND_STACKABLE);
+  check_bind(BT_need, buf, NULL, chname, type);
 }
 
 static tcl_ints myints[] =
@@ -1018,23 +936,21 @@
   dprintf(DP_MODE, "JOIN 0\n");
   for (chan = chanset; chan; chan = chan->next)
     clear_channel(chan, 1);
-  del_bind_table(H_topc);
-  del_bind_table(H_splt);
-  del_bind_table(H_sign);
-  del_bind_table(H_rejn);
-  del_bind_table(H_part);
-  del_bind_table(H_nick);
-  del_bind_table(H_mode);
-  del_bind_table(H_kick);
-  del_bind_table(H_join);
-  del_bind_table(H_pubm);
-  del_bind_table(H_pub);
-  del_bind_table(H_need);
+  del_bind_table2(BT_topic);
+  del_bind_table2(BT_split);
+  del_bind_table2(BT_quit);
+  del_bind_table2(BT_rejoin);
+  del_bind_table2(BT_part);
+  del_bind_table2(BT_nick);
+  del_bind_table2(BT_mode);
+  del_bind_table2(BT_kick);
+  del_bind_table2(BT_join);
+  del_bind_table2(BT_pubm);
+  del_bind_table2(BT_pub);
+  del_bind_table2(BT_need);
   rem_tcl_ints(myints);
-  rem_builtins(H_dcc, irc_dcc);
-  rem_builtins(H_msg, C_msg);
 
-  /* rem_builtins(H_raw, irc_raw); */
+  if (BT_dcc) rem_builtins2(BT_dcc, irc_dcc);
   if (BT_raw) rem_builtins2(BT_raw, irc_raw);
   if (BT_msg) rem_builtins2(BT_msg, C_msg);
 
@@ -1064,27 +980,12 @@
   (Function) irc_expmem,
   (Function) irc_report,
   /* 4 - 7 */
-  (Function) & H_splt,		/* p_tcl_bind_list		*/
-  (Function) & H_rejn,		/* p_tcl_bind_list		*/
-  (Function) & H_nick,		/* p_tcl_bind_list		*/
-  (Function) & H_sign,		/* p_tcl_bind_list		*/
-  /* 8 - 11 */
-  (Function) & H_join,		/* p_tcl_bind_list		*/
-  (Function) & H_part,		/* p_tcl_bind_list		*/
-  (Function) & H_mode,		/* p_tcl_bind_list		*/
-  (Function) & H_kick,		/* p_tcl_bind_list		*/
-  /* 12 - 15 */
-  (Function) & H_pubm,		/* p_tcl_bind_list		*/
-  (Function) & H_pub,		/* p_tcl_bind_list		*/
-  (Function) & H_topc,		/* p_tcl_bind_list		*/
   (Function) recheck_channel,
-  /* 16 - 19 */
   (Function) me_op,
   (Function) recheck_channel_modes,
-  (Function) & H_need,		/* p_tcl_bind_list		*/
   (Function) do_channel_part,
-  /* 20 - 23 */
-  (Function) check_this_ban,
+  /* 8 - 11 */
+  (Function) check_this_ban
 };
 
 char *irc_start(Function * global_funcs)
@@ -1124,37 +1025,37 @@
 	       TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
 	       traced_rfccompliant, NULL);
   add_tcl_ints(myints);
-  add_builtins(H_dcc, irc_dcc);
-
-/*
-  add_builtins(H_msg, C_msg);
-  add_builtins(H_raw, irc_raw);
-*/
 
   /* Import bind tables from other places. */
+  BT_dcc = find_bind_table2("dcc");
   BT_raw = find_bind_table2("raw");
   BT_msg = find_bind_table2("msg");
+  BT_ctcp = find_bind_table2("ctcp");
+  BT_ctcr = find_bind_table2("ctcr");
+
+  /* Add our commands to the imported tables. */
+  if (BT_dcc) add_builtins2(BT_dcc, irc_dcc);
+  else putlog(LOG_MISC, "*", "Couldn't load dcc bind table!");
   if (BT_raw) add_builtins2(BT_raw, irc_raw);
+  else putlog(LOG_MISC, "*", "Couldn't load raw bind table!");
   if (BT_msg) add_builtins2(BT_msg, C_msg);
+  else putlog(LOG_MISC, "*", "Couldn't load msg bind table!");
 
   /* Create our own bind tables. */
-  BT_pub = add_bind_table2("pub", 5, "sssss", MATCH_MASK, BIND_USE_ATTR);
-  BT_pubm = add_bind_table2("pubm", 5, "sssss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_topic = add_bind_table2("topic", 5, "ssUss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_split = add_bind_table2("split", 4, "ssUs", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_rejoin = add_bind_table2("rejoin", 4, "ssUs", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_quit = add_bind_table2("sign", 5, "ssUss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_join = add_bind_table2("join", 4, "ssUs", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_part = add_bind_table2("part", 5, "ssUss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_nick = add_bind_table2("nick", 5, "ssUss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_mode = add_bind_table2("mode", 6, "ssUsss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_need = add_bind_table2("need", 2, "ss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
+  BT_pub = add_bind_table2("pub", 5, "ssUss", 0, BIND_USE_ATTR);
+  BT_pubm = add_bind_table2("pubm", 5, "ssUss", MATCH_MASK, BIND_STACKABLE | BIND_USE_ATTR);
 
   add_tcl_commands(tclchan_cmds);
   add_help_reference("irc.help");
-  H_topc = add_bind_table("topc", HT_STACKABLE, channels_5char);
-  H_splt = add_bind_table("splt", HT_STACKABLE, channels_4char);
-  H_sign = add_bind_table("sign", HT_STACKABLE, channels_5char);
-  H_rejn = add_bind_table("rejn", HT_STACKABLE, channels_4char);
-  H_part = add_bind_table("part", HT_STACKABLE, channels_5char);
-  H_nick = add_bind_table("nick", HT_STACKABLE, channels_5char);
-  H_mode = add_bind_table("mode", HT_STACKABLE, channels_6char);
-  H_kick = add_bind_table("kick", HT_STACKABLE, channels_6char);
-  H_join = add_bind_table("join", HT_STACKABLE, channels_4char);
-  H_pubm = add_bind_table("pubm", HT_STACKABLE, channels_5char);
-  H_pub = add_bind_table("pub", 0, channels_5char);
-  H_need = add_bind_table("need", HT_STACKABLE, channels_2char);
   do_nettype();
   return NULL;
 }
Index: eggdrop1.7/src/mod/irc.mod/irc.h
diff -u eggdrop1.7/src/mod/irc.mod/irc.h:1.15 eggdrop1.7/src/mod/irc.mod/irc.h:1.16
--- eggdrop1.7/src/mod/irc.mod/irc.h:1.15	Wed Apr 25 22:38:51 2001
+++ eggdrop1.7/src/mod/irc.mod/irc.h	Sat Oct  6 23:02:55 2001
@@ -1,7 +1,7 @@
 /*
  * irc.h -- part of irc.mod
  *
- * $Id: irc.h,v 1.15 2001/04/26 03:38:51 guppy Exp $
+ * $Id: irc.h,v 1.16 2001/10/07 04:02:55 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -25,14 +25,14 @@
 #ifndef _EGG_MOD_IRC_IRC_H
 #define _EGG_MOD_IRC_IRC_H
 
-#define check_tcl_join(a,b,c,d) check_tcl_joinspltrejn(a,b,c,d,H_join)
-#define check_tcl_splt(a,b,c,d) check_tcl_joinspltrejn(a,b,c,d,H_splt)
-#define check_tcl_rejn(a,b,c,d) check_tcl_joinspltrejn(a,b,c,d,H_rejn)
-#define check_tcl_sign(a,b,c,d,e) check_tcl_signtopcnick(a,b,c,d,e,H_sign)
-#define check_tcl_topc(a,b,c,d,e) check_tcl_signtopcnick(a,b,c,d,e,H_topc)
-#define check_tcl_nick(a,b,c,d,e) check_tcl_signtopcnick(a,b,c,d,e,H_nick)
-#define check_tcl_mode(a,b,c,d,e,f) check_tcl_kickmode(a,b,c,d,e,f,H_mode)
-#define check_tcl_kick(a,b,c,d,e,f) check_tcl_kickmode(a,b,c,d,e,f,H_kick)
+#define check_tcl_join(a,b,c,d) check_tcl_joinspltrejn(a,b,c,d,BT_join)
+#define check_tcl_splt(a,b,c,d) check_tcl_joinspltrejn(a,b,c,d,BT_split)
+#define check_tcl_rejn(a,b,c,d) check_tcl_joinspltrejn(a,b,c,d,BT_rejoin)
+#define check_tcl_sign(a,b,c,d,e) check_tcl_signtopcnick(a,b,c,d,e,BT_quit)
+#define check_tcl_topc(a,b,c,d,e) check_tcl_signtopcnick(a,b,c,d,e,BT_topic)
+#define check_tcl_nick(a,b,c,d,e) check_tcl_signtopcnick(a,b,c,d,e,BT_nick)
+#define check_tcl_mode(a,b,c,d,e,f) check_tcl_kickmode(a,b,c,d,e,f,BT_mode)
+#define check_tcl_kick(a,b,c,d,e,f) check_tcl_kickmode(a,b,c,d,e,f,BT_kick)
 
 #define REVENGE_KICK 1		/* Kicked victim	*/
 #define REVENGE_DEOP 2		/* Took op		*/
@@ -40,12 +40,12 @@
 #ifdef MAKING_IRC
 static void check_tcl_need(char *, char *);
 static void check_tcl_kickmode(char *, char *, struct userrec *, char *,
-			       char *, char *, p_tcl_bind_list);
+			       char *, char *, bind_table_t *);
 static void check_tcl_joinspltrejn(char *, char *, struct userrec *, char *,
-			       p_tcl_bind_list);
+			       bind_table_t *);
 static void check_tcl_part(char *, char *, struct userrec *, char *, char *);
 static void check_tcl_signtopcnick(char *, char *, struct userrec *u, char *,
-				   char *, p_tcl_bind_list);
+				   char *, bind_table_t *);
 static void check_tcl_pubm(char *, char *, char *, char *);
 static int check_tcl_pub(char *, char *, char *, char *);
 static int me_op(struct chanset_t *);
@@ -85,28 +85,15 @@
 						who)
 
 #else
-/* 4 - 7 */
-#define H_splt (*(p_tcl_bind_list*)(irc_funcs[4]))
-#define H_rejn (*(p_tcl_bind_list*)(irc_funcs[5]))
-#define H_nick (*(p_tcl_bind_list*)(irc_funcs[6]))
-#define H_sign (*(p_tcl_bind_list*)(irc_funcs[7]))
-/* 8 - 11 */
-#define H_join (*(p_tcl_bind_list*)(irc_funcs[8]))
-#define H_part (*(p_tcl_bind_list*)(irc_funcs[9]))
-#define H_mode (*(p_tcl_bind_list*)(irc_funcs[10]))
-#define H_kick (*(p_tcl_bind_list*)(irc_funcs[11]))
-/* 12 - 15 */
-#define H_pubm (*(p_tcl_bind_list*)(irc_funcs[12]))
-#define H_pub (*(p_tcl_bind_list*)(irc_funcs[13]))
-#define H_topc (*(p_tcl_bind_list*)(irc_funcs[14]))
-/* recheck_channel is here */
-/* 16 - 19 */
-#define me_op ((int(*)(struct chanset_t *))irc_funcs[16])
-/* recheck_channel_modes is here */
-#define H_need (*(p_tcl_bind_list*)(irc_funcs[18]))
-/* do_channel_part is here. */
-/* 20 - 23 */
-/* check_this_ban is here. */
+
+/* 4-7 */
+#define recheck_channel ((void(*)(struct chanset_t *,int))irc_funcs[4])
+#define me_op ((int(*)(struct chanset_t *))irc_funcs[5])
+#define recheck_channel_modes ((void(*)(struct chanset_t *))irc_funcs[6])
+#define do_channel_part ((void(*)(struct chanset_t *))irc_funcs[7])
+
+/* 8-11 */
+#define check_this_ban ((void(*)(struct chanset_t *,char *,int))irc_funcs[8])
 
 #endif				/* MAKING_IRC */
 
Index: eggdrop1.7/src/mod/modvals.h
diff -u eggdrop1.7/src/mod/modvals.h:1.20 eggdrop1.7/src/mod/modvals.h:1.21
--- eggdrop1.7/src/mod/modvals.h:1.20	Tue Jul 31 11:40:41 2001
+++ eggdrop1.7/src/mod/modvals.h	Sat Oct  6 23:02:54 2001
@@ -1,7 +1,7 @@
 /*
  * modvals.h
  *
- * $Id: modvals.h,v 1.20 2001/07/31 16:40:41 guppy Exp $
+ * $Id: modvals.h,v 1.21 2001/10/07 04:02:54 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -75,10 +75,10 @@
 #define SERVER_BOTUSERHOST	  5
 #define SERVER_NICKLEN		 38
 /* IRC */
-#define IRC_RECHECK_CHANNEL	  15
-#define IRC_RECHECK_CHANNEL_MODES 17
-#define IRC_DO_CHANNEL_PART	  19
-#define IRC_CHECK_THIS_BAN	  20
+#define IRC_RECHECK_CHANNEL	  4
+#define IRC_RECHECK_CHANNEL_MODES 6
+#define IRC_DO_CHANNEL_PART	  7
+#define IRC_CHECK_THIS_BAN	  8
 /* Notes */
 #define NOTES_CMD_NOTE		  4
 /* Console */
Index: eggdrop1.7/src/mod/server.mod/server.c
diff -u eggdrop1.7/src/mod/server.mod/server.c:1.80 eggdrop1.7/src/mod/server.mod/server.c:1.81
--- eggdrop1.7/src/mod/server.mod/server.c:1.80	Sat Sep 29 23:27:38 2001
+++ eggdrop1.7/src/mod/server.mod/server.c	Sat Oct  6 23:02:55 2001
@@ -2,7 +2,7 @@
  * server.c -- part of server.mod
  *   basic irc server support
  *
- * $Id: server.c,v 1.80 2001/09/30 04:27:38 stdarg Exp $
+ * $Id: server.c,v 1.81 2001/10/07 04:02:55 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -92,11 +92,6 @@
 static int optimize_kicks;
 
 
-static p_tcl_bind_list H_wall, H_raw, H_notc, H_msgm, H_msg, H_flud,
-		       H_ctcr, H_ctcp;
-
-static p_tcl_bind_list my_H_dcc; /* Imported from core */
-
 static void empty_msgq(void);
 static void next_server(int *, char *, unsigned int *, char *);
 static void disconnect_server(int);
@@ -1410,12 +1405,11 @@
 
 /* This only handles CHAT requests, otherwise it's handled in filesys.
  */
-static int ctcp_DCC_CHAT(char *nick, char *from, char *handle,
+static int ctcp_DCC_CHAT(char *nick, char *from, struct userrec *u,
 			 char *object, char *keyword, char *text)
 {
   char *action, *param, *ip, *prt, buf[512], *msg = buf;
   int i;
-  struct userrec *u = get_user_by_handle(userlist, handle);
   struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
   struct in_addr ip4;
 
@@ -1684,23 +1678,18 @@
   nuke_server("Connection reset by peer");
   clearq(serverlist);
 
-  /* rem_builtins(my_H_dcc, C_dcc_serv); */
-  /* rem_builtins(H_raw, my_raw_binds); */
-  /* rem_builtins(H_ctcp, my_ctcps); */
-
   rem_builtins2(BT_dcc, C_dcc_serv);
   rem_builtins2(BT_raw, my_raw_binds);
   rem_builtins2(BT_ctcp, my_ctcps);
 
-  /* Restore original commands. */
-  del_bind_table(H_wall);
-  del_bind_table(H_raw);
-  del_bind_table(H_notc);
-  del_bind_table(H_msgm);
-  del_bind_table(H_msg);
-  del_bind_table(H_flud);
-  del_bind_table(H_ctcr);
-  del_bind_table(H_ctcp);
+  del_bind_table2(BT_wall);
+  del_bind_table2(BT_raw);
+  del_bind_table2(BT_notice);
+  del_bind_table2(BT_msgm);
+  del_bind_table2(BT_msg);
+  del_bind_table2(BT_flood);
+  del_bind_table2(BT_ctcr);
+  del_bind_table2(BT_ctcp);
   rem_tcl_coups(my_tcl_coups);
   rem_tcl_strings(my_tcl_strings);
   rem_tcl_ints(my_tcl_ints);
@@ -1774,15 +1763,15 @@
   (Function) & server_online,	/* int					*/
   (Function) NULL,		/* min_servs - removed useless feature	*/
   /* 28 - 31 */
-  (Function) & H_raw,		/* p_tcl_bind_list			*/
-  (Function) & H_wall,		/* p_tcl_bind_list			*/
-  (Function) & H_msg,		/* p_tcl_bind_list			*/
-  (Function) & H_msgm,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
   /* 32 - 35 */
-  (Function) & H_notc,		/* p_tcl_bind_list			*/
-  (Function) & H_flud,		/* p_tcl_bind_list			*/
-  (Function) & H_ctcp,		/* p_tcl_bind_list			*/
-  (Function) & H_ctcr,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
+  (Function) 0,		/* p_tcl_bind_list			*/
   /* 36 - 39 */
   (Function) ctcp_reply,
   (Function) get_altbotnick,	/* char *				*/
@@ -1882,29 +1871,16 @@
 	/* Create our own bind tables. */
 	BT_wall = add_bind_table2("wall", 2, "ss", MATCH_MASK, BIND_STACKABLE);
 	BT_raw = add_bind_table2("raw", 3, "sss", MATCH_MASK, BIND_STACKABLE);
-	BT_notice = add_bind_table2("notice", 5, "sssss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
-	BT_msg = add_bind_table2("msg", 4, "ssss", 0, BIND_USE_ATTR);
-	BT_msgm = add_bind_table2("msgm", 4, "ssss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
-	BT_flood = add_bind_table2("flood", 5, "sssss", MATCH_MASK, BIND_STACKABLE);
-	BT_ctcr = add_bind_table2("ctcr", 6, "ssssss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
-	BT_ctcp = add_bind_table2("ctcp", 6, "ssssss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
+	BT_notice = add_bind_table2("notice", 5, "ssUss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
+	BT_msg = add_bind_table2("msg", 4, "ssUs", 0, BIND_USE_ATTR);
+	BT_msgm = add_bind_table2("msgm", 4, "ssUs", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
+	BT_flood = add_bind_table2("flood", 5, "ssUss", MATCH_MASK, BIND_STACKABLE);
+	BT_ctcr = add_bind_table2("ctcr", 6, "ssUsss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
+	BT_ctcp = add_bind_table2("ctcp", 6, "ssUsss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
 
 	/* Import bind tables. */
 	BT_dcc = find_bind_table2("dcc");
 
-  /* Create the old tables for compatibility (temporary). */
-  H_wall = add_bind_table("wall", HT_STACKABLE, server_2char);
-  H_raw = add_bind_table("raw", HT_STACKABLE, server_raw);
-  H_notc = add_bind_table("notc", HT_STACKABLE, server_6char);
-  H_msgm = add_bind_table("msgm", HT_STACKABLE, server_msg);
-  H_msg = add_bind_table("msg", 0, server_msg);
-  H_flud = add_bind_table("flud", HT_STACKABLE, server_5char);
-  H_ctcr = add_bind_table("ctcr", HT_STACKABLE, server_6char);
-  H_ctcp = add_bind_table("ctcp", HT_STACKABLE, server_6char);
-
-  /* add_builtins(H_raw, my_raw_binds); */
-  /* add_builtins(H_ctcp, my_ctcps); */
-  /* add_builtins(H_dcc, C_dcc_serv); */
   add_builtins2(BT_raw, my_raw_binds);
   add_builtins2(BT_ctcp, my_ctcps);
   add_builtins2(BT_dcc, C_dcc_serv);
Index: eggdrop1.7/src/mod/server.mod/server.h
diff -u eggdrop1.7/src/mod/server.mod/server.h:1.13 eggdrop1.7/src/mod/server.mod/server.h:1.14
--- eggdrop1.7/src/mod/server.mod/server.h:1.13	Sun Aug 12 22:58:30 2001
+++ eggdrop1.7/src/mod/server.mod/server.h	Sat Oct  6 23:02:55 2001
@@ -1,7 +1,7 @@
 /*
  * server.h -- part of server.mod
  *
- * $Id: server.h,v 1.13 2001/08/13 03:58:30 guppy Exp $
+ * $Id: server.h,v 1.14 2001/10/07 04:02:55 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -25,8 +25,8 @@
 #ifndef _EGG_MOD_SERVER_SERVER_H
 #define _EGG_MOD_SERVER_SERVER_H
 
-#define check_tcl_ctcp(a,b,c,d,e,f) check_tcl_ctcpr(a,b,c,d,e,f,H_ctcp)
-#define check_tcl_ctcr(a,b,c,d,e,f) check_tcl_ctcpr(a,b,c,d,e,f,H_ctcr)
+#define check_tcl_ctcp(a,b,c,d,e,f) check_tcl_ctcpr(a,b,c,d,e,f,BT_ctcp)
+#define check_tcl_ctcr(a,b,c,d,e,f) check_tcl_ctcpr(a,b,c,d,e,f,BT_ctcr)
 
 #ifndef MAKING_SERVER
 /* 4 - 7 */
@@ -45,7 +45,7 @@
 #define answer_ctcp (*(int *)(server_funcs[15]))
 /* 16 - 19 */
 #define trigger_on_ignore (*(int *)(server_funcs[16]))
-#define check_tcl_ctcpr ((int(*)(char*,char*,struct userrec*,char*,char*,char*,p_tcl_bind_list))server_funcs[17])
+#define check_tcl_ctcpr ((int(*)(char*,char*,struct userrec*,char*,char*,char*,bind_table_t *))server_funcs[17])
 #define detect_avalanche ((int(*)(char *))server_funcs[18])
 #define nuke_server ((void(*)(char *))server_funcs[19])
 /* 20 - 22 */
Index: eggdrop1.7/src/mod/server.mod/servmsg.c
diff -u eggdrop1.7/src/mod/server.mod/servmsg.c:1.66 eggdrop1.7/src/mod/server.mod/servmsg.c:1.67
--- eggdrop1.7/src/mod/server.mod/servmsg.c:1.66	Sat Sep 29 23:27:38 2001
+++ eggdrop1.7/src/mod/server.mod/servmsg.c	Sat Oct  6 23:02:55 2001
@@ -1,7 +1,7 @@
 /*
  * servmsg.c -- part of server.mod
  *
- * $Id: servmsg.c,v 1.66 2001/09/30 04:27:38 stdarg Exp $
+ * $Id: servmsg.c,v 1.67 2001/10/07 04:02:55 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -102,45 +102,24 @@
 
   get_user_flagrec(u, &fr, NULL);
 
-  check_bind(BT_msg, cmd, &fr, cmd, nick, uhost, hand, args);
-
-  Tcl_SetVar(interp, "_msg1", nick, 0);
-  Tcl_SetVar(interp, "_msg2", uhost, 0);
-  Tcl_SetVar(interp, "_msg3", hand, 0);
-  Tcl_SetVar(interp, "_msg4", args, 0);
-  x = check_tcl_bind(H_msg, cmd, &fr, " $_msg1 $_msg2 $_msg3 $_msg4",
-		     MATCH_EXACT | BIND_HAS_BUILTINS | BIND_USE_ATTR);
-  if (x == BIND_EXEC_LOG)
-    putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %s", nick, uhost, hand,
-	   cmd, args);
-  return ((x == BIND_MATCHED) || (x == BIND_EXECUTED) || (x == BIND_EXEC_LOG));
+  x = check_bind(BT_msg, cmd, &fr, nick, uhost, u, args);
+  if (x & BIND_RET_LOG) putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %s", nick, uhost, hand, args);
+  if (x) return(1);
+  else return(0);
 }
 
 static 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};
-  char *hand;
 
   get_user_flagrec(u, &fr, NULL);
-  if (u) hand = u->handle;
-  else hand = "*";
-
-  check_bind(BT_notice, arg, &fr, nick, uhost, hand, arg, dest);
-
-  Tcl_SetVar(interp, "_notc1", nick, 0);
-  Tcl_SetVar(interp, "_notc2", uhost, 0);
-  Tcl_SetVar(interp, "_notc3", hand, 0);
-  Tcl_SetVar(interp, "_notc4", arg, 0);
-  Tcl_SetVar(interp, "_notc5", dest, 0);
-  check_tcl_bind(H_notc, arg, &fr, " $_notc1 $_notc2 $_notc3 $_notc4 $_notc5",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  check_bind(BT_notice, arg, &fr, nick, uhost, u, arg, dest);
 }
 
 static void check_tcl_msgm(char *nick, char *uhost, struct userrec *u, char *arg)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
-  char *hand;
 
 /*
   if (arg[0])
@@ -150,103 +129,42 @@
 */
 
   get_user_flagrec(u, &fr, NULL);
-  if (u) hand = u->handle;
-  else hand = "*";
-
-  check_bind(BT_msgm, arg, &fr, nick, uhost, hand, arg);
-
-  Tcl_SetVar(interp, "_msgm1", nick, 0);
-  Tcl_SetVar(interp, "_msgm2", uhost, 0);
-  Tcl_SetVar(interp, "_msgm3", hand, 0);
-  Tcl_SetVar(interp, "_msgm4", arg, 0);
-  check_tcl_bind(H_msgm, arg, &fr, " $_msgm1 $_msgm2 $_msgm3 $_msgm4",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  check_bind(BT_msgm, arg, &fr, nick, uhost, u, arg);
 }
 
 /* Return 1 if processed.
  */
 static int check_tcl_raw(char *from, char *code, char *msg)
 {
-  int x;
-
-  check_bind(BT_raw, code, NULL, from, code, msg);
-
-  Tcl_SetVar(interp, "_raw1", from, 0);
-  Tcl_SetVar(interp, "_raw2", code, 0);
-  Tcl_SetVar(interp, "_raw3", msg, 0);
-  x = check_tcl_bind(H_raw, code, 0, " $_raw1 $_raw2 $_raw3",
-		     MATCH_EXACT | BIND_STACKABLE | BIND_WANTRET);
-  return (x == BIND_EXEC_LOG);
+  return check_bind(BT_raw, code, NULL, from, code, msg);
 }
 
 static int check_tcl_ctcpr(char *nick, char *uhost, struct userrec *u,
 			   char *dest, char *keyword, char *args,
-			   p_tcl_bind_list table)
+			   bind_table_t *table)
 {
-  bind_table_t *bt_table;
   struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
-  int x;
-  char *hand;
-
   get_user_flagrec(u, &fr, NULL);
-  if (u) hand = u->handle;
-  else hand = "*";
-
-  if (table == H_ctcp) bt_table = BT_ctcp;
-  else bt_table = BT_ctcr;
-
-  check_bind(bt_table, keyword, &fr, nick, uhost, hand, dest, keyword, args);
 
-  Tcl_SetVar(interp, "_ctcpr1", nick, 0);
-  Tcl_SetVar(interp, "_ctcpr2", uhost, 0);
-  Tcl_SetVar(interp, "_ctcpr3", hand, 0);
-  Tcl_SetVar(interp, "_ctcpr4", dest, 0);
-  Tcl_SetVar(interp, "_ctcpr5", keyword, 0);
-  Tcl_SetVar(interp, "_ctcpr6", args, 0);
-  x = check_tcl_bind(table, keyword, &fr,
-		     " $_ctcpr1 $_ctcpr2 $_ctcpr3 $_ctcpr4 $_ctcpr5 $_ctcpr6",
-		      MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE |
-		     ((table == H_ctcp) ? BIND_WANTRET : 0));
-  return (x == BIND_EXEC_LOG) || (table == H_ctcr);
+  return check_bind(table, keyword, &fr, nick, uhost, u, dest, keyword, args);
 }
 
 static int check_tcl_wall(char *from, char *msg)
 {
   int x;
 
-  check_bind(BT_wall, msg, NULL, from, msg);
-
-  Tcl_SetVar(interp, "_wall1", from, 0);
-  Tcl_SetVar(interp, "_wall2", msg, 0);
-  x = check_tcl_bind(H_wall, msg, 0, " $_wall1 $_wall2",
-		     MATCH_MASK | BIND_STACKABLE);
-  if (x == BIND_EXEC_LOG) {
+  x = check_bind(BT_wall, msg, NULL, from, msg);
+  if (x & BIND_RET_LOG) {
     putlog(LOG_WALL, "*", "!%s! %s", from, msg);
     return 1;
-  } else
-    return 0;
+  }
+  else return 0;
 }
 
 static int check_tcl_flud(char *nick, char *uhost, struct userrec *u,
 			  char *ftype, char *chname)
 {
-  int x;
-  char *hand;
-
-  if (u) hand = u->handle;
-  else hand = "*";
-
-  check_bind(BT_flood, ftype, NULL, nick, uhost, hand, ftype, chname);
-
-  Tcl_SetVar(interp, "_flud1", nick, 0);
-  Tcl_SetVar(interp, "_flud2", uhost, 0);
-  Tcl_SetVar(interp, "_flud3", hand, 0);
-  Tcl_SetVar(interp, "_flud4", ftype, 0);
-  Tcl_SetVar(interp, "_flud5", chname, 0);
-  x = check_tcl_bind(H_flud, ftype, 0,
-		     " $_flud1 $_flud2 $_flud3 $_flud4 $_flud5",
-		     MATCH_MASK | BIND_STACKABLE | BIND_WANTRET);
-  return (x == BIND_EXEC_LOG);
+  return check_bind(BT_flood, ftype, NULL, nick, uhost, u, ftype, chname);
 }
 
 static int match_my_nick(char *nick)
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.38 eggdrop1.7/src/tclhash.c:1.39
--- eggdrop1.7/src/tclhash.c:1.38	Thu Oct  4 16:37:45 2001
+++ eggdrop1.7/src/tclhash.c	Sat Oct  6 23:02:54 2001
@@ -7,7 +7,7 @@
  *   (non-Tcl) procedure lookups for msg/dcc/file commands
  *   (Tcl) binding internal procedures to msg/dcc/file commands
  *
- * $Id: tclhash.c,v 1.38 2001/10/04 21:37:45 stdarg Exp $
+ * $Id: tclhash.c,v 1.39 2001/10/07 04:02:54 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -235,7 +235,7 @@
 	BT_disc = add_bind_table2("disc", 1, "s", MATCH_MASK, BIND_STACKABLE);
 	BT_away = add_bind_table2("away", 3, "sis", MATCH_MASK, BIND_STACKABLE);
 	BT_time = add_bind_table2("time", 5, "iiiii", MATCH_MASK, BIND_STACKABLE);
-	BT_dcc = add_bind_table2("dcc", 3, "sis", MATCH_MASK, BIND_USE_ATTR);
+	BT_dcc = add_bind_table2("dcc", 3, "Uis", MATCH_MASK, BIND_USE_ATTR);
 	add_builtins2(BT_dcc, C_dcc);
 }
 
@@ -418,22 +418,6 @@
   return NULL;
 }
 
-static void dump_bind_tables(Tcl_Interp *irp)
-{
-  tcl_bind_list_t	*tl;
-  u_8bit_t		 i;
-
-  for (tl = bind_table_list, i = 0; tl; tl = tl->next) {
-    if (tl->flags & HT_DELETED)
-      continue;
-    if (i)
-      Tcl_AppendResult(irp, ", ", NULL);
-    else
-      i = 1;
-    Tcl_AppendResult(irp, tl->name, NULL);
-  }
-}
-
 int del_bind_entry(bind_table_t *table, const char *flags, const char *mask, const char *function_name)
 {
 	bind_chain_t *chain;
@@ -460,6 +444,25 @@
 	return(0);
 }
 
+static void *get_bind_cdata(bind_table_t *table , const char *flags, const char *mask, const char *function_name)
+{
+	bind_chain_t *chain;
+	bind_entry_t *entry;
+
+	/* Find the correct mask entry. */
+	for (chain = table->chains; chain; chain = chain->next) {
+		if (!strcmp(chain->mask, mask)) break;
+	}
+	if (!chain) return(NULL);
+
+	/* Now find the function name in this mask entry. */
+	for (entry = chain->entries; entry; entry = entry->next) {
+		if (!strcmp(entry->function_name, function_name)) break;
+	}
+	if (!entry) return(NULL);
+	else return(entry->client_data);
+}
+
 static int unbind_bind_entry(tcl_bind_list_t *tl, const char *flags,
 			     const char *cmd, const char *proc)
 {
@@ -631,17 +634,53 @@
   return TCL_OK;
 }
 
-/* Only needs to work for "event" right now */
-static int my_tcl_bind_callback(char *cmd, char *event)
+/* Works with string, int, and user type. */
+static int my_tcl_bind_callback(tcl_cmd_cdata *cdata, ...)
 {
-	Tcl_VarEval(interp, cmd, " ", event, NULL);
-	return(0);
+	Tcl_DString final;
+	int *arg;
+	char *syntax, *str, buf[32];
+	int retval;
+
+	arg = (int *)&cdata;
+	arg++;
+	Tcl_DStringInit(&final);
+	Tcl_DStringAppend(&final, cdata->cmd, -1);
+	for (syntax = cdata->syntax; *syntax; syntax++) {
+		switch (*syntax) {
+			case 's':
+				str = (char *)(*arg);
+				break;
+			case 'i': {
+				sprintf(buf, "%d", *arg);
+				str = buf;
+				break;
+			}
+			case 'U': {
+				struct userrec *u;
+				u = (struct userrec *)(*arg);
+				if (u) str = u->handle;
+				else str = "*";
+				break;
+			}
+			default:
+				str = "(unsupported argument type)";
+		}
+		if (!str) str = "(null)";
+		Tcl_DStringAppendElement(&final, str);
+		arg++;
+	}
+	Tcl_Eval(cdata->irp, Tcl_DStringValue(&final));
+	Tcl_DStringGetResult(cdata->irp, &final);
+	retval = atoi(Tcl_DStringValue(&final));
+	Tcl_DStringFree(&final);
+	return(retval);
 }
 
 static int tcl_bind2 STDVAR
 {
+	tcl_cmd_cdata *cdata;
 	bind_table_t *table;
-	char *cmd;
 
 	BADARGS(5, 5, " type flags cmd/mask procname");
 
@@ -651,9 +690,11 @@
 		return(TCL_ERROR);
 	}
 
-	/* We pass the callback cmd as our client data */
-	cmd = my_strdup(argv[4]);
-	add_bind_entry(table, argv[2], argv[3], argv[4], BIND_WANTS_CD, my_tcl_bind_callback, cmd);
+	cdata = (tcl_cmd_cdata *)nmalloc(sizeof(*cdata));
+	cdata->irp = irp;
+	cdata->syntax = my_strdup(table->syntax);
+	cdata->cmd = my_strdup(argv[4]);
+	add_bind_entry(table, argv[2], argv[3], argv[4], BIND_WANTS_CD, (Function) my_tcl_bind_callback, cdata);
 	Tcl_AppendResult(irp, "moooo", NULL);
 	return(TCL_OK);
 }
@@ -661,6 +702,7 @@
 static int tcl_unbind2 STDVAR
 {
 	bind_table_t *table;
+	tcl_cmd_cdata *cdata;
 
 	BADARGS(5, 5, " type flags cmd/mask procname");
 	table = find_bind_table2(argv[1]);
@@ -668,7 +710,13 @@
 		Tcl_AppendResult(irp, "invalid table type", NULL);
 		return(TCL_ERROR);
 	}
-	del_bind_entry(table, argv[2], argv[3], argv[4]);
+	cdata = get_bind_cdata(table, argv[2], argv[3], argv[4]);
+	if (cdata) {
+		nfree(cdata->cmd);
+		nfree(cdata->syntax);
+		nfree(cdata);
+		del_bind_entry(table, argv[2], argv[3], argv[4]);
+	}
 	Tcl_AppendResult(irp, "mooooo", NULL);
 	return(TCL_OK);
 }
@@ -676,6 +724,7 @@
 static int tcl_bind STDVAR
 {
   tcl_bind_list_t	*tl;
+  bind_table_t *table;
 
   /* Note: `cd' defines what tcl_bind is supposed do: 0 stands for
            bind and 1 stands for unbind. */
@@ -684,11 +733,15 @@
   else
     BADARGS(4, 5, " type flags cmd/mask ?procname?");
 
+  table = find_bind_table2(argv[1]);
+  if (table) {
+    if ((int) cd == 0) return tcl_bind2(cd, irp, argc, argv);
+    else return tcl_unbind2(cd, irp, argc, argv);
+  }
   tl = find_bind_table(argv[1]);
   if (!tl) {
-    Tcl_AppendResult(irp, "bad type, should be one of: ", NULL);
-    dump_bind_tables(irp);
-    return TCL_ERROR;
+    Tcl_AppendResult(irp, "bad table type", NULL);
+    return TCL_OK;
   }
 
   if ((long int) cd == 1) {
@@ -986,9 +1039,8 @@
 			if (entry->bind_flags & BIND_WANTS_CD) table->nargs--;
 			else al--;
 
-			if (table->flags & BIND_BREAKABLE & r) break;
+			if ((table->flags & BIND_BREAKABLE) && (r & BIND_RET_BREAK)) return(r);
 		}
-		if (table->flags & BIND_BREAKABLE & r) break;
 	}
 	return(r);
 }
@@ -1147,7 +1199,10 @@
   }
   if (x == BIND_NOMATCH) {
     /* Check the new bind table. */
-    check_bind(BT_dcc, cmd, &fr, dcc[idx].user, idx, args);
+    x = check_bind(BT_dcc, cmd, &fr, dcc[idx].user, idx, args);
+    if (x & BIND_RET_LOG) {
+      putlog(LOG_CMDS, "*", "#%s# %s %s", dcc[idx].nick, cmd, args);
+    }
     return 0;
   }
   if (x == BIND_EXEC_BRK)
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.15 eggdrop1.7/src/tclhash.h:1.16
--- eggdrop1.7/src/tclhash.h:1.15	Sat Sep 29 23:27:38 2001
+++ eggdrop1.7/src/tclhash.h	Sat Oct  6 23:02:54 2001
@@ -1,7 +1,7 @@
 /*
  * tclhash.h
  *
- * $Id: tclhash.h,v 1.15 2001/09/30 04:27:38 stdarg Exp $
+ * $Id: tclhash.h,v 1.16 2001/10/07 04:02:54 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -35,6 +35,17 @@
 /* Flags for bind tables */
 #define BIND_STRICT_ATTR 0x80
 #define BIND_BREAKABLE 0x100
+
+/* Flags for return values from bind callbacks */
+#define BIND_RET_LOG 1
+#define BIND_RET_BREAK 2
+
+/* Callback clientdata for a tcl bind */
+typedef struct tcl_cmd_cdata_b {
+	Tcl_Interp *irp;
+	char *cmd;
+	char *syntax;
+} tcl_cmd_cdata;
 
 /* Will replace tcl_cmd_t */
 /* This holds the final information for a function listening on a bind
----------------------- End of diff -----------------------



More information about the Changes mailing list