Parcourir la source

* Removed old logfile(s) support, will add new support later

svn: 141
Bryan Drewery il y a 23 ans
Parent
commit
e3866794ea
7 fichiers modifiés avec 22 ajouts et 411 suppressions
  1. 1 31
      src/chanprog.c
  2. 2 0
      src/cmds.c
  3. 7 46
      src/main.c
  4. 6 173
      src/misc.c
  5. 0 3
      src/proto.h
  6. 4 20
      src/tcl.c
  7. 2 138
      src/tclmisc.c

+ 1 - 31
src/chanprog.c

@@ -22,7 +22,6 @@
 #include "modules.h"
 
 extern struct userrec	*userlist;
-extern log_t		*logs;
 extern Tcl_Interp	*interp;
 extern char		 ver[], botnetnick[], firewall[], myip[], origbotname[],
 			 motdfile[], userfile[], tempdir[],
@@ -31,7 +30,7 @@ extern char		 ver[], botnetnick[], firewall[], myip[], origbotname[],
 
 extern time_t		 now, online_since;
 extern int		 backgrd, term_z, con_chan, cache_hit, cache_miss,
-			 firewallport, default_flags, max_logs, conmask,
+			 firewallport, default_flags, conmask,
 			 protect_readonly, noshare,
 #ifdef HUB
 			 my_port,
@@ -352,7 +351,6 @@ void tell_verbose_status(int idx)
 void tell_settings(int idx)
 {
   char s[1024];
-  int i;
   struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
 
   dprintf(idx, "Botnet Nickname: %s\n", botnetnick);
@@ -372,12 +370,6 @@ void tell_settings(int idx)
   if (owner[0])
     dprintf(idx, "%s: %s\n", MISC_PERMOWNER, owner);
 #endif
-  for (i = 0; i < max_logs; i++)
-    if (logs[i].filename != NULL) {
-      dprintf(idx, "Logfile #%d: %s on %s (%s: %s)\n", i + 1,
-	      logs[i].filename, logs[i].chname,
-	      masktype(logs[i].mask), maskname(logs[i].mask));
-    }
   dprintf(idx, "Ignores last %d mins\n", ignore_time);
 }
 
@@ -546,7 +538,6 @@ void load_internal_users()
 
 void chanprog()
 {
-  int i;
   char buf[2048];
   struct bot_addr *bi;
   struct userrec *u;
@@ -556,8 +547,6 @@ void chanprog()
 
   /* cache our ip on load instead of every 30 seconds -zip */
   cache_my_ip();
-  for (i = 0; i < max_logs; i++)
-    logs[i].flags |= LF_EXPIRING;
   conmask = 0;
   /* Turn off read-only variables (make them write-able) for rehash */
   protect_readonly = 0;
@@ -607,25 +596,6 @@ void chanprog()
     bi = get_user(&USERENTRY_BOTADDR, u);
   }
 
-  for (i = 0; i < max_logs; i++) {
-    if (logs[i].flags & LF_EXPIRING) {
-      if (logs[i].filename != NULL) {
-        nfree(logs[i].filename);
-        logs[i].filename = NULL;
-      }
-      if (logs[i].chname != NULL) {
-        nfree(logs[i].chname);
-        logs[i].chname = NULL;
-      }
-      if (logs[i].f != NULL) {
-        fclose(logs[i].f);
-        logs[i].f = NULL;
-      }
-      logs[i].mask = 0;
-      logs[i].flags = 0;
-    }
-  }
-
   bi = get_user(&USERENTRY_BOTADDR, get_user_by_handle(userlist, botnetnick));
   if (!bi)
     fatal(STR("I'm added to userlist but without a bot record!"), 0);

+ 2 - 0
src/cmds.c

