Selaa lähdekoodia

* Removal of more tcl code

svn: 604
Bryan Drewery 22 vuotta sitten
vanhempi
commit
44a08a167c

+ 1 - 6
src/main.c

@@ -117,7 +117,6 @@ egg_traffic_t traffic;
 
 void fatal(const char *s, int recoverable)
 {
-  int i;
 #ifdef LEAF
   module_entry *me;
 
@@ -129,13 +128,9 @@ void fatal(const char *s, int recoverable)
   if (s[0])
     putlog(LOG_MISC, "*", "* %s", s);
 /*  flushlogs(); */
-  for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].sock >= 0)
-      killsock(dcc[i].sock);
 #ifdef HAVE_SSL
-      ssl_cleanup();
+    ssl_cleanup();
 #endif /* HAVE_SSL */
-  }
   if (!recoverable) {
     unlink(pid_file);
     exit(1);

+ 2 - 9
src/mod/compress.mod/compress.c

@@ -48,8 +48,8 @@ static Function *global = NULL,
 
 static unsigned int compressed_files;	/* Number of files compressed.      */
 static unsigned int uncompressed_files;	/* Number of files uncompressed.    */
-static unsigned int share_compressed = 1;	/* Compress userfiles when sharing? */
-static unsigned int compress_level = 9;	/* Default compression used.	    */
+static unsigned int share_compressed;	/* Compress userfiles when sharing? */
+static unsigned int compress_level;	/* Default compression used.	    */
 
 
 static int uncompress_to_file(char *f_src, char *f_target);
@@ -363,12 +363,6 @@ static uff_table_t compress_uff_table[] = {
  *    Compress module related code
  */
 
-static tcl_ints my_tcl_ints[] = {
-  {"share-compressed",  	&share_compressed},
-  {"compress-level",		&compress_level},
-  {NULL,                	NULL}
-};
-
 static int compress_report(int idx, int details)
 {
   if (details) {
@@ -416,6 +410,5 @@ char *compress_start(Function *global_funcs)
   }
 
   uff_addtable(compress_uff_table);
-  add_tcl_ints(my_tcl_ints);
   return NULL;
 }

+ 0 - 9
src/mod/console.mod/console.c

@@ -390,14 +390,6 @@ static int console_dostore(int idx)
   return 0;
 }
 
-static tcl_ints myints[] =
-{
-  {"console-autosave",	&console_autosave,	0},
-  {"force-channel",	&force_channel,		0},
-  {"info-party",	&info_party,		0},
-  {NULL,		NULL,			0}
-};
-
 static cmd_t mychon[] =
 {
   {"*",		"",	console_chon,		"console:chon"},
@@ -430,7 +422,6 @@ char *console_start(Function * global_funcs)
   add_builtins("dcc", mydcc);
   add_builtins("chon", mychon);
 
-  add_tcl_ints(myints);
   USERENTRY_CONSOLE.get = def_get;
   add_entry_type(&USERENTRY_CONSOLE);
   return NULL;

+ 0 - 72
src/mod/irc.mod/irc.c

@@ -63,10 +63,6 @@ static int bounce_bans = 0;
 static int bounce_exempts = 0;
 static int bounce_invites = 0;
 static int bounce_modes = 0;
-static int learn_users = 0;
-static int wait_info = 180;
-static int invite_key = 1;
-static int no_chanrec_info = 0;
 static int modesperline = 4;		/* Number of modes per line to send. */
 static int mode_buf_len = 200;		/* Maximum bytes to send in 1 mode. */
 static int use_354 = 0;			/* Use ircu's short 354 /who
@@ -1285,37 +1281,6 @@ static int check_bind_pubc(char *cmd, char *nick, char *from, struct userrec *u,
 }
 #endif /* S_AUTH */
 
-static tcl_ints myints[] =
-{
-  {"learn-users",		&learn_users,		0},	/* arthur2 */
-  {"wait-split",		&wait_split,		0},
-  {"wait-info",			&wait_info,		0},
-  {"bounce-bans",		&bounce_bans,		0},
-  {"bounce-exempts",		&bounce_exempts,	0},
-  {"bounce-invites",		&bounce_invites,	0},
-  {"bounce-modes",		&bounce_modes,		0},
-  {"modes-per-line",		&modesperline,		0},
-  {"mode-buf-length",		&mode_buf_len,		0},
-  {"use-354",			&use_354,		0},
-  {"kick-method",		&kick_method,		0},
-  {"kick-fun",			&kick_fun,		0},
-  {"ban-fun",			&ban_fun,		0},
-  {"invite-key",		&invite_key,		0},
-  {"no-chanrec-info",		&no_chanrec_info,	0},
-  {"max-bans",			&max_bans,		0},
-  {"max-exempts",		&max_exempts,		0},
-  {"max-invites",		&max_invites,		0},
-  {"max-modes",			&max_modes,		0},
-  {"net-type",			&net_type,		0},
-  {"strict-host",		&strict_host,		0},	/* arthur2 */
-  {"ctcp-mode",			&ctcp_mode,		0},	/* arthur2 */
-  {"keep-nick",			&keepnick,		0},	/* guppy */
-  {"prevent-mixing",		&prevent_mixing,	0},
-  {"rfc-compliant",		&rfc_compliant,		0},
-  {"include-lk",		&include_lk,		0},
-  {NULL,			NULL,			0}	/* arthur2 */
-};
-
 /* Flush the modes for EVERY channel.
  */
 static void flush_modes()
@@ -1451,42 +1416,12 @@ static void do_nettype()
   add_hook(HOOK_RFC_CASECMP, (Function) rfc_compliant);
 }
 
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-static char *traced_nettype(ClientData cdata, Tcl_Interp *irp,
-                            CONST char *name1, CONST char *name2, int flags)
-#else
-static char *traced_nettype(ClientData cdata, Tcl_Interp *irp, char *name1,
-                            char *name2, int flags)
-#endif
-{
-  do_nettype();
-  return NULL;
-}
-
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-static char *traced_rfccompliant(ClientData cdata, Tcl_Interp *irp,
-                                 CONST char *name1, CONST char *name2,
-                                 int flags)
-#else
-static char *traced_rfccompliant(ClientData cdata, Tcl_Interp *irp,
-                                 char *name1, char *name2, int flags)
-#endif
-{
-  /* This hook forces eggdrop core to change the rfc_ match function
-   * links to point to the rfc compliant versions if rfc_compliant
-   * is 1, or to the normal version if it's 0.
-   */
-  add_hook(HOOK_RFC_CASECMP, (Function) rfc_compliant);
-  return NULL;
-}
-
 static cmd_t irc_bot[] = {
   {"dp", "", (Function) mdop_request, NULL},
   {"gi", "", (Function) getin_request, NULL},
   {0, 0, 0, 0}
 };
 
-
 static void getin_5secondly()
 {
   if (server_online) {
@@ -1665,13 +1600,6 @@ char *irc_start(Function * global_funcs)
 #ifdef S_AUTOLOCK
   add_hook(HOOK_MINUTELY, (Function) check_netfight);
 #endif /* S_AUTOLOCK */
-  Tcl_TraceVar(interp, "net-type",
-	       TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-	       traced_nettype, NULL);
-  Tcl_TraceVar(interp, "rfc-compliant",
-	       TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-	       traced_rfccompliant, NULL);
-  add_tcl_ints(myints);
 
   BT_ctcp = bind_table_lookup("ctcp");
   BT_ctcr = bind_table_lookup("ctcr");

+ 6 - 6
src/mod/module.h

@@ -112,10 +112,10 @@
 /* UNUSED 14 */
 /* UNUSED 15 */
 /* 16 - 19 */
-#define add_tcl_ints ((void (*) (tcl_ints *))global[16])
-#define rem_tcl_ints ((void (*) (tcl_ints *))global[17])
-#define add_tcl_strings ((void (*) (tcl_strings *))global[18])
-#define rem_tcl_strings ((void (*) (tcl_strings *))global[19])
+/* UNUSED 16 */
+/* UNUSED 17 */
+/* UNUSED 18 */
+/* UNUSED 19 */
 /* 20 - 23 */
 #define base64_to_int ((int (*) (char *))global[20])
 #define int_to_base64 ((char * (*) (int))global[21])
@@ -357,8 +357,8 @@
 #define check_dcc_attrs ((int (*)(struct userrec *,int))global[207])
 /* 208 - 211 */
 #define check_dcc_chanattrs ((int (*)(struct userrec *,char *,int,int))global[208])
-#define add_tcl_coups ((void (*) (tcl_coups *))global[209])
-#define rem_tcl_coups ((void (*) (tcl_coups *))global[210])
+/* UNUSED 209 */
+/* UNUSED 210 */
 #define botname ((char *)(global[211]))
 /* 212 - 215 */
 /* 212: remove_gunk() -- UNUSED (drummer) */

+ 0 - 17
src/mod/notes.mod/notes.c

@@ -906,21 +906,6 @@ static cmd_t notes_msgs[] =
   {NULL,	NULL,	NULL,				NULL}
 };
 
-static tcl_ints notes_ints[] =
-{
-  {"note-life",		&note_life},
-  {"max-notes",		&maxnotes},
-  {"allow-fwd",		&allow_fwd},
-  {"notify-users",	&notify_users},
-  {NULL,		NULL}
-};
-
-static tcl_strings notes_strings[] =
-{
-  {"notefile",		notefile,		120,	0},
-  {NULL,		NULL,			0,	0}
-};
-
 static int notes_server_setup(char *mod)
 {
   add_builtins("msg", notes_msgs);
@@ -964,8 +949,6 @@ char *notes_start(Function * global_funcs)
   add_hook(HOOK_HOURLY, (Function) notes_hourly);
   add_hook(HOOK_MATCH_NOTEREJ, (Function) match_note_ignore);
   add_hook(HOOK_STORENOTE, (Function) storenote);
-  add_tcl_ints(notes_ints);
-  add_tcl_strings(notes_strings);
 
   add_builtins("dcc", notes_cmds);
   add_builtins("load", notes_load);

+ 0 - 35
src/mod/server.mod/server.c

@@ -1194,39 +1194,6 @@ static void do_nettype(void)
   }
 }
 
-static tcl_ints my_tcl_ints[] =
-{
-  {"use-console-r",		NULL,				1},
-  {"server-timeout",		&server_timeout,		0},
-  {"lowercase-ctcp",		&lowercase_ctcp,		0},
-  {"server-online",		(int *) &server_online,		2},
-  {"never-give-up",		&never_give_up,			0},
-  {"keep-nick",			&keepnick,			0},
-  {"strict-servernames",	&strict_servernames,		0},
-  {"check-stoned",		&check_stoned,			0},
-  {"serverror-quit",		&serverror_quit,		0},
-  {"quiet-reject",		&quiet_reject,			0},
-  {"max-queue-msg",		&maxqmsg,			0},
-  {"trigger-on-ignore",		&trigger_on_ignore,		0},
-  {"answer-ctcp",		&answer_ctcp,			0},
-  {"server-cycle-wait",		(int *) &server_cycle_wait,	0},
-  {"default-port",		&default_port,			0},
-  {"check-mode-r",		&check_mode_r,			0},
-  {"net-type",			&net_type,			0},
-  {"ctcp-mode",			&ctcp_mode,			0},
-  {"double-mode",		&double_mode,			0},/* G`Quann */
-  {"double-server",		&double_server,			0},
-  {"double-help",		&double_help,			0},
-  {"use-penalties",		&use_penalties,			0},
-  {"use-fastdeq",		&use_fastdeq,			0},
-  {"nicklen",			&nick_len,			0},
-  {"nick-len",			&nick_len,			0},
-  {"optimize-kicks",		&optimize_kicks,		0},
-  {"isjuped",			&nick_juped,			0},
-  {"stack-limit",               &stack_limit,                   0},
-  {NULL,			NULL,				0}
-};
-
 /*
  *     CTCP DCC CHAT functions
  */
@@ -1638,8 +1605,6 @@ char *server_start(Function *global_funcs)
   add_builtins("dcc", C_dcc_serv);
   add_builtins("ctcp", my_ctcps);
 
-  my_tcl_ints[0].val = &use_console_r;
-  add_tcl_ints(my_tcl_ints);
   add_hook(HOOK_SECONDLY, (Function) server_secondly);
   add_hook(HOOK_10SECONDLY, (Function) server_10secondly);
   add_hook(HOOK_5MINUTELY, (Function) server_5minutely);

+ 6 - 6
src/modules.c

@@ -176,10 +176,10 @@ Function global_table[] =
   (Function) 0,
   (Function) 0,
   /* 16 - 19 */
-  (Function) add_tcl_ints,
-  (Function) rem_tcl_ints,
-  (Function) add_tcl_strings,
-  (Function) rem_tcl_strings,
+  (Function) 0,
+  (Function) 0,
+  (Function) 0,
+  (Function) 0,
   /* 20 - 23 */
   (Function) base64_to_int,
   (Function) int_to_base64,
@@ -417,8 +417,8 @@ Function global_table[] =
   (Function) check_dcc_attrs,
   /* 208 - 211 */
   (Function) check_dcc_chanattrs,
-  (Function) add_tcl_coups,
-  (Function) rem_tcl_coups,
+  (Function) 0,
+  (Function) 0,
   (Function) botname,
   /* 212 - 215 */
   (Function) 0,			/* remove_gunk() -- UNUSED! (drummer)	*/

+ 3 - 133
src/tcl.c

@@ -282,50 +282,6 @@ static char *tcl_eggstr(ClientData cdata, Tcl_Interp *irp, char *name1,
   }
 }
 
