浏览代码

* Moved creation and maintenance of core binds from tclhash.c to
core_binds.c
* Renamed check_* to check_bind_*
* Removed tcl_killdcc


svn: 598

Bryan Drewery 22 年之前
父节点
当前提交
b6fb8bff79
共有 21 个文件被更改,包括 281 次插入323 次删除
  1. 8 8
      src/Makefile.in
  2. 12 11
      src/botcmd.c
  3. 2 1
      src/botmsg.c
  4. 13 12
      src/botnet.c
  5. 8 6
      src/cmds.c
  6. 180 2
      src/core_binds.c
  7. 15 1
      src/core_binds.h
  8. 6 5
      src/dcc.c
  9. 7 6
      src/dccutil.c
  10. 1 1
      src/mod/console.mod/console.c
  11. 1 1
      src/mod/irc.mod/irc.c
  12. 1 1
      src/mod/irc.mod/irc.h
  13. 1 1
      src/mod/module.h
  14. 1 1
      src/mod/server.mod/server.c
  15. 3 3
      src/mod/server.mod/server.h
  16. 12 12
      src/mod/server.mod/servmsg.c
  17. 1 1
      src/modules.c
  18. 0 32
      src/tcldcc.c
  19. 7 196
      src/tclhash.c
  20. 0 21
      src/tclhash.h
  21. 2 1
      src/userrec.c

+ 8 - 8
src/Makefile.in

@@ -109,17 +109,17 @@ botcmd.o: botcmd.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h tandem.h modules.h mod/modvals.h
+ compat/strftime.h tandem.h modules.h mod/modvals.h core_binds.c core_binds.h
 botmsg.o: botmsg.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h tandem.h
+ compat/strftime.h tandem.h core_binds.c core_binds.h
 botnet.o: botnet.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h tandem.h
+ compat/strftime.h tandem.h core_binds.c core_binds.h
 chanprog.o: chanprog.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
@@ -129,7 +129,7 @@ cmds.o: cmds.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h prot
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
  compat/memset.h compat/memcpy.h compat/strcasecmp.h compat/strftime.h \
- tandem.h modules.h mod/modvals.h help.h traffic.h
+ tandem.h modules.h mod/modvals.h help.h traffic.h core_binds.c core_binds.h
 config.o: config.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h chan.h users.h compat/compat.h compat/inet_aton.h \
  compat/inet_ntop.h ../src/main.h compat/snprintf.h  compat/memset.h \
@@ -146,12 +146,12 @@ dcc.o: dcc.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h proto.
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
  compat/memset.h compat/memcpy.h compat/strcasecmp.h compat/strftime.h \
- modules.h mod/modvals.h tandem.h 
+ modules.h mod/modvals.h tandem.h core_binds.c core_binds.h
 dccutil.o: dccutil.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h modules.h mod/modvals.h tandem.h
+ compat/strftime.h modules.h mod/modvals.h tandem.h core_binds.c core_binds.o
 debug.o: debug.c stringfix main.h ../config.h conf.h eggdrop.h \
  proto.h ../lush.h misc_file.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
@@ -194,7 +194,7 @@ modules.o: modules.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h modules.h mod/modvals.h tandem.h
+ compat/strftime.h modules.h mod/modvals.h tandem.h core_binds.c core_binds.h
 net.o: net.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
@@ -242,7 +242,7 @@ userrec.o: userrec.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h modules.h mod/modvals.h tandem.h
+ compat/strftime.h modules.h mod/modvals.h tandem.h core_binds.c core_binds.o
 users.o: users.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \

+ 12 - 11
src/botcmd.c

@@ -10,6 +10,7 @@
 #include "users.h"
 #include "chan.h"
 #include "modules.h"
+#include "core_binds.h"
 
 extern char		 botnetnick[], ver[], admin[], network[], motdfile[];
 extern int		 dcc_total, remote_boots, noshare, timesync, conmask;
@@ -116,9 +117,9 @@ static void bot_chan2(int idx, char *msg)
     if (i >= 0)
       botnet_send_chan(idx, from, NULL, chan, msg);
     if (strchr(from, '@') != NULL)
-      check_chat(from, chan, msg);
+      check_bind_chat(from, chan, msg);
     else
-      check_bcst(from, chan, msg);
+      check_bind_bcst(from, chan, msg);
   }
 }
 
@@ -241,7 +242,7 @@ static void bot_actchan(int idx, char *par)
   }
   chanout_but(-1, chan, "* %s %s\n", from, par);
   botnet_send_act(idx, from, NULL, chan, par);