@@ -804,6 +804,7 @@ If you have flags on a channel, type %sconsole #chan to see more commands.\n"),
 
 static void cmd_addlog(struct userrec *u, int idx, char *par)
 {
+  putlog(LOG_CMDS, "*", "#%s# addlog %s", dcc[idx].nick, par);
   putlog(LOG_MISC, "*", "%s: %s", dcc[idx].nick, par);
   if (!par[0]) {
     dprintf(idx, "Usage: addlog <message>\n");
@@ -4024,6 +4025,7 @@ dcc_cmd_t C_dcc[] =
   {"-ignore",		"m",	(Function) cmd_mns_ignore,	NULL,    NULL},
   {"-user",		"m",	(Function) cmd_mns_user,	NULL,    NULL},
   {"addlog",		"mo|o",	(Function) cmd_addlog,		NULL,    NULL},
+  {"putlog",		"mo|o",	(Function) cmd_addlog,		NULL,	 NULL},
   {"about",		"",	(Function) cmd_about,		NULL,    NULL},
   {"away",		"",	(Function) cmd_away,		NULL,    NULL},
   {"back",		"",	(Function) cmd_back,		NULL,    NULL},

+ 7 - 46
src/main.c

@@ -67,12 +67,11 @@ extern char		 origbotname[], userfile[], botnetnick[],
                          thekey[], netpass[], shellpass[], myip6[], myip[], hostname[],
                          hostname6[], natip[];
 extern int		 dcc_total, conmask, cache_hit, cache_miss,
-			 max_logs, quick_logs, fork_interval, 
+			 fork_interval, 
                          local_fork_interval;
 extern struct dcc_t	*dcc;
 extern struct userrec	*userlist;
 extern struct chanset_t	*chanset;
-extern log_t		*logs;
 extern Tcl_Interp	*interp;
 extern tcl_timer_t	*timer,
 			*utimer;
@@ -108,9 +107,6 @@ char *binname;
 int     sdebug = 0;		/* enable debug output? */
 char	configfile[121] = ""; /* Name of the config file */
 char	textdir[121] = "";	/* Directory for text files that get dumped */
-int	keep_all_logs = 0;	/* Never erase logfiles, no matter how old
-				   they are? */
-char	logfile_suffix[21] = ".%d%b%Y"; /* Format of logfile suffix. */
 time_t	online_since;		/* Unix-time that the bot loaded up */
 
 char	owner[121] = "";	/* Permanent owner(s) of the bot */
@@ -120,7 +116,6 @@ int	save_users_at = 0;	/* How many minutes past the hour to
 				   save the userfile? */
 int	notify_users_at = 0;	/* How many minutes past the hour to
 				   notify users of notes? */
-int	switch_logfiles_at = 300; /* When (military time) to switch logfiles */
 char	version[81];		/* Version info (long form) */
 char	ver[41];		/* Version info (short form) */
 int	use_stderr = 1;		/* Send stuff to stderr instead of logfiles? */
@@ -185,7 +180,7 @@ void fatal(const char *s, int recoverable)
 #endif /* LEAF */
   if (s[0])
     putlog(LOG_MISC, "*", "* %s", s);
-  flushlogs();
+/*  flushlogs(); */
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].sock >= 0)
       killsock(dcc[i].sock);
@@ -733,25 +728,15 @@ static void core_secondly()
     miltime = (nowtm.tm_hour * 100) + (nowtm.tm_min);
     if (((int) (nowtm.tm_min / 5) * 5) == (nowtm.tm_min)) {	/* 5 min */
       call_hook(HOOK_5MINUTELY);
-      if (!quick_logs) {
-	flushlogs();
-	check_logsize();
-      }
+/* 	flushlogs(); */
       if (!miltime) {	/* At midnight */
 	char s[25];
-	int j;
 
 	strncpyz(s, ctime(&now), sizeof s);
 #ifdef HUB
 	putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20);
 	call_hook(HOOK_BACKUP);
 #endif
-	for (j = 0; j < max_logs; j++) {
-	  if (logs[j].filename != NULL && logs[j].f != NULL) {
-	    fclose(logs[j].f);
-	    logs[j].f = NULL;
-	  }
-	}
       }
     }
     if (nowtm.tm_min == notify_users_at)
