[cvslog] Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sun Oct 14 18:14:00 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2001-10-14 23:13:44 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     src/Makefile.am src/main.c src/modules.c src/tclhash.c
     src/tclhash.h src/tclmisc.c src/mod/module.h
     src/mod/server.mod/server.c src/mod/server.mod/servmsg.c
     src/mod/tclscript.mod/tclscript.c

Added files:
     src/core_binds.c src/core_binds.h src/script.h

Log message:

Updates to binds (event and time).
New file to handle core binds.

---------------------- diff included ----------------------
Index: eggdrop1.7/src/Makefile.am
diff -u eggdrop1.7/src/Makefile.am:1.9 eggdrop1.7/src/Makefile.am:1.10
--- eggdrop1.7/src/Makefile.am:1.9	Sun Oct 14 05:22:50 2001
+++ eggdrop1.7/src/Makefile.am	Sun Oct 14 18:13:33 2001
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.9 2001/10/14 10:22:50 tothwolf Exp $
+# $Id: Makefile.am,v 1.10 2001/10/14 23:13:33 stdarg Exp $
 
 # FIXME: optionally allow a system wide install by ignoring the line below.
 bindir    = $(exec_prefix)
@@ -28,6 +28,8 @@
 		chanprog.c \
 		cmds.c \
 		cmdt.h \
+		core_binds.c \
+		core_binds.h \
 		dcc.c \
 		dccutil.c \
 		debug.h \