-  check_act(from, chan, par);
+  check_bind_act(from, chan, par);
 }
 
 /* priv <from> <to> <message>
@@ -762,7 +763,7 @@ static void bot_nlinked(int idx, char *par)
     x = '-';
   }
   addbot(newbot, dcc[idx].nick, next, x, i);
-  check_link(newbot, next);
+  check_bind_link(newbot, next);
   u = get_user_by_handle(userlist, newbot);
   if (bot_flags(u) & BOT_REJECT) {
     botnet_send_reject(idx, botnetnick, NULL, newbot, NULL, NULL);
@@ -1034,7 +1035,7 @@ static void bot_zapf(int idx, char *par)
     char *opcode;
 
     opcode = newsplit(&par);
-    check_bot(from, opcode, par);
+    check_bind_bot(from, opcode, par);
     return;
   }
   i = nextbot(to);
@@ -1058,7 +1059,7 @@ static void bot_zapfbroad(int idx, char *par)
     fake_alert(idx, "direction", from);
     return;
   }
-  check_bot(from, opcode, par);
+  check_bind_bot(from, opcode, par);
   botnet_send_zapf_broad(idx, from, opcode, par);
 }
 
@@ -1152,12 +1153,12 @@ static void bot_join(int idx, char *par)
       if (b_numver(idx) >= NEAT_BOTNET)
 	chanout_but(-1, i, "*** (%s) %s %s %s.\n", bot, nick, NET_LEFTTHE,
 		    i ? "channel" : "party line");
-      check_chpt(bot, nick, sock, i);
+      check_bind_chpt(bot, nick, sock, i);
     }
     if ((b_numver(idx) >= NEAT_BOTNET) && !linking)
       chanout_but(-1, chan, "*** (%s) %s %s %s.\n", bot, nick, NET_JOINEDTHE,
 		  chan ? "channel" : "party line");
-    check_chjn(bot, nick, chan, y[0], sock, par);
+    check_bind_chjn(bot, nick, chan, y[0], sock, par);
   }
 }
 
@@ -1189,7 +1190,7 @@ static void bot_part(int idx, char *par)
   }
   if ((partyidx = getparty(bot, sock)) != -1) {
     if (party[partyidx].chan >= 0)
-      check_chpt(bot, nick, sock, party[partyidx].chan);
+      check_bind_chpt(bot, nick, sock, party[partyidx].chan);
     if ((b_numver(idx) >= NEAT_BOTNET) && !silent) {
       register int chan = party[partyidx].chan;
 
@@ -1229,7 +1230,7 @@ static void bot_away(int idx, char *par)
   sock = base64_to_int(etc);
   if (sock == 0)
     sock = partysock(bot, etc);
-  check_away(bot, sock, par);
+  check_bind_away(bot, sock, par);
   if (par[0]) {
     partystat(bot, sock, PLSTAT_AWAY, 0);
     partyaway(bot, sock, par);
@@ -1416,7 +1417,7 @@ static void bot_rsim(char *botnick, char *code, char *par)
     dcc[idx].addr = 0;
     dcc[idx].user = get_user_by_handle(userlist, nick);
   }
-  check_dcc(cmd, idx, par);
+  check_bind_dcc(cmd, idx, par);
 }
 
 void bounce_simul(int idx, char *buf)

+ 2 - 1
src/botmsg.c

@@ -9,6 +9,7 @@
 
 #include "main.h"
 #include "tandem.h"
+#include "core_binds.h"
 
 extern struct dcc_t	*dcc;
 extern int		 dcc_total, tands;
@@ -605,7 +606,7 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
     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_note(from, to, msg)) {
+    if (check_bind_note(from, to, msg)) {
       if ((idx >= 0) && (echo))
 	dprintf(idx, "-> %s: %s\n", to, msg);
       return NOTE_TCL;

+ 13 - 12
src/botnet.c

@@ -11,6 +11,7 @@
 
 #include "main.h"
 #include "tandem.h"
+#include "core_binds.h"
 
 extern int			dcc_total, backgrd, connect_timeout, max_dcc,
 				egg_numver, cfg_count;
@@ -289,7 +290,7 @@ void rembot(char *who)
   if (!*ptr)
     /* May have just .unlink *'d */
     return;
-  check_disc(who);
+  check_bind_disc(who);
 
   u = get_user_by_handle(userlist, who);
   if (u != NULL)
@@ -338,7 +339,7 @@ void rempartybot(char *bot)
   for (i = 0; i < parties; i++)
     if (!egg_strcasecmp(party[i].bot, bot)) {
       if (party[i].chan >= 0)
-        check_chpt(bot, party[i].nick, party[i].sock, party[i].chan);
+        check_bind_chpt(bot, party[i].nick, party[i].sock, party[i].chan);
       remparty(bot, party[i].sock);
       i--;
     }
@@ -929,7 +930,7 @@ int botunlink(int idx, char *nick, char *reason)
       parties--;
       /* Assert? */
       if (party[i].chan >= 0)
-        check_chpt(party[i].bot, party[i].nick, party[i].sock,
+        check_bind_chpt(party[i].bot, party[i].nick, party[i].sock,
 		       party[i].chan);
     }
     strcpy(s, "killassoc &");
@@ -1367,10 +1368,10 @@ static void cont_tandem_relay(int idx, char *buf, register int i)
 		dcc[uidx].nick, BOT_PARTYLEFT);
     if (dcc[uidx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(uidx, NULL);
-    check_chpt(botnetnick, dcc[uidx].nick, dcc[uidx].sock,
+    check_bind_chpt(botnetnick, dcc[uidx].nick, dcc[uidx].sock,
 		   dcc[uidx].u.chat->channel);
   }
-  check_chof(dcc[uidx].nick, uidx);
+  check_bind_chof(dcc[uidx].nick, uidx);
   dcc[uidx].type = &DCC_RELAYING;
   dcc[uidx].u.relay = ri;
 }
@@ -1405,8 +1406,8 @@ static void eof_dcc_relay(int idx)
     if (dcc[j].u.chat->channel < GLOBAL_CHANS)
       botnet_send_join_idx(j, -1);
   }