@@ -760,23 +745,8 @@ static void core_secondly()
      * settings and we only get this far on the minute.
      */
 #ifdef HUB
-    if (miltime == switch_logfiles_at) {
+    if (miltime == 300) {
       call_hook(HOOK_DAILY);
-      if (!keep_all_logs) {
-	putlog(LOG_MISC, "*", MISC_LOGSWITCH);
-	for (i = 0; i < max_logs; i++)
-	  if (logs[i].filename) {
-	    char s[1024];
-
-	    if (logs[i].f) {
-	      fclose(logs[i].f);
-	      logs[i].f = NULL;
-	    }
-	    egg_snprintf(s, sizeof s, "%s.yesterday", logs[i].filename);
-	    unlink(s);
-	    movefile(logs[i].filename, s);
-	  }
-      }
     }
 #endif
   }
@@ -820,10 +790,7 @@ static void core_minutely()
 
   check_tcl_time(&nowtm);
   do_check_timers(&timer);
-  if (quick_logs != 0) {
-    flushlogs();
-    check_logsize();
-  }
+/*     flushlogs(); */
 }
 
 static void core_hourly()
@@ -848,11 +815,6 @@ static void event_save()
   check_tcl_event("save");
 }
 
-static void event_logfile()
-{
-  check_tcl_event("logfile");
-}
-
 static void event_resettraffic()
 {
   otraffic_irc += otraffic_irc_today;
@@ -1546,7 +1508,7 @@ Context;
 #ifdef HUB
           sprintf(userfile, "%s/.%s.user", confdir, nick);
 #endif /* HUB */
-
+/* log          sprintf(logfile, "%s/.%s.log", confdir, nick); */
           if (host && host[1]) { //only copy host if it is longer than 1 char (.)
             if (host[0] == '+') { //ip6 host
               host++;
@@ -1743,7 +1705,6 @@ Context;
 #ifdef HUB
   add_hook(HOOK_BACKUP, (Function) backup_userfile);  
 #endif /* HUB */
-  add_hook(HOOK_DAILY, (Function) event_logfile);
   add_hook(HOOK_DAILY, (Function) event_resettraffic);
   add_hook(HOOK_LOADED, (Function) event_loaded);
 
@@ -1900,7 +1861,7 @@ Context;
 	  /* Should be only 3 modules now - eggdrop, encryption, and uptime */
 	  putlog(LOG_MISC, "*", MOD_STAGNANT);
 
-	flushlogs();
+/* 	flushlogs(); */
 	kill_tcl();
 	init_tcl(argc, argv);
 

+ 6 - 173
src/misc.c

@@ -1,7 +1,6 @@
 /*
  * misc.c -- handles:
  *   split() maskhost() dumplots() daysago() days() daysdur()
- *   logging things
  *   queueing output for the bot (msg and help)
  *   resync buffers for sharebots
  *   motd display and %var substitution
@@ -43,14 +42,14 @@ extern tand_t *tandbot;
 
 extern char		 version[], origbotname[], botname[],
 			 admin[], network[], motdfile[], ver[], botnetnick[],
-			 bannerfile[], logfile_suffix[], textdir[], userfile[],  
+			 bannerfile[], textdir[], userfile[],  
                          *binname, pid_file[], netpass[], tempdir[];
 
 extern int		 backgrd, con_chan, term_z, use_stderr, dcc_total, timesync, sdebug, 
 #ifdef HUB
                          my_port,
 #endif
-			 keep_all_logs, quick_logs, strict_host, loading,
+			 strict_host, loading,
                          localhub;
 extern time_t		 now;
 extern Tcl_Interp	*interp;
@@ -59,9 +58,6 @@ void detected(int, char *);
 
 int	 shtime = 1;		/* Whether or not to display the time
 				   with console output */
-log_t	*logs = 0;		/* Logfiles */
-int	 max_logs = 5;		/* Current maximum log files */
-int	 max_logsize = 0;	/* Maximum logfile size, 0 for no limit */
 int	 conmask = LOG_MODES | LOG_CMDS | LOG_MISC; /* Console mask */
 int	 debug_output = 1;	/* Disply output to server to LOG_SERVEROUT */
 
@@ -454,7 +450,7 @@ int expmem_misc()
   tot += sizeof(struct auth_t) * max_auth;
   tot += strlen(binname) + 1;
 
-  return tot + (max_logs * sizeof(log_t));
+  return tot;
 }
 
 void init_auth_max()
@@ -469,27 +465,9 @@ void init_auth_max()
 
 void init_misc()
 {
-  static int last = 0;
 
   init_auth_max();
 
-  if (max_logs < 1)
-    max_logs = 1;
-  if (logs)
-    logs = nrealloc(logs, max_logs * sizeof(log_t));
-  else
-    logs = nmalloc(max_logs * sizeof(log_t));
-  for (; last < max_logs; last++) {
-    logs[last].filename = logs[last].chname = NULL;
-    logs[last].mask = 0;
-    logs[last].f = NULL;
-    /* Added by cybah  */
-    logs[last].szlast[0] = 0;
-    logs[last].repeats = 0;
-    /* Added by rtc  */
-    logs[last].flags = 0;
-  }
-
   add_cfg(&CFG_AUTHKEY);
   add_cfg(&CFG_MOTD);
   add_cfg(&CFG_FORKINTERVAL);
@@ -986,7 +964,7 @@ int prand(int *seed, int range)
 void putlog EGG_VARARGS_DEF(int, arg1)
 {
   int i, type, tsl = 0, dohl = 0; //hl
-  char *format, *chname, s[LOGLINELEN], s1[256], *out, ct[81], *s2, stamp[34], buf2[LOGLINELEN]; 
+  char *format, *chname, s[LOGLINELEN], *out, stamp[34], buf2[LOGLINELEN]; 
   va_list va;
 #ifdef HUB
   time_t now2 = time(NULL);
@@ -1021,21 +999,7 @@ void putlog EGG_VARARGS_DEF(int, arg1)
   egg_vsnprintf(out, LOGLINEMAX - tsl, format, va);
 
   out[LOGLINEMAX - tsl] = 0;
-  if (keep_all_logs) {
-    if (!logfile_suffix[0])
-      egg_strftime(ct, 12, ".%d%b%Y", t);
-    else {
-      egg_strftime(ct, 80, logfile_suffix, t);
-      ct[80] = 0;
-      s2 = ct;
-      /* replace spaces by underscores */
-      while (s2[0]) {
-	if (s2[0] == ' ')
-	  s2[0] = '_';
-	s2++;
-      }
-    }
-  }
+
   /* Place the timestamp in the string to be printed */
   if ((out[0]) && (shtime)) {
     strncpy(s, stamp, tsl);
@@ -1043,50 +1007,7 @@ void putlog EGG_VARARGS_DEF(int, arg1)
   }
 
   strcat(out, "\n");
-  if (!use_stderr) {
-    for (i = 0; i < max_logs; i++) {
-      if ((logs[i].filename != NULL) && (logs[i].mask & type) &&
-	  ((chname[0] == '@') || (chname[0] == '*') || (logs[i].chname[0] == '*') ||
-	   (!rfc_casecmp(chname, logs[i].chname)))) {
-	if (logs[i].f == NULL) {
-	  /* Open this logfile */
-	  if (keep_all_logs) {
-	    egg_snprintf(s1, 256, "%s%s", logs[i].filename, ct);
-	    logs[i].f = fopen(s1, "a+");
-	  } else
-	    logs[i].f = fopen(logs[i].filename, "a+");
-	}
-	if (logs[i].f != NULL) {
-	  /* Check if this is the same as the last line added to
-	   * the log. <cybah>
-	   */
-          if (!egg_strcasecmp(out + tsl, logs[i].szlast))
-	    /* It is a repeat, so increment repeats */
-	    logs[i].repeats++;
-	  else {
-	    /* Not a repeat, check if there were any repeat
-	     * lines previously...
-	     */
-	    if (logs[i].repeats > 0) {
-	      /* Yep.. so display 'last message repeated x times'
-	       * then reset repeats. We want the current time here,
-	       * so put that in the file first.
-	       */
-              fprintf(logs[i].f, stamp);
-	      fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
-	      
-	      logs[i].repeats = 0;
-	      /* No need to reset logs[i].szlast here
-	       * because we update it later on...
-	       */
-	    }
-	    fputs(out, logs[i].f);
-           strncpyz(logs[i].szlast, out + tsl, LOGLINEMAX);
-	  }
-	}
-      }
-    }
-  }
+  /* WRITE LOG HERE */
 /* echo line to hubs (not if it was on a +h though)*/
 
   if (dohl) {
@@ -1123,94 +1044,6 @@ void putlog EGG_VARARGS_DEF(int, arg1)
   va_end(va);
 }
 
-/* Called as soon as the logfile suffix changes. All logs are closed
- * and the new suffix is stored in `logfile_suffix'.
- */
-void logsuffix_change(char *s)
-{
-  int	 i;
-  char	*s2 = logfile_suffix;
-
-  debug0("Logfile suffix changed. Closing all open logs.");
-  strcpy(logfile_suffix, s);
-  while (s2[0]) {
-    if (s2[0] == ' ')
-      s2[0] = '_';
-    s2++;
-  }
-  for (i = 0; i < max_logs; i++) {
-    if (logs[i].f) {
-      fflush(logs[i].f);
-      fclose(logs[i].f);
-      logs[i].f = NULL;
-    }
-  }
-}
-
-void check_logsize()
-{
-  struct stat ss;
-  int i;
-/* int x=1; */
-  char buf[1024];		/* Should be plenty */
-
-  if (!keep_all_logs && max_logsize > 0) {
-    for (i = 0; i < max_logs; i++) {
-      if (logs[i].filename) {
-	if (stat(logs[i].filename, &ss) != 0) {
-	  break;
-	}
-	if ((ss.st_size >> 10) > max_logsize) {
-	  if (logs[i].f) {
-	    /* write to the log before closing it huh.. */
-	    putlog(LOG_MISC, "*", MISC_CLOGS, logs[i].filename, ss.st_size);
-	    fflush(logs[i].f);
-	    fclose(logs[i].f);
-	    logs[i].f = NULL;
-	  }
-
-	  egg_snprintf(buf, sizeof buf, "%s.yesterday", logs[i].filename);
-	  buf[1023] = 0;
-	  unlink(buf);
-	  movefile(logs[i].filename, buf);
-	}
-      }
-    }
-  }
-}
-
-/* Flush the logfiles to disk
- */
-void flushlogs()
-{
-  int i;
-
-  /* Logs may not be initialised yet. */
-  if (!logs)
-    return;
-
-  /* Now also checks to see if there's a repeat message and
-   * displays the 'last message repeated...' stuff too <cybah>
-   */
-  for (i = 0; i < max_logs; i++) {
-    if (logs[i].f != NULL) {
-      if ((logs[i].repeats > 0) && quick_logs) {
-         /* Repeat.. if quicklogs used then display 'last message
-          * repeated x times' and reset repeats.
-	  */
-         char stamp[32];
-         egg_strftime(&stamp[0], 32, LOG_TS, localtime(&now));
-         fprintf(logs[i].f, "%s ", stamp);
-	 fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
-	/* Reset repeats */
-	logs[i].repeats = 0;
-      }
-      fflush(logs[i].f);
-    }
-  }
-}
-
-
 char *extracthostname(char *hostmask)
 {
   char *p = strrchr(hostmask, '@');

+ 0 - 3
src/proto.h

@@ -249,8 +249,6 @@ int egg_strcatn(char *dst, const char *src, size_t max);
 int my_strcpy(char *, char *);
 void putlog EGG_VARARGS(int, arg1);
 int ischanhub();
-void flushlogs();
-void check_logsize();
 void maskhost(const char *, char *);
 char *stristr(char *, char *);
 void splitc(char *, char *, char);
@@ -268,7 +266,6 @@ void show_banner(int);
 char *extracthostname(char *);
 void make_rand_str(char *, int);
 int oatoi(const char *);
-void logsuffix_change(char *);
 char *str_escape(const char *str, const char div, const char mask);
 char *strchr_unescape(char *str, const char div, register const char esc_char);
 void str_unescape(char *str, register const char esc_char);

+ 4 - 20
src/tcl.c

@@ -32,19 +32,19 @@ typedef struct {
 
 extern time_t	online_since;
 extern int	backgrd, flood_telnet_thr, flood_telnet_time;
-extern int	shtime, share_greet, keep_all_logs;
+extern int	shtime, share_greet;
 extern int	allow_new_telnets, use_telnet_banner;
-extern int	default_flags, conmask, switch_logfiles_at, connect_timeout;
+extern int	default_flags, conmask, connect_timeout;
 extern int	firewallport, notify_users_at, flood_thr, ignore_time;
 extern int	reserved_port_min, reserved_port_max, localhub;
 extern char	origbotname[], botuser[], motdfile[], admin[], userfile[],
                 firewall[], notify_new[], hostname[], hostname6[], myip[], myip6[],
 		tempdir[], owner[], network[], botnetnick[],
 		bannerfile[], egg_version[], natip[], configfile[],
-		logfile_suffix[], textdir[], pid_file[], dcc_prefix[], 
+		textdir[], pid_file[], dcc_prefix[], 
 		netpass[];
 
-extern int	die_on_sighup, die_on_sigterm, max_logs, max_logsize,
+extern int	die_on_sighup, die_on_sigterm,
 		enable_simul, dcc_total, debug_output, identtimeout,
 		protect_telnet, dupwait_timeout, egg_numver, share_unlinks,
 		dcc_sanitycheck, sort_users, tands, resolve_timeout,
@@ -65,8 +65,6 @@ int	    allow_dk_cmds = 1;
 int	    must_be_owner = 1;
 int	    max_dcc = 200;		/* needs at least 4 or 5 just to
 					   get started. 20 should be enough   */
-int	    quick_logs = 1;		/* quick write logs? (flush them
-					   every min instead of every 5	      */
 int	    quiet_save = 1;             /* quiet-save patch by Lucas	      */
 int	    strtot = 0;
 int 	    handlen = HANDLEN;
@@ -218,11 +216,6 @@ static char *tcl_eggint(ClientData cdata, Tcl_Interp *irp, char *name1,
 	    return "you can't DECREASE max-dcc";
 	  max_dcc = l;
 	  init_dcc_max();
-	} else if ((int *) ii->var == &max_logs) {
-	  if (l < max_logs)
-	    return "you can't DECREASE max-logs";
-	  max_logs = l;
-	  init_misc();
 	} else
 	  *(ii->var) = (int) l;
       }
@@ -289,8 +282,6 @@ static char *tcl_eggstr(ClientData cdata, Tcl_Interp *irp, char *name1,
 	s[abs(st->max)] = 0;
       if (st->str == botnetnick)
 	botnet_change(s);
-      else if (st->str == logfile_suffix)
-	logsuffix_change(s);
       else if (st->str == firewall) {
 	splitc(firewall, s, ':');
 	if (!firewall[0])
@@ -458,7 +449,6 @@ static tcl_strings def_tcl_strings[] =
 /* confvar patch by aaronwl */
   {"config",		configfile,	0,		0},
   {"telnet-banner",	bannerfile,	120,		STR_PROTECT},
-  {"logfile-suffix",	logfile_suffix,	20,		0},
   {"pidfile",		pid_file,       120,		STR_PROTECT},
 /*settings made by installer */
   {"dcc_prefix",	dcc_prefix,	1,		0},
@@ -473,11 +463,9 @@ static tcl_ints def_tcl_ints[] =
   {"handlen",			&handlen,		2},
   {"dcc-flood-thr",		&dcc_flood_thr,		0},
   {"hourly-updates",		&notify_users_at,	0},
-  {"switch-logfiles-at",	&switch_logfiles_at,	0},
   {"connect-timeout",		&connect_timeout,	0},
   {"reserved-port",		&reserved_port_min,		0},
   /* booleans (really just ints) */
-  {"keep-all-logs",		&keep_all_logs,		0},
   {"open-telnets",		&allow_new_telnets,	0},
   {"use-telnet-banner",		&use_telnet_banner,	0},
   {"uptime",			(int *) &online_since,	2},
@@ -489,9 +477,6 @@ static tcl_ints def_tcl_ints[] =
   {"die-on-sigterm",		&die_on_sigterm,	1},
   {"remote-boots",		&remote_boots,		1},
   {"max-dcc",			&max_dcc,		0},
-  {"max-logs",			&max_logs,		0},
-  {"max-logsize",		&max_logsize,		0},
-  {"quick-logs",		&quick_logs,		0},
   {"enable-simul",		&enable_simul,		1},
   {"debug-output",		&debug_output,		1},
   {"protect-telnet",		&protect_telnet,	0},
@@ -499,7 +484,6 @@ static tcl_ints def_tcl_ints[] =
   {"sort-users",		&sort_users,		0},
   {"ident-timeout",		&identtimeout,		0},
   {"share-unlinks",		&share_unlinks,		0},
-  {"log-time",			&shtime,		0},
   {"allow-dk-cmds",		&allow_dk_cmds,		0},
   {"resolve-timeout",		&resolve_timeout,	0},
   {"must-be-owner",		&must_be_owner,		1},

+ 2 - 138
src/tclmisc.c

@@ -19,91 +19,15 @@ extern char		 origbotname[], botnetnick[], quit_msg[];
 extern struct userrec	*userlist;
 extern time_t		 now;
 extern module_entry	*module_list;
-extern int max_logs, timesync;
-extern log_t *logs;
+extern int timesync;
 extern Tcl_Interp *interp;
 
 int expmem_tclmisc()
 {
   int i, tot = 0;
-
-  for (i = 0; i < max_logs; i++)
-    if (logs[i].filename != NULL) {
-      tot += strlen(logs[i].filename) + 1;
-      tot += strlen(logs[i].chname) + 1;
-    }
   return tot;
 }
 
-/*
- *      Logging
- */
-
-/* logfile [<modes> <channel> <filename>] */
-#ifdef HUB
-static int tcl_logfile STDVAR
-{
-  int i;
-  char s[151];
-
-  BADARGS(1, 4, " ?logModes channel logFile?");
-  if (argc == 1) {
-    /* They just want a list of the logfiles and modes */
-    for (i = 0; i < max_logs; i++)
-      if (logs[i].filename != NULL) {
-	strcpy(s, masktype(logs[i].mask));
-	strcat(s, " ");
-	strcat(s, logs[i].chname);
-	strcat(s, " ");
-	strcat(s, logs[i].filename);
-	Tcl_AppendElement(interp, s);
-      }
-    return TCL_OK;
-  }
-  BADARGS(4, 4, " ?logModes channel logFile?");
-  for (i = 0; i < max_logs; i++)
-    if ((logs[i].filename != NULL) && (!strcmp(logs[i].filename, argv[3]))) {
-      logs[i].flags &= ~LF_EXPIRING;
-      logs[i].mask = logmodes(argv[1]);
-      nfree(logs[i].chname);
-      logs[i].chname = NULL;
-      if (!logs[i].mask) {
-	/* ending logfile */
-	nfree(logs[i].filename);
-	logs[i].filename = NULL;
-	if (logs[i].f != NULL) {
-	  fclose(logs[i].f);
-	  logs[i].f = NULL;
-	}
-        logs[i].flags = 0;
-      } else {
-	logs[i].chname = (char *) nmalloc(strlen(argv[2]) + 1);
-	strcpy(logs[i].chname, argv[2]);
-      }
-      Tcl_AppendResult(interp, argv[3], NULL);
-      return TCL_OK;
-    }
-  /* Do not add logfiles without any flags to log ++rtc */
-  if (!logmodes (argv [1])) {
-    Tcl_AppendResult (interp, "can't remove \"", argv[3],
-                     "\" from list: no such logfile", NULL);
-    return TCL_ERROR;
-  }
-  for (i = 0; i < max_logs; i++)
-    if (logs[i].filename == NULL) {
-      logs[i].flags = 0;
-      logs[i].mask = logmodes(argv[1]);
-      logs[i].filename = (char *) nmalloc(strlen(argv[3]) + 1);
-      strcpy(logs[i].filename, argv[3]);
-      logs[i].chname = (char *) nmalloc(strlen(argv[2]) + 1);
-      strcpy(logs[i].chname, argv[2]);
-      Tcl_AppendResult(interp, argv[3], NULL);
-      return TCL_OK;
-    }
-  Tcl_AppendResult(interp, "reached max # of logfiles", NULL);
-  return TCL_ERROR;
-}
-#endif
 static int tcl_putlog STDVAR
 {
   char logtext[501];
@@ -113,60 +37,7 @@ static int tcl_putlog STDVAR
   putlog(LOG_MISC, "*", "%s", logtext);
   return TCL_OK;
 }
-static int tcl_putlogl STDVAR
-{
-  char logtext[501];
-
-  BADARGS(2, 2, " text");
-  strncpyz(logtext, argv[1], sizeof logtext);
-  putlog(LOG_MISC, "@", "%s", logtext);
-  return TCL_OK;
-}
-
-static int tcl_putcmdlog STDVAR
-{
-  char logtext[501];
-
-  BADARGS(2, 2, " text");
-  strncpyz(logtext, argv[1], sizeof logtext);
-  putlog(LOG_CMDS, "*", "%s", logtext);
-  return TCL_OK;
-}
-static int tcl_putcmdlogl STDVAR
-{
-  char logtext[501];
 
-  BADARGS(2, 2, " text");
-  strncpyz(logtext, argv[1], sizeof logtext);
-  putlog(LOG_CMDS, "@", "%s", logtext);
-  return TCL_OK;
-}
-
-static int tcl_putxferlog STDVAR
-{
-  char logtext[501];
-
-  BADARGS(2, 2, " text");
-  strncpyz(logtext, argv[1], sizeof logtext);
-  putlog(LOG_FILES, "*", "%s", logtext);
-  return TCL_OK;
-}
-
-static int tcl_putloglev STDVAR
-{
-  int lev = 0;
-  char logtext[501];
-
-  BADARGS(4, 4, " level channel text");
-  lev = logmodes(argv[1]);
-  if (!lev) {
-    Tcl_AppendResult(irp, "No valid log-level given", NULL);
-    return TCL_ERROR;
-  }
-  strncpyz(logtext, argv[3], sizeof logtext);
-  putlog(lev, argv[2], "%s", logtext);
-  return TCL_OK;
-}
 static int tcl_binds STDVAR
 {
   tcl_bind_list_t	*tl, *tl_kind;
@@ -217,6 +88,7 @@ static int tcl_binds STDVAR
   }
   return TCL_OK;
 }
+
 static int tcl_timer STDVAR
 {
   unsigned long x;
@@ -564,15 +436,7 @@ tcl_cmds tclmisc_objcmds[] =
 
 tcl_cmds tclmisc_cmds[] =
 {
-#ifdef HUB
-  {"logfile",           tcl_logfile},
-#endif
   {"putlog",		tcl_putlog},
-  {"putlogl",		tcl_putlogl},
-  {"putcmdlog",		tcl_putcmdlog},
-  {"putcmdlogl",	tcl_putcmdlogl},
-  {"putxferlog",	tcl_putxferlog},
-  {"putloglev",		tcl_putloglev},
   {"timer",		tcl_timer},
   {"utimer",		tcl_utimer},
   {"killtimer",		tcl_killtimer},