[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sat Oct 20 16:58:01 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-10-20 21:57:25 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     src/dcc.c src/modules.c src/tclhash.c src/tclhash.h
     src/mod/module.h

Log message:

* Added Oskar Liljeblad's patch to convert H_chat, H_act, and H_bcst.
* Experimented with changing around the chat bind so it's called before text is sent, and is breakable.

---------------------- diff included ----------------------
Index: eggdrop1.7/src/dcc.c
diff -u eggdrop1.7/src/dcc.c:1.60 eggdrop1.7/src/dcc.c:1.61
--- eggdrop1.7/src/dcc.c:1.60	Thu Oct 18 20:55:05 2001
+++ eggdrop1.7/src/dcc.c	Sat Oct 20 16:57:15 2001
@@ -4,7 +4,7 @@
  *   disconnect on a dcc socket
  *   ...and that's it!  (but it's a LOT)
  *
- * $Id: dcc.c,v 1.60 2001/10/19 01:55:05 tothwolf Exp $
+ * $Id: dcc.c,v 1.61 2001/10/20 21:57:15 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -917,6 +917,11 @@
 	  }
 	}
     } else {
+	int r;
+
+	r = check_tcl_chat(dcc[idx].user, dcc[idx].u.chat->channel, buf);
+	if (r & BIND_RET_BREAK) return;
+
 	if (dcc[idx].u.chat->away != NULL)
 	  not_away(idx);
 	if (dcc[idx].status & STAT_ECHO)
@@ -927,7 +932,6 @@
 		      dcc[idx].nick, buf);
 	botnet_send_chan(-1, botnetnick, dcc[idx].nick,
 			 dcc[idx].u.chat->channel, buf);
-	check_tcl_chat(dcc[idx].nick, dcc[idx].u.chat->channel, buf);
       }
   }
   if (dcc[idx].type == &DCC_CHAT)	/* Could have change to files */
Index: eggdrop1.7/src/mod/module.h
diff -u eggdrop1.7/src/mod/module.h:1.71 eggdrop1.7/src/mod/module.h:1.72
--- eggdrop1.7/src/mod/module.h:1.71	Sat Oct 20 05:22:14 2001
+++ eggdrop1.7/src/mod/module.h	Sat Oct 20 16:57:15 2001
@@ -1,7 +1,7 @@
 /*
  * module.h
  *
- * $Id: module.h,v 1.71 2001/10/20 10:22:14 stdarg Exp $
+ * $Id: module.h,v 1.72 2001/10/20 21:57:15 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -292,9 +292,9 @@
 /*#define H_load (*(p_tcl_bind_list *)(global[178])) */
 /*#define H_unld (*(p_tcl_bind_list *)(global[179])) */
 /* 180 - 183 */
-#define H_chat (*(p_tcl_bind_list *)(global[180]))
-#define H_act (*(p_tcl_bind_list *)(global[181]))
-#define H_bcst (*(p_tcl_bind_list *)(global[182]))
+/* 180: H_chat -- UNUSED (oskar) */
+/* 181: H_act -- UNUSED (oskar) */
+/* 182: H_bcst -- UNUSED (oskar) */
 #define H_bot (*(p_tcl_bind_list *)(global[183]))
 /* 184 - 187 */
 #define H_link (*(p_tcl_bind_list *)(global[184]))
Index: eggdrop1.7/src/modules.c
diff -u eggdrop1.7/src/modules.c:1.79 eggdrop1.7/src/modules.c:1.80
--- eggdrop1.7/src/modules.c:1.79	Sat Oct 20 05:22:13 2001
+++ eggdrop1.7/src/modules.c	Sat Oct 20 16:57:15 2001
@@ -4,7 +4,7 @@
  * 
  * by Darrin Smith (beldin at light.iinet.net.au)
  * 
- * $Id: modules.c,v 1.79 2001/10/20 10:22:13 stdarg Exp $
+ * $Id: modules.c,v 1.80 2001/10/20 21:57:15 stdarg Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -369,9 +369,9 @@
   (Function) 0,		/* p_tcl_bind_list *			*/
   (Function) 0,		/* p_tcl_bind_list *			*/
   /* 180 - 183 */
-  (Function) & H_chat,		/* p_tcl_bind_list *			*/
-  (Function) & H_act,		/* p_tcl_bind_list *			*/
-  (Function) & H_bcst,		/* p_tcl_bind_list *			*/
+  (Function) 0,		/* p_tcl_bind_list *			*/
+  (Function) 0,		/* p_tcl_bind_list *			*/
+  (Function) 0,		/* p_tcl_bind_list *			*/
   (Function) & H_bot,		/* p_tcl_bind_list *			*/
   /* 184 - 187 */
   (Function) & H_link,		/* p_tcl_bind_list *			*/
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.50 eggdrop1.7/src/tclhash.c:1.51
--- eggdrop1.7/src/tclhash.c:1.50	Sat Oct 20 05:22:13 2001
+++ eggdrop1.7/src/tclhash.c	Sat Oct 20 16:57:15 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.50 2001/10/20 10:22:13 stdarg Exp $
+ * $Id: tclhash.c,v 1.51 2001/10/20 21:57:15 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -46,9 +46,12 @@
 static bind_table_t *BT_disc;
 static bind_table_t *BT_away;
 static bind_table_t *BT_dcc;
+static bind_table_t *BT_chat;
+static bind_table_t *BT_act;
+static bind_table_t *BT_bcst;
 
 p_tcl_bind_list		bind_table_list;