-  check_chon(dcc[j].nick, j);
-  check_chjn(botnetnick, dcc[j].nick, dcc[j].u.chat->channel,
+  check_bind_chon(dcc[j].nick, j);
+  check_bind_chjn(botnetnick, dcc[j].nick, dcc[j].u.chat->channel,
 		 geticon(j), dcc[j].sock, dcc[j].host);
   killsock(dcc[idx].sock);
   lostdcc(idx);
@@ -1500,9 +1501,9 @@ static void dcc_relaying(int idx, char *buf, int j)
   free(dcc[idx].u.relay);
   dcc[idx].u.chat = ci;
   dcc[idx].type = &DCC_CHAT;
-  check_chon(dcc[idx].nick, idx);
+  check_bind_chon(dcc[idx].nick, idx);
   if (dcc[idx].u.chat->channel >= 0)
-    check_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
+    check_bind_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
 		   geticon(idx), dcc[idx].sock, dcc[idx].host);
   killsock(dcc[j].sock);
   lostdcc(j);
@@ -1701,13 +1702,13 @@ void restart_chons()
   /* Dump party line members */
   for (i = 0; i < dcc_total; i++) {
     if (dcc[i].type == &DCC_CHAT) {
-      check_chon(dcc[i].nick, i);
-      check_chjn(botnetnick, dcc[i].nick, dcc[i].u.chat->channel,
+      check_bind_chon(dcc[i].nick, i);
+      check_bind_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_chjn(party[i].bot, party[i].nick, party[i].chan,
+    check_bind_chjn(party[i].bot, party[i].nick, party[i].chan,
 		   party[i].flag, party[i].sock, party[i].from);
   }
 }

+ 8 - 6
src/cmds.c

@@ -10,6 +10,8 @@
 #include "modules.h"
 #include "help.h"
 #include "traffic.h" /* egg_traffic_t */
+#include "core_binds.h"
+
 #include <ctype.h>
 #include <stdlib.h>
 #include <pwd.h>
@@ -563,7 +565,7 @@ static void cmd_me(struct userrec *u, int idx, char *par)
       dprintf(i, "* %s %s\n", dcc[idx].nick, par);
   botnet_send_act(idx, botnetnick, dcc[idx].nick,
 		  dcc[idx].u.chat->channel, par);
-  check_act(dcc[idx].nick, dcc[idx].u.chat->channel, par);
+  check_bind_act(dcc[idx].nick, dcc[idx].u.chat->channel, par);
 }
 
 static void cmd_motd(struct userrec *u, int idx, char *par)
@@ -2412,7 +2414,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
       return;
     } else {
       dprintf(idx, STR("Leaving chat mode...\n"));
-      check_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
+      check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
 		     dcc[idx].u.chat->channel);
       chanout_but(-1, dcc[idx].u.chat->channel,
 		  "*** %s left the party line.\n",
@@ -2484,7 +2486,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
     } else {
       oldchan = dcc[idx].u.chat->channel;
       if (oldchan >= 0)
-	check_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, oldchan);
+	check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, oldchan);
       if (!oldchan) {
 	chanout_but(-1, 0, "*** %s left the party line.\n", dcc[idx].nick);
       } else if (oldchan > 0) {
@@ -2498,7 +2500,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
 	dprintf(idx, STR("Joining channel '%s'...\n"), arg);
 	chanout_but(-1, newchan, "*** %s joined the channel.\n", dcc[idx].nick);
       }
-      check_chjn(botnetnick, dcc[idx].nick, newchan, geticon(idx),
+      check_bind_chjn(botnetnick, dcc[idx].nick, newchan, geticon(idx),
 		     dcc[idx].sock, dcc[idx].host);
       if (newchan < GLOBAL_CHANS)
 	botnet_send_join_idx(idx, oldchan);
@@ -4034,9 +4036,9 @@ static void cmd_whoami(struct userrec *u, int idx, char *par)
 static void cmd_quit(struct userrec *u, int idx, char *text)
 {
 	if (dcc[idx].u.chat->channel >= 0 && dcc[idx].u.chat->channel < GLOBAL_CHANS) {
-		check_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, dcc[idx].u.chat->channel);
+		check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, dcc[idx].u.chat->channel);
 	}
-	check_chof(dcc[idx].nick, idx);
+	check_bind_chof(dcc[idx].nick, idx);
 	dprintf(idx, "*** See you later cowboy!\n\n");
 	flush_lines(idx, dcc[idx].u.chat);
 	putlog(LOG_MISC, "*", "DCC connection closed (%s!%s)", dcc[idx].nick, dcc[idx].host);

+ 180 - 2
src/core_binds.c

@@ -1,11 +1,189 @@
 #include "main.h"
 