Index: eggdrop1.7/src/core_binds.c
diff -u /dev/null eggdrop1.7/src/core_binds.c:1.1
--- /dev/null	Sun Oct 14 18:13:44 2001
+++ eggdrop1.7/src/core_binds.c	Sun Oct 14 18:13:33 2001
@@ -0,0 +1,21 @@
+#include "main.h"
+
+static bind_table_t *BT_time, *BT_event;
+
+void core_binds_init()
+{
+	BT_time = add_bind_table2("time", 5, "iiiii", MATCH_MASK, BIND_STACKABLE);
+	BT_event = add_bind_table2("event", 1, "s", MATCH_MASK, BIND_STACKABLE);
+}
+
+void check_bind_time(struct tm *tm)
+{
+	char full[32];
+	snprintf(full, sizeof(full), "%02d %02d %02d %02d %04d", tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
+	check_bind(BT_time, full, NULL, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
+}
+
+void check_bind_event(char *event)
+{
+	check_bind(BT_event, event, NULL, event);
+}
Index: eggdrop1.7/src/core_binds.h
diff -u /dev/null eggdrop1.7/src/core_binds.h:1.1
--- /dev/null	Sun Oct 14 18:13:44 2001
+++ eggdrop1.7/src/core_binds.h	Sun Oct 14 18:13:33 2001
@@ -0,0 +1,8 @@
+#ifndef _CORE_BINDS_H_
+#define _CORE_BINDS_H_
+
+void core_binds_init();
+void check_bind_time(struct tm *tm);
+void check_bind_event(char *event);
+
+#endif
Index: eggdrop1.7/src/main.c
diff -u eggdrop1.7/src/main.c:1.84 eggdrop1.7/src/main.c:1.85
--- eggdrop1.7/src/main.c:1.84	Sun Oct 14 09:09:35 2001
+++ eggdrop1.7/src/main.c	Sun Oct 14 18:13:33 2001
@@ -5,7 +5,7 @@
  *   command line arguments
  *   context and assert debugging
  *
- * $Id: main.c,v 1.84 2001/10/14 14:09:35 ite Exp $
+ * $Id: main.c,v 1.85 2001/10/14 23:13:33 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -54,6 +54,7 @@
 #include "tandem.h"
 #include "bg.h"
 #include "egg_timer.h"
+#include "core_binds.h"
 
 #include "adns/adns.h"
 
@@ -330,7 +331,7 @@
 static void got_term(int z)
 {
   write_userfile(-1);
-  check_tcl_event("sigterm");
+  check_bind_event("sigterm");
   if (die_on_sigterm) {
     fatal("TERMINATE SIGNAL -- SIGNING OFF", 0);
   } else {
@@ -340,7 +341,7 @@
 
 static void got_quit(int z)
 {
-  check_tcl_event("sigquit");
+  check_bind_event("sigquit");
   putlog(LOG_MISC, "*", "RECEIVED QUIT SIGNAL (IGNORING)");
   return;
 }
@@ -348,7 +349,7 @@
 static void got_hup(int z)
 {
   write_userfile(-1);
-  check_tcl_event("sighup");
+  check_bind_event("sighup");
   if (die_on_sighup) {
     fatal("HANGUP SIGNAL -- SIGNING OFF", 0);
   } else
@@ -370,7 +371,7 @@
  */
 static void got_ill(int z)
 {
-  check_tcl_event("sigill");
+  check_bind_event("sigill");
 #ifdef DEBUG_CONTEXT
   putlog(LOG_MISC, "*", "* Context: %s/%d [%s]", cx_file[cx_ptr],
 	 cx_line[cx_ptr], (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
@@ -569,8 +570,7 @@
 
 static void core_minutely()
 {
-  check_tcl_time(&nowtm);
-  do_check_timers(&timer);
+  check_bind_time(&nowtm);
   if (quick_logs != 0) {
     flushlogs();
     check_logsize();
@@ -584,22 +584,22 @@
 
 static void event_rehash()
 {
-  check_tcl_event("rehash");
+  check_bind_event("rehash");
 }
 
 static void event_prerehash()
 {
-  check_tcl_event("prerehash");
+  check_bind_event("prerehash");
 }
 
 static void event_save()
 {
-  check_tcl_event("save");
+  check_bind_event("save");
 }
 
 static void event_logfile()
 {
-  check_tcl_event("logfile");
+  check_bind_event("logfile");
 }
 
 static void event_resettraffic()
@@ -623,7 +623,7 @@
 
 static void event_loaded()
 {
-  check_tcl_event("loaded");
+  check_bind_event("loaded");
 }
 
 void kill_tcl();
@@ -634,7 +634,7 @@
  init_modules(), init_tcl(int, char **);
 void botnet_init();
 void script_init();
-void init_binds();
+void binds_init();
 
 void patch(const char *str)
 {
@@ -751,7 +751,8 @@
     fatal(_("ERROR: Eggdrop will not run as root!"), 0);
 
   script_init();
-  init_binds();
+  binds_init();
+  core_binds_init();
   init_dcc_max();
   init_userent();
   init_misc();
@@ -1005,7 +1006,7 @@
 	char xx[256];
 
  	/* oops, I guess we should call this event before tcl is restarted */
-	check_tcl_event("prerestart");
+	check_bind_event("prerestart");
 
 	while (f) {
 	  f = 0;
Index: eggdrop1.7/src/mod/module.h
diff -u eggdrop1.7/src/mod/module.h:1.65 eggdrop1.7/src/mod/module.h:1.66
--- eggdrop1.7/src/mod/module.h:1.65	Sat Oct 13 23:44:37 2001
+++ eggdrop1.7/src/mod/module.h	Sun Oct 14 18:13:33 2001
@@ -1,7 +1,7 @@
 /*
  * module.h
  *
- * $Id: module.h,v 1.65 2001/10/14 04:44:37 stdarg Exp $
+ * $Id: module.h,v 1.66 2001/10/14 23:13:33 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -192,7 +192,7 @@
 /* 86: get_data_ptr -- UNUSED (Tothwolf) */
 #define open_telnet ((int (*) (char *, int))global[87])
 /* 88 - 91 */
-#define check_tcl_event ((void * (*) (const char *))global[88])
+#define check_bind_event ((void * (*) (const char *))global[88])
 /* 89: my_memcpy / egg_memcpy -- UNUSED (Tothwolf) */
 #define my_atoul ((IP(*)(char *))global[90])
 #define my_strcpy ((int (*)(char *, const char *))global[91])
@@ -362,7 +362,7 @@
 #define ginvite_total (*(int*)global[222])
 #define gexempt_total (*(int*)global[223])
 /* 224 - 227 */
-#define H_event (*(p_tcl_bind_list *)(global[224]))
+/* 224: H_event -- UNUSED (stdarg) */
 #define use_exempts (*(int *)(global[225]))	/* drummer/Jason */
 #define use_invites (*(int *)(global[226]))	/* drummer/Jason */
 #define force_expire (*(int *)(global[227]))	/* Rufus */
Index: eggdrop1.7/src/mod/server.mod/server.c
diff -u eggdrop1.7/src/mod/server.mod/server.c:1.88 eggdrop1.7/src/mod/server.mod/server.c:1.89
--- eggdrop1.7/src/mod/server.mod/server.c:1.88	Sat Oct 13 10:55:34 2001
+++ eggdrop1.7/src/mod/server.mod/server.c	Sun Oct 14 18:13:33 2001
@@ -2,7 +2,7 @@
  * server.c -- part of server.mod
  *   basic irc server support
  *
- * $Id: server.c,v 1.88 2001/10/13 15:55:34 tothwolf Exp $
+ * $Id: server.c,v 1.89 2001/10/14 23:13:33 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1389,7 +1389,7 @@
   /* Change botname back incase we were using altnick previous to rehash. */
   else if (oldnick[0])
     strcpy(botname, oldnick);
-  check_tcl_event("init-server");
+  check_bind_event("init-server");
 }
 
 static void server_die()
Index: eggdrop1.7/src/mod/server.mod/servmsg.c
diff -u eggdrop1.7/src/mod/server.mod/servmsg.c:1.75 eggdrop1.7/src/mod/server.mod/servmsg.c:1.76
--- eggdrop1.7/src/mod/server.mod/servmsg.c:1.75	Sun Oct 14 05:55:24 2001
+++ eggdrop1.7/src/mod/server.mod/servmsg.c	Sun Oct 14 18:13:33 2001
@@ -1,7 +1,7 @@
 /*
  * servmsg.c -- part of server.mod
  *
- * $Id: servmsg.c,v 1.75 2001/10/14 10:55:24 tothwolf Exp $
+ * $Id: servmsg.c,v 1.76 2001/10/14 23:13:33 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -188,7 +188,7 @@
   strncpyz(botname, msg, NICKLEN);
   altnick_char = 0;
   dprintf(DP_SERVER, "WHOIS %s\n", botname); /* get user at host */
-  check_tcl_event("init-server");
+  check_bind_event("init-server");
   x = serverlist;
   if (x == NULL)
     return 0;			/* Uh, no server list */
@@ -869,7 +869,7 @@
 static void disconnect_server(int idx)
 {
   if (server_online > 0)
-    check_tcl_event("disconnect-server");
+    check_bind_event("disconnect-server");
   server_online = 0;
   if (dcc[idx].sock >= 0)
     killsock(dcc[idx].sock);
@@ -1103,7 +1103,7 @@
       return;
     }
 
-    check_tcl_event("connect-server");
+    check_bind_event("connect-server");
     next_server(&curserv, botserver, &botserverport, pass);
     putlog(LOG_SERV, "*", "%s %s %d", _("Trying server"), botserver, botserverport);
 
Index: eggdrop1.7/src/mod/tclscript.mod/tclscript.c
diff -u eggdrop1.7/src/mod/tclscript.mod/tclscript.c:1.2 eggdrop1.7/src/mod/tclscript.mod/tclscript.c:1.3
--- eggdrop1.7/src/mod/tclscript.mod/tclscript.c:1.2	Sun Oct 14 11:59:31 2001
+++ eggdrop1.7/src/mod/tclscript.mod/tclscript.c	Sun Oct 14 18:13:34 2001
@@ -146,7 +146,6 @@
 	char *cmdname;
 
 	cmdname = msprintf("%s_%s", info->class, info->name);
-	printf("Creating %s\n", cmdname);
 	Tcl_CreateObjCommand(interp, cmdname, my_command_handler, (ClientData) info, NULL);
 	free(cmdname);
 
Index: eggdrop1.7/src/modules.c
diff -u eggdrop1.7/src/modules.c:1.71 eggdrop1.7/src/modules.c:1.72
--- eggdrop1.7/src/modules.c:1.71	Sun Oct 14 18:06:30 2001
+++ eggdrop1.7/src/modules.c	Sun Oct 14 18:13:33 2001
@@ -4,7 +4,7 @@
  * 
  * by Darrin Smith (beldin at light.iinet.net.au)
  * 
- * $Id: modules.c,v 1.71 2001/10/14 23:06:30 ite Exp $
+ * $Id: modules.c,v 1.72 2001/10/14 23:13:33 stdarg Exp $
  */
 /* 
  * Copyright (C) 1997  Robey Pointer
@@ -29,6 +29,7 @@
 #include "modules.h"
 #include "tandem.h"
 #include "registry.h"
+#include "core_binds.h"
 #include <ctype.h>
 
 #include <ltdl.h>
@@ -251,7 +252,7 @@
   (Function) 0,
   (Function) open_telnet,
   /* 88 - 91 */
-  (Function) check_tcl_event,
+  (Function) check_bind_event,
   (Function) 0,
   (Function) my_atoul,
   (Function) my_strcpy,
@@ -421,7 +422,7 @@
   (Function) & gexempt_total,	/* int					*/
   (Function) & ginvite_total,	/* int					*/
   /* 224 - 227 */
-  (Function) & H_event,		/* p_tcl_bind_list *			*/
+  (Function) 0,			/* p_tcl_bind_list *			*/
   (Function) & use_exempts,	/* int					*/
   (Function) & use_invites,	/* int					*/
   (Function) & force_expire,	/* int					*/
Index: eggdrop1.7/src/script.h
diff -u /dev/null eggdrop1.7/src/script.h:1.1
--- /dev/null	Sun Oct 14 18:13:44 2001
+++ eggdrop1.7/src/script.h	Sun Oct 14 18:13:33 2001
@@ -0,0 +1,12 @@
+#ifndef _SCRIPT_HELPER_H_
+#define _SCRIPT_HELPER_H_
+
+int script_link_int_table(script_int_t *table);
+int script_unlink_int_table(script_int_t *table);
+int script_link_str_table(script_str_t *table);
+int script_unlink_str_table(script_str_t *table);
+int script_create_cmd_table(script_command_t *table);
+int script_delete_cmd_table(script_command_t *table);
+int script_create_simple_cmd_table(script_simple_command_t *table);
+
+#endif /* _SCRIPT_H_ */
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.44 eggdrop1.7/src/tclhash.c:1.45
--- eggdrop1.7/src/tclhash.c:1.44	Fri Oct 12 10:50:26 2001
+++ eggdrop1.7/src/tclhash.c	Sun Oct 14 18:13:33 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.44 2001/10/12 15:50:26 tothwolf Exp $
+ * $Id: tclhash.c,v 1.45 2001/10/14 23:13:33 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -38,19 +38,17 @@
 extern int		 dcc_total;
 extern time_t		 now;
 
-/* New bind table list */
+/* New bind table list. */
 static bind_table_t *bind_table_list_head = NULL;
-static bind_table_t *BT_event;
 static bind_table_t *BT_link;
 static bind_table_t *BT_disc;
 static bind_table_t *BT_away;
-static bind_table_t *BT_time;
 static bind_table_t *BT_dcc;
 
 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_bot, H_time, H_nkch, H_away, H_note, H_filt, H_event;
+			H_bot, H_time, H_nkch, H_away, H_note, H_filt;
 
 static int builtin_2char();
 static int builtin_3char();
@@ -154,14 +152,12 @@
 static int tcl_bind2();
 static int tcl_unbind2();
 
-void init_binds(void)
+void binds_init(void)
 {
 	bind_table_list_head = NULL;
-	BT_event = add_bind_table2("event", 1, "s", MATCH_MASK, BIND_STACKABLE);
 	BT_link = add_bind_table2("link", 2, "ss", MATCH_MASK, BIND_STACKABLE);
 	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, "Uis", MATCH_MASK, BIND_USE_ATTR);
 	add_builtins2(BT_dcc, C_dcc);
 }
@@ -173,7 +169,6 @@
   Tcl_CreateCommand(interp, "bind", tcl_bind, (ClientData) 0, NULL);
   Tcl_CreateCommand(interp, "unbind", tcl_bind, (ClientData) 1, NULL);
   H_unld = add_bind_table("unld", HT_STACKABLE, builtin_char);
-  H_time = add_bind_table("time", HT_STACKABLE, builtin_5int);
   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);
@@ -189,7 +184,6 @@
   H_bcst = add_bind_table("bcst", HT_STACKABLE, builtin_chat);
   H_away = add_bind_table("away", HT_STACKABLE, builtin_chat);
   H_act = add_bind_table("act", HT_STACKABLE, builtin_chat);
-  H_event = add_bind_table("evnt", HT_STACKABLE, builtin_char);
   Context;
 }
 
@@ -1288,38 +1282,6 @@
   Tcl_SetVar(interp, "_away3", msg ? (char *) msg : "", 0);
   check_tcl_bind(H_away, bot, 0, " $_away1 $_away2 $_away3",
 		 MATCH_MASK | BIND_STACKABLE);
-}
-
-void check_tcl_time(struct tm *tm)
-{
-  char y[18];
-
-  egg_snprintf(y, sizeof y, "%02d", tm->tm_min);
-  Tcl_SetVar(interp, "_time1", (char *) y, 0);
-  egg_snprintf(y, sizeof y, "%02d", tm->tm_hour);
-  Tcl_SetVar(interp, "_time2", (char *) y, 0);
-  egg_snprintf(y, sizeof y, "%02d", tm->tm_mday);
-  Tcl_SetVar(interp, "_time3", (char *) y, 0);
-  egg_snprintf(y, sizeof y, "%02d", tm->tm_mon);
-  Tcl_SetVar(interp, "_time4", (char *) y, 0);
-  egg_snprintf(y, sizeof y, "%04d", tm->tm_year + 1900);
-  Tcl_SetVar(interp, "_time5", (char *) y, 0);
-  egg_snprintf(y, sizeof y, "%02d %02d %02d %02d %04d", tm->tm_min, tm->tm_hour,
-	       tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
-
-  check_bind(BT_time, y, NULL, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
-
-  check_tcl_bind(H_time, y, 0,
-		 " $_time1 $_time2 $_time3 $_time4 $_time5",
-		 MATCH_MASK | BIND_STACKABLE);
-}
-
-void check_tcl_event(const char *event)
-{
-  check_bind(BT_event, event, NULL, event);
-
-  Tcl_SetVar(interp, "_event1", (char *) event, 0);
-  check_tcl_bind(H_event, event, 0, " $_event1", MATCH_EXACT | BIND_STACKABLE);
 }
 
 void tell_binds(int idx, char *par)
Index: eggdrop1.7/src/tclhash.h
diff -u eggdrop1.7/src/tclhash.h:1.19 eggdrop1.7/src/tclhash.h:1.20
--- eggdrop1.7/src/tclhash.h:1.19	Wed Oct 10 13:37:54 2001
+++ eggdrop1.7/src/tclhash.h	Sun Oct 14 18:13:33 2001
@@ -1,7 +1,7 @@
 /*
  * tclhash.h
  *
- * $Id: tclhash.h,v 1.19 2001/10/10 18:37:54 stdarg Exp $
+ * $Id: tclhash.h,v 1.20 2001/10/14 23:13:33 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -175,7 +175,7 @@
 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_away, H_nkch, H_filt, H_disc, H_event;
+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, ...);
 
Index: eggdrop1.7/src/tclmisc.c
diff -u eggdrop1.7/src/tclmisc.c:1.30 eggdrop1.7/src/tclmisc.c:1.31
--- eggdrop1.7/src/tclmisc.c:1.30	Sat Oct 13 07:00:22 2001
+++ eggdrop1.7/src/tclmisc.c	Sun Oct 14 18:13:33 2001
@@ -3,7 +3,7 @@
  *   Tcl stubs for file system commands
  *   Tcl stubs for everything else
  *
- * $Id: tclmisc.c,v 1.30 2001/10/13 12:00:22 stdarg Exp $
+ * $Id: tclmisc.c,v 1.31 2001/10/14 23:13:33 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -552,7 +552,7 @@
 static int tcl_callevent STDVAR
 {
   BADARGS(2, 2, " event");
-  check_tcl_event(argv[1]);
+  check_bind_event(argv[1]);
   return TCL_OK;
 }
 
----------------------- End of diff -----------------------



More information about the Changes mailing list