-p_tcl_bind_list		H_chat, H_act, H_bcst, H_chon, H_chof,
+p_tcl_bind_list		H_chon, H_chof,
 			H_link, H_disc, H_chjn, H_chpt,
 			H_bot, H_time, H_nkch, H_note, H_filt;
 
@@ -60,7 +63,6 @@
 static int builtin_chjn();
 static int builtin_idxchar();
 static int builtin_charidx();
-static int builtin_chat();
 static int builtin_dcc();
 
 /* Delete trigger/command.
@@ -169,6 +171,9 @@
 	BT_away = add_bind_table2("away", 3, "sis", MATCH_MASK, BIND_STACKABLE);
 	BT_dcc = add_bind_table2("dcc", 3, "Uis", MATCH_MASK, BIND_USE_ATTR);
 	add_builtins2(BT_dcc, C_dcc);
+	BT_chat = add_bind_table2("chat", 3, "Uis", MATCH_MASK, BIND_STACKABLE | BIND_BREAKABLE);
+	BT_act = add_bind_table2("act", 3, "sis", MATCH_MASK, BIND_STACKABLE);
+	BT_bcst = add_bind_table2("bcst", 3, "sis", MATCH_MASK, BIND_STACKABLE);
 }
 
 void init_old_binds(void)
@@ -184,10 +189,7 @@
   H_chon = add_bind_table("chon", HT_STACKABLE, builtin_charidx);
   H_chof = add_bind_table("chof", HT_STACKABLE, builtin_charidx);
   H_chjn = add_bind_table("chjn", HT_STACKABLE, builtin_chjn);
-  H_chat = add_bind_table("chat", HT_STACKABLE, builtin_chat);
   H_bot = add_bind_table("bot", 0, builtin_3char);
-  H_bcst = add_bind_table("bcst", HT_STACKABLE, builtin_chat);
-  H_act = add_bind_table("act", HT_STACKABLE, builtin_chat);
   Context;
 }
 
@@ -688,18 +690,6 @@
   return TCL_OK;
 }
 
-static int builtin_chat STDVAR
-{
-  Function F = (Function) cd;
-  int ch;
-
-  BADARGS(4, 4, " handle idx text");
-  CHECKVALIDITY(builtin_chat);
-  ch = atoi(argv[2]);
-  F(argv[1], ch, argv[3]);
-  return TCL_OK;
-}
-
 /* trigger (execute) a proc */
 static int trigger_bind(const char *proc, const char *param)
 {
@@ -988,17 +978,19 @@
 		 BIND_USE_ATTR | BIND_STACKABLE | BIND_WANTRET);
 }
 
-void check_tcl_chatactbcst(const char *from, int chan, const char *text,
-			   tcl_bind_list_t *tl)
+int check_tcl_chat(struct userrec *u, int chan, const char *text)
 {
-  char s[11];
+  return check_bind(BT_chat, text, NULL, u, chan, text);
+}
 
-  snprintf(s, sizeof s, "%d", chan);
-  Tcl_SetVar(interp, "_cab1", (char *) from, 0);
-  Tcl_SetVar(interp, "_cab2", (char *) s, 0);
-  Tcl_SetVar(interp, "_cab3", (char *) text, 0);
-  check_tcl_bind(tl, text, 0, " $_cab1 $_cab2 $_cab3",
-		 MATCH_MASK | BIND_STACKABLE);
+void check_tcl_act(const char *from, int chan, const char *text)
+{
+  check_bind(BT_act, text, NULL, from, chan, text);
+}
+
+void check_tcl_bcst(const char *from, int chan, const char *text)
+{
+  check_bind(BT_bcst, text, NULL, from, chan, text);
 }
 
 void check_tcl_nkch(const char *ohand, const char *nhand)
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.22 eggdrop1.7/src/tclhash.h:1.23
--- eggdrop1.7/src/tclhash.h:1.22	Sat Oct 20 05:22:13 2001
+++ eggdrop1.7/src/tclhash.h	Sat Oct 20 16:57:15 2001
@@ -1,7 +1,7 @@
 /*
  * tclhash.h
  *
- * $Id: tclhash.h,v 1.22 2001/10/20 10:22:13 stdarg Exp $
+ * $Id: tclhash.h,v 1.23 2001/10/20 21:57:15 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -154,12 +154,11 @@
 void tell_binds(int, char *);
 void check_tcl_nkch(const char *, const char *);
 void check_tcl_away(const char *, int, const char *);
-void check_tcl_chatactbcst(const char *, int, const char *, tcl_bind_list_t *);
 void check_tcl_event(const char *);
 
-#define check_tcl_chat(a, b, c) check_tcl_chatactbcst(a ,b, c, H_chat)
-#define check_tcl_act(a, b, c) check_tcl_chatactbcst(a, b, c, H_act)
-#define check_tcl_bcst(a, b, c) check_tcl_chatactbcst(a, b, c, H_bcst)
+int check_tcl_chat(struct userrec *, int, const char *);
+void check_tcl_act(const char *, int, const char *);
+void check_tcl_bcst(const char *, int, const char *);
 void check_tcl_chonof(char *, int, tcl_bind_list_t *);
 
 #define check_tcl_chon(a, b) check_tcl_chonof(a, b, H_chon)
@@ -170,7 +169,7 @@
 void add_builtins(tcl_bind_list_t *, cmd_t *);
 
 int check_validity(char *, Function);
-extern p_tcl_bind_list H_chat, H_act, H_bcst, H_chon, H_chof;
+extern p_tcl_bind_list H_chon, H_chof;
 extern p_tcl_bind_list H_bot, H_link;
 extern p_tcl_bind_list H_nkch, H_filt, H_disc;
 
----------------------- End of diff -----------------------



More information about the Changes mailing list