-static bind_table_t *BT_time, *BT_event;
+extern cmd_t C_dcc[];
+extern struct dcc_t *dcc;
+extern struct userrec *userlist;
+extern time_t now;
+extern char             dcc_prefix[];
+
+
+
+static bind_table_t *BT_link, *BT_disc, *BT_away, *BT_dcc;
+static bind_table_t *BT_chat, *BT_act, *BT_bcst, *BT_note;
+static bind_table_t *BT_bot, *BT_nkch, *BT_chon, *BT_chof;
+static bind_table_t *BT_chpt, *BT_chjn, *BT_time, *BT_event;
 
 void core_binds_init()
 {
-	BT_time = bind_table_add("time", 5, "iiiii", MATCH_MASK, BIND_STACKABLE);
+        BT_act = bind_table_add("act", 3, "sis", MATCH_MASK, BIND_STACKABLE);
+        BT_away = bind_table_add("away", 3, "sis", MATCH_MASK, BIND_STACKABLE);
+        BT_bcst = bind_table_add("bcst", 3, "sis", MATCH_MASK, BIND_STACKABLE);
+        BT_bot = bind_table_add("bot", 3, "sss", MATCH_EXACT, 0);
+        BT_chat = bind_table_add("chat", 3, "sis", MATCH_MASK, BIND_STACKABLE | BIND_BREAKABLE);
+        BT_chjn = bind_table_add("chjn", 6, "ssisis", MATCH_MASK, BIND_STACKABLE);
+        BT_chon = bind_table_add("chon", 2, "si", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
+        BT_chof = bind_table_add("chof", 2, "si", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
+        BT_chpt = bind_table_add("chpt", 4, "ssii", MATCH_MASK, BIND_STACKABLE);
+        BT_dcc = bind_table_add("dcc", 3, "Uis", MATCH_PARTIAL, BIND_USE_ATTR);
+        add_builtins("dcc", C_dcc);
+        BT_disc = bind_table_add("disc", 1, "s", MATCH_MASK, BIND_STACKABLE);
 	BT_event = bind_table_add("event", 1, "s", MATCH_MASK, BIND_STACKABLE);
+        BT_link = bind_table_add("link", 2, "ss", MATCH_MASK, BIND_STACKABLE);
+        BT_nkch = bind_table_add("nkch", 2, "ss", MATCH_MASK, BIND_STACKABLE);
+        BT_note = bind_table_add("note", 3 , "sss", MATCH_EXACT, 0);
+	BT_time = bind_table_add("time", 5, "iiiii", MATCH_MASK, BIND_STACKABLE);
+
+
+}
+
+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;
+#ifdef S_DCCPASS
+  int found = 0;
+#endif
+
+  get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
+
+#ifdef S_DCCPASS
+  for (hm = H_dcc->first; hm; hm = hm->next) {
+    if (!egg_strcasecmp(cmd, hm->mask)) {
+      found = 1;
+      break;
+    }
+  }
+  if (found) {
+    if (has_cmd_pass(cmd)) {
+      char *p,
+        work[1024],
+        pass[128];
+      p = strchr(args, ' ');
+      if (p)
+        *p = 0;
+      strncpyz(pass, args, sizeof(pass));
+      if (check_cmd_pass(cmd, pass)) {
+        if (p)
+          *p = ' ';
+        strncpyz(work, args, sizeof(work));
+        p = work;
+        newsplit(&p);
+        strcpy(args, p);
+      } else {
+        dprintf(idx, "Invalid command password. Use %scommand password arguments\n", dcc_prefix);
+        putlog(LOG_MISC, "*", "%s attempted %s%s with missing or incorrect command password", dcc[idx].nick, dcc_prefix, cmd);
+        return 0;
+      }
+    }
+  }
+#endif /* S_DCCPASS */
+  x = check_bind(BT_dcc, cmd, &fr, dcc[idx].user, idx, text);
+  if (x == 0)
+    dprintf(idx, "What?  You need '%shelp'\n", dcc_prefix);
+  else 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(char *handle, int chan, const char *text)
+{
+  return check_bind(BT_chat, text, NULL, handle, 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);
+}
+
+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_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_ADMIN;
+    break;
+  case '*':
+    fr.global = USER_OWNER;
+    break;
+  case '+':
+    fr.global = USER_MASTER;
+    break;
+  case '@':
+    fr.global = USER_OP;
+    break;
+  }
+  egg_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];
+
+  egg_snprintf(v, sizeof v, "%d", chan);
+  check_bind(BT_chpt, v, NULL, bot, hand, sock, chan);
+}
+
+void check_bind_away(const char *bot, int idx, const char *msg)
+{
+  check_bind(BT_away, bot, NULL, bot, idx, msg);
 }
 
 void check_bind_time(struct tm *tm)

+ 15 - 1
src/core_binds.h

@@ -4,5 +4,19 @@
 void core_binds_init();
 void check_bind_time(struct tm *tm);
 void check_bind_event(char *event);
+void check_bind_dcc(const char *, int, const char *);
+void check_bind_chjn(const char *, const char *, int, char, int, const char *);
+void check_bind_chpt(const char *, const char *, int, int);
+void check_bind_bot(const char *, const char *, const char *);
+void check_bind_link(const char *, const char *);
+void check_bind_disc(const char *);
+int check_bind_note(const char *, const char *, const char *);
+void check_bind_nkch(const char *, const char *);
+void check_bind_away(const char *, int, const char *);
+int check_bind_chat(char *, int, const char *);
+void check_bind_act(const char *, int, const char *);
+void check_bind_bcst(const char *, int, const char *);
+void check_bind_chon(char *, int);
+void check_bind_chof(char *, int);
 
-#endif
+#endif /* !_CORE_BINDS_H */

+ 6 - 5
src/dcc.c

@@ -16,6 +16,7 @@
 #include <sys/utsname.h>
 #include <sys/stat.h>
 #include "tandem.h"
+#include "core_binds.h"
 
 
 extern struct userrec	*userlist;
@@ -297,7 +298,7 @@ static void bot_version(int idx, char *par)
   dcc[idx].type = &DCC_BOT;
   addbot(dcc[idx].nick, dcc[idx].nick, botnetnick, '-',
 	 dcc[idx].u.bot->numver);
-  check_link(dcc[idx].nick, botnetnick);
+  check_bind_link(dcc[idx].nick, botnetnick);
   egg_snprintf(x, sizeof x, "v %d", dcc[idx].u.bot->numver);
   bot_shareupdate(idx, x);
   bot_share(idx, x);
@@ -950,10 +951,10 @@ static void eof_dcc_chat(int idx)
 		dcc[idx].nick);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(idx, "lost dcc link");
-    check_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
+    check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
 		   dcc[idx].u.chat->channel);
   }
-  check_chof(dcc[idx].nick, idx);
+  check_bind_chof(dcc[idx].nick, idx);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -1016,7 +1017,7 @@ static void dcc_chat(int idx, char *buf, int i)
         buf++;
         v = newsplit(&buf);
         rmspace(buf);
