[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Tue Oct 16 19:20:02 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-10-17 00:19:28 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     src/modules.c src/tclhash.c src/tclhash.h src/mod/module.h
     src/mod/filesys.mod/filesys.c src/mod/notes.mod/notes.c
     src/mod/server.mod/server.h src/mod/transfer.mod/transfer.c

Log message:

Moved load and unload bind tables to modules.c.
Removed old ctcp table.

---------------------- diff included ----------------------
Index: eggdrop1.7/src/mod/filesys.mod/filesys.c
diff -u eggdrop1.7/src/mod/filesys.mod/filesys.c:1.55 eggdrop1.7/src/mod/filesys.mod/filesys.c:1.56
--- eggdrop1.7/src/mod/filesys.mod/filesys.c:1.55	Sat Oct 13 07:00:22 2001
+++ eggdrop1.7/src/mod/filesys.mod/filesys.c	Tue Oct 16 19:19:17 2001
@@ -2,7 +2,7 @@
  * filesys.c -- part of filesys.mod
  *   main file of the filesys eggdrop module
  *
- * $Id: filesys.c,v 1.55 2001/10/13 12:00:22 stdarg Exp $
+ * $Id: filesys.c,v 1.56 2001/10/17 00:19:17 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -58,7 +58,7 @@
 #define start filesys_LTX_start
 
 static p_tcl_bind_list H_fil;
-static bind_table_t *BT_dcc;
+static bind_table_t *BT_dcc, *BT_load;
 static Function *transfer_funcs = NULL;
 
 /* fcntl.h sets this :/ */
@@ -875,10 +875,10 @@
 
 static void init_server_ctcps(char *module)
 {
-  p_tcl_bind_list H_ctcp;
+  bind_table_t *BT_ctcp;
 
-  if ((H_ctcp = find_bind_table("ctcp")))
-    add_builtins(H_ctcp, myctcp);
+  if (BT_ctcp = find_bind_table2("ctcp"))
+    add_builtins2(BT_ctcp, myctcp);
 }
 
 static cmd_t myload[] =
@@ -908,7 +908,7 @@
 static char *filesys_close()
 {
   int i;
-  p_tcl_bind_list H_ctcp;
+  bind_table_t *BT_ctcp;
 
   putlog(LOG_MISC, "*", "Unloading filesystem, killing all filesystem connections..");
   for (i = 0; i < dcc_total; i++)
@@ -926,11 +926,11 @@
   rem_tcl_strings(mystrings);
   rem_tcl_ints(myints);
   if (BT_dcc) rem_builtins2(BT_dcc, mydcc);
-  rem_builtins(H_load, myload);
+  if (BT_load) rem_builtins2(BT_load, myload);
   rem_builtins(H_fil, myfiles);
   rem_help_reference("filesys.help");
-  if ((H_ctcp = find_bind_table("ctcp")))
-    rem_builtins(H_ctcp, myctcp);
+  if (BT_ctcp = find_bind_table2("ctcp"))
+    rem_builtins2(BT_ctcp, myctcp);
   del_bind_table(H_fil);
   del_entry_type(&USERENTRY_DCCDIR);
   module_undepend(MODULE_NAME);
@@ -973,9 +973,10 @@
   add_tcl_ints(myints);
   H_fil = add_bind_table("fil", 0, builtin_fil);
   BT_dcc = find_bind_table2("dcc");
+  BT_load = find_bind_table2("load");
   if (BT_dcc) add_builtins2(BT_dcc, mydcc);
+  if (BT_load) add_builtins2(BT_load, myload);
   add_builtins(H_fil, myfiles);
-  add_builtins(H_load, myload);
   add_help_reference("filesys.help");
   init_server_ctcps(0);
   memcpy(&USERENTRY_DCCDIR, &USERENTRY_INFO,
Index: eggdrop1.7/src/mod/module.h
diff -u eggdrop1.7/src/mod/module.h:1.66 eggdrop1.7/src/mod/module.h:1.67
--- eggdrop1.7/src/mod/module.h:1.66	Sun Oct 14 18:13:33 2001
+++ eggdrop1.7/src/mod/module.h	Tue Oct 16 19:19:17 2001
@@ -1,7 +1,7 @@
 /*
  * module.h
  *
- * $Id: module.h,v 1.66 2001/10/14 23:13:33 stdarg Exp $
+ * $Id: module.h,v 1.67 2001/10/17 00:19:17 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -304,8 +304,8 @@
 /* 176 - 179 */
 #define H_chon (*(p_tcl_bind_list *)(global[176]))
 #define H_chof (*(p_tcl_bind_list *)(global[177]))
-#define H_load (*(p_tcl_bind_list *)(global[178]))
-#define H_unld (*(p_tcl_bind_list *)(global[179]))
+/*#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]))
Index: eggdrop1.7/src/mod/notes.mod/notes.c
diff -u eggdrop1.7/src/mod/notes.mod/notes.c:1.38 eggdrop1.7/src/mod/notes.mod/notes.c:1.39
--- eggdrop1.7/src/mod/notes.mod/notes.c:1.38	Thu Oct 11 08:01:36 2001
+++ eggdrop1.7/src/mod/notes.mod/notes.c	Tue Oct 16 19:19:17 2001
@@ -5,7 +5,7 @@
  *   note cmds
  *   note ignores
  *
- * $Id: notes.c,v 1.38 2001/10/11 13:01:36 tothwolf Exp $
+ * $Id: notes.c,v 1.39 2001/10/17 00:19:17 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -47,7 +47,7 @@
 				   drummer */
 static Function *global = NULL;	/* DAMN fcntl.h */
 
-static bind_table_t *BT_dcc;
+static bind_table_t *BT_dcc, *BT_load;
 
 static struct user_entry_type USERENTRY_FWD =
 {
@@ -1178,7 +1178,7 @@
   rem_builtins(H_chon, notes_chon);
   rem_builtins(H_away, notes_away);
   rem_builtins(H_nkch, notes_nkch);
-  rem_builtins(H_load, notes_load);
+  if (BT_load) rem_builtins2(BT_load, notes_load);
   rem_help_reference("notes.help");
   del_hook(HOOK_MATCH_NOTEREJ, (Function) match_note_ignore);
   del_hook(HOOK_HOURLY, (Function) notes_hourly);
@@ -1226,12 +1226,13 @@
   add_tcl_commands(notes_tcls);
 
   BT_dcc = find_bind_table2("dcc");
+  BT_load = find_bind_table2("load");
   if (BT_dcc) add_builtins2(BT_dcc, notes_cmds);
+  if (BT_load) add_builtins2(BT_load, notes_load);
 
   add_builtins(H_chon, notes_chon);
   add_builtins(H_away, notes_away);
   add_builtins(H_nkch, notes_nkch);
-  add_builtins(H_load, notes_load);
   add_help_reference("notes.help");
   notes_server_setup(0);
   notes_irc_setup(0);
Index: eggdrop1.7/src/mod/server.mod/server.h
diff -u eggdrop1.7/src/mod/server.mod/server.h:1.15 eggdrop1.7/src/mod/server.mod/server.h:1.16
--- eggdrop1.7/src/mod/server.mod/server.h:1.15	Wed Oct 10 05:44:07 2001
+++ eggdrop1.7/src/mod/server.mod/server.h	Tue Oct 16 19:19:17 2001
@@ -1,7 +1,7 @@
 /*
  * server.h -- part of server.mod
  *
- * $Id: server.h,v 1.15 2001/10/10 10:44:07 tothwolf Exp $
+ * $Id: server.h,v 1.16 2001/10/17 00:19:17 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -65,8 +65,8 @@
 /* 31 - 34 */
 #define H_notc (*(p_tcl_bind_list *)(server_funcs[31]))
 #define H_flud (*(p_tcl_bind_list *)(server_funcs[32]))
-#define H_ctcp (*(p_tcl_bind_list *)(server_funcs[33]))
-#define H_ctcr (*(p_tcl_bind_list *)(server_funcs[34]))
+/* #define H_ctcp (*(p_tcl_bind_list *)(server_funcs[33])) */
+/* #define H_ctcr (*(p_tcl_bind_list *)(server_funcs[34])) */
 /* 35 - 38 */
 #define ctcp_reply ((char *)(server_funcs[35]))
 #define get_altbotnick ((char *(*)(void))(server_funcs[36]))
Index: eggdrop1.7/src/mod/transfer.mod/transfer.c
diff -u eggdrop1.7/src/mod/transfer.mod/transfer.c:1.48 eggdrop1.7/src/mod/transfer.mod/transfer.c:1.49
--- eggdrop1.7/src/mod/transfer.mod/transfer.c:1.48	Thu Oct 11 13:24:03 2001
+++ eggdrop1.7/src/mod/transfer.mod/transfer.c	Tue Oct 16 19:19:17 2001
@@ -1,7 +1,7 @@
 /*
  * transfer.c -- part of transfer.mod
  *
- * $Id: transfer.c,v 1.48 2001/10/11 18:24:03 tothwolf Exp $
+ * $Id: transfer.c,v 1.49 2001/10/17 00:19:17 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -54,6 +54,8 @@
 static int quiet_reject;        /* Quietly reject dcc chat or sends from
                                    users without access? */
 
+static bind_table_t *BT_load;
+
 /*
  * Prototypes
  */
@@ -1826,10 +1828,10 @@
 /* Add our CTCP bindings if the server module is loaded. */
 static int server_transfer_setup(char *mod)
 {
-  p_tcl_bind_list H_ctcp;
+  bind_table_t *BT_ctcp;
 
-  if ((H_ctcp = find_bind_table("ctcp")))
-    add_builtins(H_ctcp, transfer_ctcps);
+  if (BT_ctcp = find_bind_table2("ctcp"))
+    add_builtins2(BT_ctcp, transfer_ctcps);
   return 1;
 }
 
@@ -1846,7 +1848,7 @@
 static char *transfer_close()
 {
   int i;
-  p_tcl_bind_list H_ctcp;
+  bind_table_t *BT_ctcp;
 
   putlog(LOG_MISC, "*", "Unloading transfer module, killing all transfer connections...");
   for (i = dcc_total - 1; i >= 0; i--) {
@@ -1864,10 +1866,10 @@
   del_bind_table(H_sent);
   del_bind_table(H_lost);
   del_bind_table(H_tout);
-  rem_builtins(H_load, transfer_load);
+  if (BT_load) rem_builtins2(BT_load, transfer_load);
   /* Try to remove our CTCP bindings */
-  if ((H_ctcp = find_bind_table("ctcp")))
-    rem_builtins(H_ctcp, transfer_ctcps);
+  if (BT_ctcp = find_bind_table2("ctcp"))
+    rem_builtins2(BT_ctcp, transfer_ctcps);
   rem_tcl_commands(mytcls);
   rem_tcl_ints(myints);
   rem_help_reference("transfer.help");
@@ -1925,9 +1927,11 @@
     return "This module requires eggdrop1.7.0 or later";
   }
 
+  BT_load = find_bind_table2("load");
+  if (BT_load) add_builtins2(BT_load, transfer_load);
+
   add_tcl_commands(mytcls);
   add_tcl_ints(myints);
-  add_builtins(H_load, transfer_load);
   server_transfer_setup(NULL);
   add_help_reference("transfer.help");
   H_rcvd = add_bind_table("rcvd", HT_STACKABLE, builtin_sentrcvd);
Index: eggdrop1.7/src/modules.c
diff -u eggdrop1.7/src/modules.c:1.73 eggdrop1.7/src/modules.c:1.74
--- eggdrop1.7/src/modules.c:1.73	Mon Oct 15 02:56:41 2001
+++ eggdrop1.7/src/modules.c	Tue Oct 16 19:19:16 2001
@@ -4,7 +4,7 @@
  * 
  * by Darrin Smith (beldin at light.iinet.net.au)
  * 
- * $Id: modules.c,v 1.73 2001/10/15 07:56:41 tothwolf Exp $
+ * $Id: modules.c,v 1.74 2001/10/17 00:19:16 stdarg Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -362,8 +362,8 @@
   /* 176 - 179 */
   (Function) & H_chon,		/* p_tcl_bind_list *			*/
   (Function) & H_chof,		/* p_tcl_bind_list *			*/
-  (Function) & H_load,		/* p_tcl_bind_list *			*/
-  (Function) & H_unld,		/* p_tcl_bind_list *			*/
+  (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 *			*/
@@ -507,11 +507,16 @@
   (Function) registry_add_simple_chains
 };
 
+static bind_table_t *BT_load, *BT_unload;
+
 void init_modules(void)
 {
   int i;
   char wbuf[1024];
 
+  BT_load = add_bind_table2("load", 1, "s", MATCH_MASK, 0);
+  BT_unload = add_bind_table2("unload", 1, "s", MATCH_MASK, 0);
+
   module_list = malloc(sizeof(module_entry));
   malloc_strcpy(module_list->name, "eggdrop");
   module_list->major = (egg_numver) / 10000;
@@ -595,7 +600,7 @@
     free(p);
     return e;
   }
-  check_tcl_load(name);
+  check_bind(BT_load, name, NULL, name);
   putlog(LOG_MISC, "*", _("Module loaded: %-16s"), name);
   return NULL;
 }
@@ -618,7 +623,7 @@
       if (f && !f[MODCALL_CLOSE])
 	return _("No close function");
       if (f) {
-	check_tcl_unld(name);
+	check_bind(BT_unload, name, NULL, name);
 	e = (((char *(*)()) f[MODCALL_CLOSE]) (user));
 	if (e != NULL)
 	  return e;
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.46 eggdrop1.7/src/tclhash.c:1.47
--- eggdrop1.7/src/tclhash.c:1.46	Mon Oct 15 21:42:33 2001
+++ eggdrop1.7/src/tclhash.c	Tue Oct 16 19:19:16 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.46 2001/10/16 02:42:33 stdarg Exp $
+ * $Id: tclhash.c,v 1.47 2001/10/17 00:19:16 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -49,7 +49,7 @@
 
 p_tcl_bind_list		bind_table_list;
 p_tcl_bind_list		H_chat, H_act, H_bcst, H_chon, H_chof,
-			H_load, H_unld, H_link, H_disc, H_chjn, H_chpt,
+			H_link, H_disc, H_chjn, H_chpt,
 			H_bot, H_time, H_nkch, H_away, H_note, H_filt;
 
 static int builtin_2char();
@@ -175,10 +175,8 @@
 {
   bind_table_list = NULL;
   Context;
-  H_unld = add_bind_table("unld", HT_STACKABLE, builtin_char);
   H_note = add_bind_table("note", 0, builtin_3char);
   H_nkch = add_bind_table("nkch", HT_STACKABLE, builtin_2char);
-  H_load = add_bind_table("load", HT_STACKABLE, builtin_char);
   H_link = add_bind_table("link", HT_STACKABLE, builtin_2char);
   H_filt = add_bind_table("filt", HT_STACKABLE, builtin_idxchar);
   H_disc = add_bind_table("disc", HT_STACKABLE, builtin_char);
@@ -724,33 +722,6 @@
   return TCL_OK;
 }
 
-static int builtin_dcc STDVAR
-{
-  int idx;
-  Function F = (Function) cd;
-
-  BADARGS(4, 4, " hand idx param");
-  idx = findidx(atoi(argv[2]));
-  if (idx < 0) {
-    Tcl_AppendResult(irp, "invalid idx", NULL);
-    return TCL_ERROR;
-  }
-  if (F == NULL) {
-    Tcl_AppendResult(irp, "break", NULL);
-    return TCL_OK;
-  }
-  /* Check if it's a password change, if so, don't show the password. We
-   * don't need pretty formats here, as it's only for debugging purposes.
-   */
-  debug4("tcl: builtin dcc call: %s %s %s %s", argv[0], argv[1], argv[2],
-	 (!strcmp(argv[0] + 5, "newpass") ||
-	  !strcmp(argv[0] + 5, "chpass")) ? "[something]" : argv[3]);
-  (F) (dcc[idx].user, idx, argv[3]);
-  Tcl_ResetResult(irp);
-  Tcl_AppendResult(irp, "0", NULL);
-  return TCL_OK;
-}
-
 /* trigger (execute) a proc */
 static int trigger_bind(const char *proc, const char *param)
 {
@@ -1076,12 +1047,6 @@
 
   Tcl_SetVar(interp, "_disc1", (char *) bot, 0);
   check_tcl_bind(H_disc, bot, 0, " $_disc1", MATCH_MASK | BIND_STACKABLE);
-}
-
-void check_tcl_loadunld(const char *mod, tcl_bind_list_t *tl)
-{
-  Tcl_SetVar(interp, "_lu1", (char *) mod, 0);
-  check_tcl_bind(tl, mod, 0, " $_lu1", MATCH_MASK | BIND_STACKABLE);
 }
 
 const char *check_tcl_filt(int idx, const char *text)
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.20 eggdrop1.7/src/tclhash.h:1.21
--- eggdrop1.7/src/tclhash.h:1.20	Sun Oct 14 18:13:33 2001
+++ eggdrop1.7/src/tclhash.h	Tue Oct 16 19:19:16 2001
@@ -1,7 +1,7 @@
 /*
  * tclhash.h
  *
- * $Id: tclhash.h,v 1.20 2001/10/14 23:13:33 stdarg Exp $
+ * $Id: tclhash.h,v 1.21 2001/10/17 00:19:16 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -166,15 +166,12 @@
 #define check_tcl_chof(a, b) check_tcl_chonof(a, b, H_chof)
 void check_tcl_loadunld(const char *, tcl_bind_list_t *);
 
-#define check_tcl_load(a) check_tcl_loadunld(a, H_load)
-#define check_tcl_unld(a) check_tcl_loadunld(a, H_unld)
-
 void rem_builtins(tcl_bind_list_t *, cmd_t *);
 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_load, H_unld, H_bot, H_link;
+extern p_tcl_bind_list H_bot, H_link;
 extern p_tcl_bind_list H_away, H_nkch, H_filt, H_disc;
 
 int check_bind(bind_table_t *table, const char *match, struct flag_record *_flags, ...);
----------------------- End of diff -----------------------



More information about the Changes mailing list