-/* Strings */
-static tcl_strings def_tcl_strings[] =
-{
-  {"botnet-nick",	botnetnick,	HANDLEN,	0},
-  {"origbotname",       origbotname,    HANDLEN,        0},
-  {"userfile",		userfile,	120,		STR_PROTECT},
-  {"admin",		admin,		120,		0},
-  {"owner",		owner,		120,		STR_PROTECT},
-  {"my-ip",		myip,		120,		0},
-  {"my-hostname",       hostname,       120,            0},
-  {"my-ip6",            myip6,          120,            0},
-  {"my-hostname6",      hostname6,      120,            0},
-  {"nat-ip",		natip,		120,		0},
-  {"username",		botuser,	10,		0},
-  {"version",		egg_version,	0,		STR_PROTECT},
-  {"firewall",		firewall,	120,		0},
-  {"pidfile",		pid_file,       120,		STR_PROTECT},
-  {"dcc_prefix",	dcc_prefix,	1,		0},
-  {NULL,		NULL,		0,		0}
-};
-
-/* Ints */
-static tcl_ints def_tcl_ints[] =
-{
-  {"localhub",			&localhub,		2},
-  {"handlen",			&handlen,		2},
-  {"dcc-flood-thr",		&dcc_flood_thr,		0},
-  {"reserved-port",		&reserved_port_min,		0},
-  /* booleans (really just ints) */
-  {"console",			&conmask,		0},
-  {"default-flags",		&default_flags,		0},
-  /* moved from eggdrop.h */
-  {"numversion",		&egg_numver,		2},
-  {"remote-boots",		&remote_boots,		1},
-  {"debug-output",		&debug_output,		1},
-  {"protect-telnet",		&protect_telnet,	0},
-  {"sort-users",		&sort_users,		0},
-  {"ident-timeout",		&identtimeout,		0},
-  {"resolve-timeout",		&resolve_timeout,	0},
-  {"dupwait-timeout",		&dupwait_timeout,	0},
-  {"strict-host",		&strict_host,		0}, 			/* drummer */
-  {NULL,			NULL,			0}	/* arthur2 */
-};
-
 static tcl_coups def_tcl_coups[] =
 {
   {"telnet-flood",	&flood_telnet_thr,	&flood_telnet_time},
@@ -336,14 +292,14 @@ static tcl_coups def_tcl_coups[] =
 /* Set up Tcl variables that will hook into eggdrop internal vars via
  * trace callbacks.
  */
+
+void add_tcl_coups(tcl_coups *); 		/* prototype */
+
 static void init_traces()
 {
   add_tcl_coups(def_tcl_coups);
-  add_tcl_strings(def_tcl_strings);
-  add_tcl_ints(def_tcl_ints);
 }
 
-extern tcl_cmds tcluser_cmds[], tcldcc_cmds[], tclmisc_cmds[], tclmisc_objcmds[];
 
 /* Not going through Tcl's crazy main() system (what on earth was he
  * smoking?!) so we gotta initialize the Tcl interpreter
@@ -458,92 +414,6 @@ resetPath:
   Context;
 }
 
-void add_tcl_strings(tcl_strings *list)
-{
-  int i;
-  strinfo *st;
-  int tmp;
-
-  for (i = 0; list[i].name; i++) {
-    st = (strinfo *) malloc(sizeof(strinfo));
-    strtot += sizeof(strinfo);
-    st->max = list[i].length - (list[i].flags & STR_DIR);
-    if (list[i].flags & STR_PROTECT)
-      st->max = -st->max;
-    st->str = list[i].buf;
-    st->flags = (list[i].flags & STR_DIR);
-    tmp = protect_readonly;
-    protect_readonly = 0;
-    tcl_eggstr((ClientData) st, interp, list[i].name, NULL, TCL_TRACE_WRITES);
-    tcl_eggstr((ClientData) st, interp, list[i].name, NULL, TCL_TRACE_READS);
-    Tcl_TraceVar(interp, list[i].name, TCL_TRACE_READS | TCL_TRACE_WRITES |
-		 TCL_TRACE_UNSETS, tcl_eggstr, (ClientData) st);
-  }
-}
-
-void rem_tcl_strings(tcl_strings *list)
-{
-  int i;
-  strinfo *st;
-
-  for (i = 0; list[i].name; i++) {
-    st = (strinfo *) Tcl_VarTraceInfo(interp, list[i].name,
-				      TCL_TRACE_READS |
-				      TCL_TRACE_WRITES |
-				      TCL_TRACE_UNSETS,
-				      tcl_eggstr, NULL);
-    Tcl_UntraceVar(interp, list[i].name,
-		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		   tcl_eggstr, st);
-    if (st != NULL) {
-      strtot -= sizeof(strinfo);
-      free(st);
-    }
-  }
-}
-
-void add_tcl_ints(tcl_ints *list)
-{
-  int i, tmp;
-  intinfo *ii;
-
-  for (i = 0; list[i].name; i++) {
-    ii = malloc(sizeof(intinfo));
-    strtot += sizeof(intinfo);
-    ii->var = list[i].val;
-    ii->ro = list[i].readonly;
-    tmp = protect_readonly;
-    protect_readonly = 0;
-    tcl_eggint((ClientData) ii, interp, list[i].name, NULL, TCL_TRACE_WRITES);
-    protect_readonly = tmp;
-    tcl_eggint((ClientData) ii, interp, list[i].name, NULL, TCL_TRACE_READS);
-    Tcl_TraceVar(interp, list[i].name,
-		 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		 tcl_eggint, (ClientData) ii);
-  }
-}
-
-void rem_tcl_ints(tcl_ints *list)
-{
-  int i;
-  intinfo *ii;
-
-  for (i = 0; list[i].name; i++) {
-    ii = (intinfo *) Tcl_VarTraceInfo(interp, list[i].name,
-				      TCL_TRACE_READS |
-				      TCL_TRACE_WRITES |
-				      TCL_TRACE_UNSETS,
-				      tcl_eggint, NULL);
-    Tcl_UntraceVar(interp, list[i].name,
-		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		   tcl_eggint, (ClientData) ii);
-    if (ii) {
-      strtot -= sizeof(intinfo);
-      free(ii);
-    }
-  }
-}
-
 /* Allocate couplet space for tracing couplets
  */
 void add_tcl_coups(tcl_coups *list)

+ 0 - 30
src/tclegg.h

@@ -16,11 +16,6 @@
 /* Used for stub functions:
  */
 
-#define STDVAR		(cd, irp, argc, argv)				\
-	ClientData cd;							\
-	Tcl_Interp *irp;						\
-	int argc;							\
-	char *argv[];
 #define BADARGS(nl, nh, example)	do {				\
 	if ((argc < (nl)) || (argc > (nh))) {				\
 		Tcl_AppendResult(irp, "wrong # args: should be \"",	\
@@ -30,35 +25,10 @@
 } while (0)
 
 
-typedef struct _tcl_strings {
-  char *name;
-  char *buf;
-  int length;
-  int flags;
-} tcl_strings;
-
-typedef struct _tcl_int {
-  char *name;
-  int *val;
-  int readonly;
-} tcl_ints;
-
 typedef struct _tcl_coups {
   char *name;
   int *lptr;
   int *rptr;
 } tcl_coups;
 
-typedef struct _tcl_cmds {
-  char *name;
-  Function func;
-} tcl_cmds;
-
-void add_tcl_strings(tcl_strings *);
-void rem_tcl_strings(tcl_strings *);
-void add_tcl_coups(tcl_coups *);
-void rem_tcl_coups(tcl_coups *);
-void add_tcl_ints(tcl_ints *);
-void rem_tcl_ints(tcl_ints *);
-
 #endif				/* _EGG_TCLEGG_H */