-	check_dcc(v, idx, buf);
+	check_bind_dcc(v, idx, buf);
     } else if (buf[0] == ',') {
       int me = 0;
 
@@ -1057,7 +1058,7 @@ static void dcc_chat(int idx, char *buf, int i)
     } else {
 	int r;
 
-	r = check_chat(dcc[idx].nick, dcc[idx].u.chat->channel, buf);
+	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)

+ 7 - 6
src/dccutil.c

@@ -14,6 +14,7 @@
 #include "chan.h"
 #include "modules.h"
 #include "tandem.h"
+#include "core_binds.h"
 
 extern struct dcc_t	*dcc;
 extern int		 dcc_total, max_dcc, dcc_flood_thr, backgrd, MAXSOCKS, tands;
@@ -269,7 +270,7 @@ void dcc_chatter(int idx)
 
   j = dcc[idx].sock;
   strcpy(dcc[idx].u.chat->con_chan, "***");
-  check_chon(dcc[idx].nick, idx);
+  check_bind_chon(dcc[idx].nick, idx);
   dcc[idx].u.chat->channel = 234567;
   /* Still there? */
 
@@ -295,7 +296,7 @@ void dcc_chatter(int idx)
 	  botnet_send_join_idx(idx, -1);
 	}
       }
-      check_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
+      check_bind_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 */
@@ -427,7 +428,7 @@ void not_away(int idx)
   dprintf(idx, "You're not away any more.\n");
   free(dcc[idx].u.chat->away);
   dcc[idx].u.chat->away = NULL;
-  check_away(botnetnick, dcc[idx].sock, NULL);
+  check_bind_away(botnetnick, dcc[idx].sock, NULL);
 }
 
 void set_away(int idx, char *s)
@@ -451,7 +452,7 @@ void set_away(int idx, char *s)
     }
   }
   dprintf(idx, "You are now away.\n");
-  check_away(botnetnick, dcc[idx].sock, s);
+  check_bind_away(botnetnick, dcc[idx].sock, s);
 }
 
 /* This helps the memory debugging
@@ -559,7 +560,7 @@ int detect_dcc_flood(time_t * timer, struct chat_info *chat, int idx)
 	if (chat->channel < GLOBAL_CHANS)
 	  botnet_send_part_idx(idx, x);
       }
-      check_chof(dcc[idx].nick, idx);
+      check_bind_chof(dcc[idx].nick, idx);
       if ((dcc[idx].sock != STDOUT) || backgrd) {
 	killsock(dcc[idx].sock);
 	lostdcc(idx);
@@ -595,7 +596,7 @@ void do_boot(int idx, char *by, char *reason)
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(idx, x);
   }
-  check_chof(dcc[idx].nick, idx);
+  check_bind_chof(dcc[idx].nick, idx);
   if ((dcc[idx].sock != STDOUT) || backgrd) {
     killsock(dcc[idx].sock);
     lostdcc(idx);

+ 1 - 1
src/mod/console.mod/console.c

@@ -312,7 +312,7 @@ static int console_chon(char *handle, int idx)
     if ((dcc[idx].u.chat->channel >= 0) &&
 	(dcc[idx].u.chat->channel < GLOBAL_CHANS)) {
       botnet_send_join_idx(idx, -1);
-      check_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
+      check_bind_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
 		     geticon(idx), dcc[idx].sock, dcc[idx].host);
     }
     if (info_party) {

+ 1 - 1
src/mod/irc.mod/irc.c

@@ -1269,7 +1269,7 @@ static void check_expired_chanstuff()
 }
 
 #ifdef S_AUTH
-static int check_pubc(char *cmd, char *nick, char *from, struct userrec *u, char *args, char *chan)
+static int check_bind_pubc(char *cmd, char *nick, char *from, struct userrec *u, char *args, char *chan)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   int x;

+ 1 - 1
src/mod/irc.mod/irc.h

@@ -12,7 +12,7 @@
 
 #ifdef MAKING_IRC
 #ifdef S_AUTH
-static int check_pubc(char *, char *, char *, struct userrec *, char *, char *);
+static int check_bind_pubc(char *, char *, char *, struct userrec *, char *, char *);
 #endif /* S_AUTH */
 static void makeopline(struct chanset_t *, char *, char *);
 static int me_op(struct chanset_t *);

+ 1 - 1
src/mod/module.h

@@ -362,7 +362,7 @@
 #define botname ((char *)(global[211]))
 /* 212 - 215 */
 /* 212: remove_gunk() -- UNUSED (drummer) */
-#define check_chjn ((void (*) (const char *,const char *,int,char,int,const char *))global[213])
+#define check_bind_chjn ((void (*) (const char *,const char *,int,char,int,const char *))global[213])
 #define sanitycheck_dcc ((int (*)(char *, char *, char *, char *))global[214])
 #define isowner ((int (*)(char *))global[215])
 /* 216 - 219 */

+ 1 - 1
src/mod/server.mod/server.c

@@ -1536,7 +1536,7 @@ static Function server_table[] =
   (Function) & answer_ctcp,	/* int					*/
   /* 16 - 19 */
   (Function) & trigger_on_ignore, /* int				*/
-  (Function) check_ctcpr,
+  (Function) check_bind_ctcpr,
   (Function) detect_avalanche,
   (Function) nuke_server,
   /* 20 - 23 */

+ 3 - 3
src/mod/server.mod/server.h

@@ -7,8 +7,8 @@
 #ifndef _EGG_MOD_SERVER_SERVER_H
 #define _EGG_MOD_SERVER_SERVER_H
 
-#define check_ctcp(a,b,c,d,e,f) check_ctcpr(a,b,c,d,e,f,BT_ctcp)
-#define check_ctcr(a,b,c,d,e,f) check_ctcpr(a,b,c,d,e,f,BT_ctcr)
+#define check_bind_ctcp(a,b,c,d,e,f) check_bind_ctcpr(a,b,c,d,e,f,BT_ctcp)
+#define check_bind_ctcr(a,b,c,d,e,f) check_bind_ctcpr(a,b,c,d,e,f,BT_ctcr)
 
 #ifndef MAKING_SERVER
 /* 4 - 7 */
@@ -27,7 +27,7 @@
 #define answer_ctcp (*(int *)(server_funcs[15]))
 /* 16 - 19 */
 #define trigger_on_ignore (*(int *)(server_funcs[16]))
-#define check_ctcpr ((int(*)(char*,char*,struct userrec*,char*,char*,char*,bind_table_t *))server_funcs[17])
+#define check_bind_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 */

+ 12 - 12
src/mod/server.mod/servmsg.c

@@ -100,20 +100,20 @@ static int gotfake433(char *from)
  * msg: proc-name <nick> <user@host> <handle> <args...>
  */
 
-static int check_msg(char *cmd, char *nick, char *uhost, struct userrec *u, char *args)
+static int check_bind_msg(char *cmd, char *nick, char *uhost, struct userrec *u, char *args)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
   int x;
 
   get_user_flagrec(u, &fr, NULL);
   x = check_bind(BT_msg, cmd, &fr, nick, uhost, u, args);
-  if (x & BIND_RET_LOG) putlog(LOG_CMDS, "*", "in check_msg (%s!%s) !%s! %s %s", nick, uhost, u ? u->handle : "*" , args);
+  if (x & BIND_RET_LOG) putlog(LOG_CMDS, "*", "in check_bind_msg (%s!%s) !%s! %s %s", nick, uhost, u ? u->handle : "*" , args);
   if (x) return(1);
   else return(0);
 }
 
 #ifdef S_AUTH
-static int check_msgc(char *cmd, char *nick, char *from, struct userrec *u, char *args)
+static int check_bind_msgc(char *cmd, char *nick, char *from, struct userrec *u, char *args)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   int x;
@@ -121,7 +121,7 @@ static int check_msgc(char *cmd, char *nick, char *from, struct userrec *u, char
   x = check_bind(BT_msgc, cmd, &fr, nick, from, u, args, NULL);
 
   if (x & BIND_RET_LOG)
-    putlog(LOG_CMDS, "*", " in check_msgc(%s!%s) !%s! %s%s %s", nick, from, u ? u->handle : "*", cmdprefix, cmd, args);
+    putlog(LOG_CMDS, "*", " in check_bind_msgc(%s!%s) !%s! %s%s %s", nick, from, u ? u->handle : "*", cmdprefix, cmd, args);
 
   if (x & BIND_RET_BREAK) return(1);
   return(0);
@@ -130,14 +130,14 @@ static int check_msgc(char *cmd, char *nick, char *from, struct userrec *u, char
 
 /* Return 1 if processed.
  */
-static int check_raw(char *from, char *code, char *msg)
+static int check_bind_raw(char *from, char *code, char *msg)
 {
 //  return check_bind(BT_raw, code, NULL, from, code, msg);
   return check_bind(BT_raw, code, NULL, from, msg);
 }
 
 
-static int check_ctcpr(char *nick, char *uhost, struct userrec *u,
+static int check_bind_ctcpr(char *nick, char *uhost, struct userrec *u,
                            char *dest, char *keyword, char *args,
                            bind_table_t *table)
 {
@@ -418,7 +418,7 @@ static int gotmsg(char *from, char *msg)
 	    } else {
 	      u = get_user_by_host(from);
 	      if (!ignoring || trigger_on_ignore) {
-	        if (!check_ctcp(nick, uhost, u, to, code, ctcp) &&
+	        if (!check_bind_ctcp(nick, uhost, u, to, code, ctcp) &&
 		    !ignoring) {
 		  if ((lowercase_ctcp && !egg_strcasecmp(code, "DCC")) ||
 		      (!lowercase_ctcp && !strcmp(code, "DCC"))) {
@@ -496,7 +496,7 @@ static int gotmsg(char *from, char *msg)
         code++;        
         u = auth[i].user;
 
-        if (check_msgc(code, nick, uhost, u, msg))
+        if (check_bind_msgc(code, nick, uhost, u, msg))
           auth[i].atime = now;
         else
           putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
@@ -522,11 +522,11 @@ static int gotmsg(char *from, char *msg)
             else if (!egg_strcasecmp(code, msgident))
               sprintf(buf, "ident");
             if (buf[0])
-              result = check_msg(buf, nick, uhost, u, msg);
+              result = check_bind_msg(buf, nick, uhost, u, msg);
           }
 #endif /* S_MSGCMDS */
           if (doit)
-            result = check_msg(code, nick, uhost, u, msg);
+            result = check_bind_msg(code, nick, uhost, u, msg);
             
 	  if (!result)
 	    putlog(LOG_MSGS, "*", " in gotmsg [%s] %s %s", from, code, msg);
@@ -586,7 +586,7 @@ static int gotnotice(char *from, char *msg)
 	} else {
 	  u = get_user_by_host(from);
 	  if (!ignoring || trigger_on_ignore) {
-            check_ctcr(nick, uhost, u, to, code, ctcp);
+            check_bind_ctcr(nick, uhost, u, to, code, ctcp);
 	    if (!ignoring)
 	      /* Who cares? */
 	      putlog(LOG_MSGS, "*",
@@ -1032,7 +1032,7 @@ static void server_activity(int idx, char *msg, int len)
   /* This has GOT to go into the raw binding table, * merely because this
    * is less effecient.
   */
-  check_raw(from, code, msg);
+  check_bind_raw(from, code, msg);
 }
 
 static int gotping(char *from, char *msg)

+ 1 - 1
src/modules.c

@@ -422,7 +422,7 @@ Function global_table[] =
   (Function) botname,
   /* 212 - 215 */
   (Function) 0,			/* remove_gunk() -- UNUSED! (drummer)	*/
-  (Function) check_chjn,
+  (Function) check_bind_chjn,
   (Function) sanitycheck_dcc,
   (Function) isowner,
   /* 216 - 219 */

+ 0 - 32
src/tcldcc.c

@@ -73,37 +73,6 @@ static int tcl_valididx STDVAR
    return TCL_OK;
 }
 
-static int tcl_killdcc STDVAR
-{
-  int idx;
-
-  BADARGS(2, 3, " idx ?reason?");
-  idx = findidx(atoi(argv[1]));
-  if (idx < 0) {
-    Tcl_AppendResult(irp, "invalid idx", NULL);
-    return TCL_ERROR;
-  }
-  /* Don't kill terminal socket */
-  if ((dcc[idx].sock == STDOUT) && !backgrd)
-    return TCL_OK;
-  /* Make sure 'whom' info is updated for other bots */
-  if (dcc[idx].type->flags & DCT_CHAT) {
-    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",
-		argc == 3 ? ": " : "", argc == 3 ? argv[2] : "");
-    botnet_send_part_idx(idx, argc == 3 ? argv[2] : "");
-    if ((dcc[idx].u.chat->channel >= 0) &&
-	(dcc[idx].u.chat->channel < GLOBAL_CHANS))
-      check_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
-		     dcc[idx].u.chat->channel);
-    check_chof(dcc[idx].nick, idx);
-    /* Notice is sent to the party line, the script can add a reason. */
-  }
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-  return TCL_OK;
-}
-
 static int tcl_putbot STDVAR
 {
   int i;
@@ -290,7 +259,6 @@ tcl_cmds tcldcc_cmds[] =
   {"putidx",		tcl_putdcc},
   {"hand2idx",		tcl_hand2idx},
   {"valididx",		tcl_valididx},
-  {"killdcc",		tcl_killdcc},
   {"putbot",		tcl_putbot},
   {"putallbots",	tcl_putallbots},
   {"idx2hand",		tcl_idx2hand},

+ 7 - 196
src/tclhash.c

@@ -15,60 +15,24 @@
 #include "match.c"
 #include "egg_timer.h"
 
-extern struct dcc_t	*dcc;
-extern struct userrec	*userlist;
-extern int		 dcc_total;
-extern time_t		 now;
-extern mycmds		 cmdlist[];
-extern int		 cmdi;
+extern struct dcc_t *dcc;
+extern int dcc_total;
+extern mycmds            cmdlist[];
+extern int               cmdi;
 
-extern char		dcc_prefix[];
 
-/* New bind table list */
+/* The head of the bind table linked list. */
 static bind_table_t *bind_table_list_head = NULL;
-static bind_table_t *BT_link;
-static bind_table_t *BT_disc;
-static bind_table_t *BT_away;
-static bind_table_t *BT_dcc;
-static bind_table_t *BT_bot;
-static bind_table_t *BT_note;
-static bind_table_t *BT_nkch;
-static bind_table_t *BT_chat;
-static bind_table_t *BT_act;
-static bind_table_t *BT_bcst;
-static bind_table_t *BT_chon;
-static bind_table_t *BT_chof;
-static bind_table_t *BT_chpt;
-static bind_table_t *BT_chjn;
-
-/* Variables to control garbage collection. */
+
+/* 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);
 
-
-extern cmd_t C_dcc[];
-
 void binds_init(void)
 {
 	bind_table_list_head = NULL;
-	BT_link = bind_table_add("link", 2, "ss", MATCH_MASK, BIND_STACKABLE);
-        BT_nkch = bind_table_add("nkch", 2, "ss", MATCH_MASK, BIND_STACKABLE);
-	BT_disc = bind_table_add("disc", 1, "s", MATCH_MASK, BIND_STACKABLE);
-	BT_away = bind_table_add("away", 3, "sis", MATCH_MASK, BIND_STACKABLE);
-	BT_chon = bind_table_add("chon", 2, "si", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
-	BT_chof = bind_table_add("chof", 2, "si", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
-	BT_dcc = bind_table_add("dcc", 3, "Uis", MATCH_PARTIAL, BIND_USE_ATTR);
-	BT_bot = bind_table_add("bot", 3, "sss", MATCH_EXACT, 0);
-        BT_note = bind_table_add("note", 3 , "sss", MATCH_EXACT, 0);
-	BT_chat = bind_table_add("chat", 3, "sis", MATCH_MASK, BIND_STACKABLE | BIND_BREAKABLE);
-	BT_act = bind_table_add("act", 3, "sis", MATCH_MASK, BIND_STACKABLE);
-	BT_bcst = bind_table_add("bcst", 3, "sis", MATCH_MASK, BIND_STACKABLE);
-        BT_chpt = bind_table_add("chpt", 4, "ssii", MATCH_MASK, BIND_STACKABLE);
-        BT_chjn = bind_table_add("chjn", 6, "ssisis", MATCH_MASK, BIND_STACKABLE);
-
-	add_builtins("dcc", C_dcc);
 }
 
 static int internal_bind_cleanup()
@@ -401,159 +365,6 @@ int check_bind(bind_table_t *table, const char *match, struct flag_record *flags
 	return(retval);
 }
 
-/* Check for tcl-bound dcc command, return 1 if found
- * dcc: proc-name <handle> <sock> <args...>
- */
-void check_dcc(const char *cmd, int idx, const char *text)
-{
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  int x;
-#ifdef S_DCCPASS
-  int found = 0;
-#endif
-
-  get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
-
-#ifdef S_DCCPASS
-  for (hm = H_dcc->first; hm; hm = hm->next) {
-    if (!egg_strcasecmp(cmd, hm->mask)) {
-      found = 1;
-      break;
-    }
-  }
-  if (found) {
-    if (has_cmd_pass(cmd)) {
-      char *p,
-        work[1024],
-        pass[128];
-      p = strchr(args, ' ');
-      if (p)
-        *p = 0;
-      strncpyz(pass, args, sizeof(pass));
-      if (check_cmd_pass(cmd, pass)) {
-        if (p)
-          *p = ' ';
-        strncpyz(work, args, sizeof(work));
-        p = work;
-        newsplit(&p);
-        strcpy(args, p);
-      } else {
-        dprintf(idx, "Invalid command password. Use %scommand password arguments\n", dcc_prefix);
-        putlog(LOG_MISC, "*", "%s attempted %s%s with missing or incorrect command password", dcc[idx].nick, dcc_prefix, cmd);
-        return 0;
-      }
-    }
-  }
-#endif /* S_DCCPASS */
-  x = check_bind(BT_dcc, cmd, &fr, dcc[idx].user, idx, text);
-  if (x == 0)
-    dprintf(idx, "What?  You need '%shelp'\n", dcc_prefix);
-  else if (x & BIND_RET_LOG) {
-     putlog(LOG_CMDS, "*", "#%s# %s %s", dcc[idx].nick, cmd, text);
-  }
-}
-
-void check_bot(const char *nick, const char *code, const char *param)
-{
-  check_bind(BT_bot, code, NULL, nick, code, param);
-}
-
-void check_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_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_chat(char *handle, int chan, const char *text)
-{
-  return check_bind(BT_chat, text, NULL, handle, chan, text);
-}
-
-void check_act(const char *from, int chan, const char *text)
-{
-  check_bind(BT_act, text, NULL, from, chan, text);
-}
-
-void check_bcst(const char *from, int chan, const char *text)
-{
-  check_bind(BT_bcst, text, NULL, from, chan, text);
-}
-
-void check_nkch(const char *ohand, const char *nhand)
-{
-  check_bind(BT_nkch, ohand, NULL, ohand, nhand);
-}
-
-void check_link(const char *bot, const char *via)
-{
-  check_bind(BT_link, bot, NULL, bot, via);
-}
-
-void check_disc(const char *bot)
-{
-  check_bind(BT_disc, bot, NULL, bot);
-}
-
-int check_note(const char *from, const char *to, const char *text)
-{
-  return check_bind(BT_note, to, NULL, from, to, text);
-}
-
-void check_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_ADMIN;
-    break;
-  case '*':
-    fr.global = USER_OWNER;
-    break;
-  case '+':
-    fr.global = USER_MASTER;
-    break;
-  case '@':
-    fr.global = USER_OP;
-    break;
-  }
-  egg_snprintf(s, sizeof s, "%d", chan);
-  check_bind(BT_chjn, s, &fr, bot, nick, chan, t, sock, host);
-}
-
-void check_chpt(const char *bot, const char *hand, int sock, int chan)
-{
-  char  v[11];
-
-  egg_snprintf(v, sizeof v, "%d", chan);
-  check_bind(BT_chpt, v, NULL, bot, hand, sock, chan);
-}
-
-void check_away(const char *bot, int idx, const char *msg)
-{
-  check_bind(BT_away, bot, NULL, bot, idx, msg);
-}
-
 void add_builtins(const char *table_name, cmd_t *cmds)
 {
 	char name[50];

+ 0 - 21
src/tclhash.h

@@ -65,27 +65,6 @@ typedef struct bind_table_b {
 
 void kill_binds(void);
 
-
-void check_dcc(const char *, int, const char *);
-void check_chjn(const char *, const char *, int, char, int, const char *);
-void check_chpt(const char *, const char *, int, int);
-void check_bot(const char *, const char *, const char *);
-void check_link(const char *, const char *);
-void check_disc(const char *);
-int check_note(const char *, const char *, const char *);
-void check_listen(const char *, int);
-void check_time(struct tm *);
-void tell_binds(int, char *);
-void check_nkch(const char *, const char *);
-void check_away(const char *, int, const char *);
-
-int check_chat(char *, int, const char *);
-void check_act(const char *, int, const char *);
-void check_bcst(const char *, int, const char *);
-void check_chon(char *, int);
-void check_chof(char *, int);
-
-
 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);

+ 2 - 1
src/userrec.c

@@ -12,6 +12,7 @@
 #include "chan.h"
 #include "modules.h"
 #include "tandem.h"
+#include "core_binds.h"
 
 extern struct dcc_t	*dcc;
 extern struct chanset_t	*chanset;
@@ -451,7 +452,7 @@ int change_handle(struct userrec *u, char *newh)
   /* Nothing that will confuse the userfile */
   if (!newh[1] && strchr(BADHANDCHARS, newh[0]))
     return 0;
-  check_nkch(u->handle, newh);
+  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);