1
0
Эх сурвалжийг харах

* Added a log.c/log.h and moved logging functions there.

svn: 643
Bryan Drewery 22 жил өмнө
parent
commit
40e8319a95
10 өөрчлөгдсөн 363 нэмэгдсэн , 333 устгасан
  1. 1 0
      src/Makefile.in
  2. 0 3
      src/chanprog.h
  3. 2 0
      src/common.h
  4. 12 0
      src/dccutil.h
  5. 0 46
      src/eggdrop.h
  6. 1 186
      src/flags.c
  7. 301 0
      src/log.c
  8. 46 0
      src/log.h
  9. 0 97
      src/misc.c
  10. 0 1
      src/misc.h

+ 1 - 0
src/Makefile.in

@@ -28,6 +28,7 @@ OBJS = auth.o \
 	egg_timer.o \
 	flags.o \
 	garble.o \
+	log.o \
 	main.o \
 	match.o \
 	misc.o \

+ 0 - 3
src/chanprog.h

@@ -7,10 +7,7 @@ void checkchans(int);
 void tell_verbose_uptime(int);
 void tell_verbose_status(int);
 void tell_settings(int);
-int logmodes(char *);
 int isowner(char *);
-char *masktype(int);
-char *maskname(int);
 void reaffirm_owners();
 void rehash();
 void reload();

+ 2 - 0
src/common.h

@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "eggdrop.h"
 #include "flags.h"
+#include "log.h"	/* putlog() */
+#include "dccutil.h"	/* dprintf() */
 #include "chan.h"
 #include "compat/compat.h"
 

+ 12 - 0
src/dccutil.h

@@ -15,6 +15,18 @@ struct portmap {
   struct portmap *next;
 };
 
+/* Fake idx's for dprintf - these should be ridiculously large +ve nums
+ */
+#define DP_STDOUT       0x7FF1
+#define DP_LOG          0x7FF2
+#define DP_SERVER       0x7FF3
+#define DP_HELP         0x7FF4
+#define DP_STDERR       0x7FF5
+#define DP_MODE         0x7FF6
+#define DP_MODE_NEXT    0x7FF7
+#define DP_SERVER_NEXT  0x7FF8
+#define DP_HELP_NEXT    0x7FF9
+
 
 #ifndef MAKING_MODS
 void dprintf (int, ...);

+ 0 - 46
src/eggdrop.h

@@ -32,7 +32,6 @@
 
 #define UHOSTMAX    291 + NICKMAX /* 32 (ident) + 3 (\0, !, @) + NICKMAX */
 #define DIRMAX		512	/* paranoia				*/
-#define LOGLINEMAX	867	/* for misc.c/putlog() <cybah>		*/
 #define BADHANDCHARS	"-,+*=:!.@#;$%&"
 
 #define MAX_BOTS     500
@@ -46,7 +45,6 @@
 #define NICKLEN         NICKMAX + 1
 #define UHOSTLEN        UHOSTMAX + 1
 #define DIRLEN          DIRMAX + 1
-#define LOGLINELEN	LOGLINEMAX + 1
 #define NOTENAMELEN     ((HANDLEN * 2) + 1)
 #define BADNICKCHARS	"-,+*=:!.@#;$%&"
 
@@ -112,48 +110,4 @@
 #define FLOOD_GLOBAL_MAX 3
 
 
-/* Logfile display flags
- */
-#define LOG_MSGS     0x000001	/* m   msgs/notice/ctcps		*/
-#define LOG_PUBLIC   0x000002	/* p   public msg/notice/ctcps		*/
-#define LOG_JOIN     0x000004	/* j   channel joins/parts/etc		*/
-#define LOG_MODES    0x000008	/* k   mode changes/kicks/bans		*/
-#define LOG_CMDS     0x000010	/* c   user dcc or msg commands		*/
-#define LOG_MISC     0x000020	/* o   other misc bot things		*/
-#define LOG_BOTS     0x000040	/* b   bot notices			*/
-#define LOG_RAW      0x000080	/* r   raw server stuff coming in	*/
-#define LOG_FILES    0x000100	/* x   file transfer commands and stats	*/
-#define LOG_ERRORS   0x000200	/* e   misc errors               	*/
-#define LOG_ERROR    0x000200	/* e   misc errors               	*/
-#define LOG_GETIN    0x000400	/* g   op system. (Getin)			*/
-#define LOG_WARN     0x000800	/* u   warnings			*/
-#define LOG_WARNING  0x000800	/* u   warnings			*/
-
-//the rest of these can be used for new console modes....
-#define LOG_LEV4     0x001000	/* 4   user log level			*/
-#define LOG_LEV5     0x002000	/* 5   user log level			*/
-#define LOG_LEV6     0x004000	/* 6   user log level			*/
-#define LOG_LEV7     0x008000	/* 7   user log level			*/
-#define LOG_LEV8     0x010000	/* 8   user log level			*/
-#define LOG_SERV     0x020000	/* s   server information		*/
-#define LOG_DEBUG    0x040000	/* d   debug				*/
-#define LOG_WALL     0x080000	/* w   wallops				*/
-#define LOG_SRVOUT   0x100000	/* v   server output			*/
-#define LOG_BOTNET   0x200000	/* t   botnet traffic			*/
-#define LOG_BOTSHARE 0x400000	/* h   share traffic			*/
-#define LOG_ALL      0x7fffff	/* (dump to all logfiles)		*/
-
-
-/* Fake idx's for dprintf - these should be ridiculously large +ve nums
- */
-#define DP_STDOUT       0x7FF1
-#define DP_LOG          0x7FF2
-#define DP_SERVER       0x7FF3
-#define DP_HELP         0x7FF4
-#define DP_STDERR       0x7FF5
-#define DP_MODE         0x7FF6
-#define DP_MODE_NEXT    0x7FF7
-#define DP_SERVER_NEXT  0x7FF8
-#define DP_HELP_NEXT    0x7FF9
-
 #endif				/* _EGG_EGGDROP_H */

+ 1 - 186
src/flags.c

@@ -12,194 +12,9 @@
 #include "userent.h"
 #include "users.h"
 
-extern int		 use_console_r, debug_output, noshare,
-			 allow_dk_cmds;
+extern int		 noshare, allow_dk_cmds;
 extern struct dcc_t	*dcc;
 
-int	use_console_r = 1;	/* Allow users to set their console +r	*/
-
-
-int logmodes(char *s)
-{
-  int i;
-  int res = 0;
-
-  for (i = 0; i < strlen(s); i++)
-    switch (s[i]) {
-    case 'm':
-    case 'M':
-      res |= LOG_MSGS;
-      break;
-    case 'p':
-    case 'P':
-      res |= LOG_PUBLIC;
-      break;
-    case 'j':
-    case 'J':
-      res |= LOG_JOIN;
-      break;
-    case 'k':
-    case 'K':
-      res |= LOG_MODES;
-      break;
-    case 'c':
-    case 'C':
-      res |= LOG_CMDS;
-      break;
-    case 'o':
-    case 'O':
-      res |= LOG_MISC;
-      break;
-    case 'b':
-    case 'B':
-      res |= LOG_BOTS;
-      break;
-    case 'r':
-    case 'R':
-      res |= use_console_r ? LOG_RAW : 0;
-      break;
-    case 'w':
-    case 'W':
-      res |= LOG_WALL;
-      break;
-    case 'x':
-    case 'X':
-      res |= LOG_FILES;
-      break;
-    case 's':
-    case 'S':
-      res |= LOG_SERV;
-      break;
-    case 'd':
-    case 'D':
-      res |= LOG_DEBUG;
-      break;
-    case 'v':
-    case 'V':
-      res |= debug_output ? LOG_SRVOUT : 0;
-      break;
-    case 't':
-    case 'T':
-      res |= debug_output ? LOG_BOTNET : 0;
-      break;
-    case 'h':
-    case 'H':
-      res |= debug_output ? LOG_BOTSHARE : 0;
-      break;
-    case 'e':
-    case 'E': 
-      res |= LOG_ERRORS;
-      break;
-    case 'g':
-    case 'G':
-      res |= LOG_GETIN;
-      break;
-    case 'u':
-    case 'U':
-      res |= LOG_WARN;
-      break;
-    case '*':
-      res |= LOG_ALL;
-      break;
-    }
-  return res;
-}
-
-char *masktype(int x)
-{
-  static char s[24];		/* Change this if you change the levels */
-  char *p = s;
-
-  if (x & LOG_MSGS)
-    *p++ = 'm';
-  if (x & LOG_PUBLIC)
-    *p++ = 'p';
-  if (x & LOG_JOIN)
-    *p++ = 'j';
-  if (x & LOG_MODES)
-    *p++ = 'k';
-  if (x & LOG_CMDS)
-    *p++ = 'c';
-  if (x & LOG_MISC)
-    *p++ = 'o';
-  if (x & LOG_BOTS)
-    *p++ = 'b';
-  if ((x & LOG_RAW) && use_console_r)
-    *p++ = 'r';
-  if (x & LOG_FILES)
-    *p++ = 'x';
-  if (x & LOG_SERV)
-    *p++ = 's';
-  if (x & LOG_DEBUG)
-    *p++ = 'd';
-  if (x & LOG_WALL)
-    *p++ = 'w';
-  if ((x & LOG_SRVOUT) && debug_output)
-    *p++ = 'v';
-  if ((x & LOG_BOTNET) && debug_output)
-    *p++ = 't';
-  if ((x & LOG_BOTSHARE) && debug_output)
-    *p++ = 'h';
-  if (x & LOG_ERRORS)
-    *p++ = 'e';
-  if (x & LOG_GETIN)
-    *p++ = 'g';
-  if (x & LOG_WARN)
-    *p++ = 'u';
-  if (p == s)
-    *p++ = '-';
-  *p = 0;
-  return s;
-}
-
-char *maskname(int x)
-{
-  static char s[207];		/* Change this if you change the levels */
-  int i = 0;
-
-  s[0] = 0;
-  if (x & LOG_MSGS)
-    i += my_strcpy(s, "msgs, ");
-  if (x & LOG_PUBLIC)
-    i += my_strcpy(s + i, "public, ");
-  if (x & LOG_JOIN)
-    i += my_strcpy(s + i, "joins, ");
-  if (x & LOG_MODES)
-    i += my_strcpy(s + i, "kicks/modes, ");
-  if (x & LOG_CMDS)
-    i += my_strcpy(s + i, "cmds, ");
-  if (x & LOG_MISC)
-    i += my_strcpy(s + i, "misc, ");
-  if (x & LOG_BOTS)
-    i += my_strcpy(s + i, "bots, ");
-  if ((x & LOG_RAW) && use_console_r)
-    i += my_strcpy(s + i, "raw, ");
-  if (x & LOG_FILES)
-    i += my_strcpy(s + i, "files, ");
-  if (x & LOG_SERV)
-    i += my_strcpy(s + i, "server, ");
-  if (x & LOG_DEBUG)
-    i += my_strcpy(s + i, "debug, ");
-  if (x & LOG_WALL)
-    i += my_strcpy(s + i, "wallops, ");
-  if ((x & LOG_SRVOUT) && debug_output)
-    i += my_strcpy(s + i, "server output, ");
-  if ((x & LOG_BOTNET) && debug_output)
-    i += my_strcpy(s + i, "botnet traffic, ");
-  if ((x & LOG_BOTSHARE) && debug_output)
-    i += my_strcpy(s + i, "share traffic, ");
-  if (x & LOG_ERRORS)
-    i += my_strcpy(s + i, "errors, ");
-  if (x & LOG_GETIN)
-    i += my_strcpy(s + i, "getin, ");
-  if (x & LOG_WARN)
-    i += my_strcpy(s + i, "warnings, ");
-  if (i)
-    s[i - 2] = 0;
-  else
-    strcpy(s, "none");
-  return s;
-}
 
 /* Some flags are mutually exclusive -- this roots them out
  */

+ 301 - 0
src/log.c

@@ -0,0 +1,301 @@
+/*
+ * log.c -- handles:
+ *
+ *   What else?!
+ *
+ */
+
+#include "common.h"
+#include "log.h"
+#include "tandem.h"
+#include "botmsg.h"
+#include "dcc.h"
+#include "dccutil.h"
+#include "rfc1459.h"
+#include "users.h"
+#include "misc.h"
+
+extern struct userrec   *userlist;
+extern tand_t           *tandbot;
+extern struct dcc_t     *dcc;
+extern int               debug_output, backgrd, term_z, use_stderr,
+			 dcc_total, loading;
+extern struct dcc_t     *dcc;
+extern time_t		now;
+
+
+int	conmask = LOG_MODES | LOG_CMDS | LOG_MISC; /* Console mask */
+int	debug_output = 1;      /* Disply output to server to LOG_SERVEROUT */
+int 	use_console_r = 1;      /* Allow users to set their console +r  */
+
+int logmodes(char *s)
+{
+  int i;
+  int res = 0;
+
+  for (i = 0; i < strlen(s); i++)
+    switch (s[i]) {
+    case 'm':
+    case 'M':
+      res |= LOG_MSGS;
+      break;
+    case 'p':
+    case 'P':
+      res |= LOG_PUBLIC;
+      break;
+    case 'j':
+    case 'J':
+      res |= LOG_JOIN;
+      break;
+    case 'k':
+    case 'K':
+      res |= LOG_MODES;
+      break;
+    case 'c':
+    case 'C':
+      res |= LOG_CMDS;
+      break;
+    case 'o':
+    case 'O':
+      res |= LOG_MISC;
+      break;
+    case 'b':
+    case 'B':
+      res |= LOG_BOTS;
+      break;
+    case 'r':
+    case 'R':
+      res |= use_console_r ? LOG_RAW : 0;
+      break;
+    case 'w':
+    case 'W':
+      res |= LOG_WALL;
+      break;
+    case 'x':
+    case 'X':
+      res |= LOG_FILES;
+      break;
+    case 's':
+    case 'S':
+      res |= LOG_SERV;
+      break;
+    case 'd':
+    case 'D':
+      res |= LOG_DEBUG;
+      break;
+    case 'v':
+    case 'V':
+      res |= debug_output ? LOG_SRVOUT : 0;
+      break;
+    case 't':
+    case 'T':
+      res |= debug_output ? LOG_BOTNET : 0;
+      break;
+    case 'h':
+    case 'H':
+      res |= debug_output ? LOG_BOTSHARE : 0;
+      break;
+    case 'e':
+    case 'E': 
+      res |= LOG_ERRORS;
+      break;
+    case 'g':
+    case 'G':
+      res |= LOG_GETIN;
+      break;
+    case 'u':
+    case 'U':
+      res |= LOG_WARN;
+      break;
+    case '*':
+      res |= LOG_ALL;
+      break;
+    }
+  return res;
+}
+
+char *masktype(int x)
+{
+  static char s[24];		/* Change this if you change the levels */
+  char *p = s;
+
+  if (x & LOG_MSGS)
+    *p++ = 'm';
+  if (x & LOG_PUBLIC)
+    *p++ = 'p';
+  if (x & LOG_JOIN)
+    *p++ = 'j';
+  if (x & LOG_MODES)
+    *p++ = 'k';
+  if (x & LOG_CMDS)
+    *p++ = 'c';
+  if (x & LOG_MISC)
+    *p++ = 'o';
+  if (x & LOG_BOTS)
+    *p++ = 'b';
+  if ((x & LOG_RAW) && use_console_r)
+    *p++ = 'r';
+  if (x & LOG_FILES)
+    *p++ = 'x';
+  if (x & LOG_SERV)
+    *p++ = 's';
+  if (x & LOG_DEBUG)
+    *p++ = 'd';
+  if (x & LOG_WALL)
+    *p++ = 'w';
+  if ((x & LOG_SRVOUT) && debug_output)
+    *p++ = 'v';
+  if ((x & LOG_BOTNET) && debug_output)
+    *p++ = 't';
+  if ((x & LOG_BOTSHARE) && debug_output)
+    *p++ = 'h';
+  if (x & LOG_ERRORS)
+    *p++ = 'e';
+  if (x & LOG_GETIN)
+    *p++ = 'g';
+  if (x & LOG_WARN)
+    *p++ = 'u';
+  if (p == s)
+    *p++ = '-';
+  *p = 0;
+  return s;
+}
+
+char *maskname(int x)
+{
+  static char s[207];		/* Change this if you change the levels */
+  int i = 0;
+
+  s[0] = 0;
+  if (x & LOG_MSGS)
+    i += my_strcpy(s, "msgs, ");
+  if (x & LOG_PUBLIC)
+    i += my_strcpy(s + i, "public, ");
+  if (x & LOG_JOIN)
+    i += my_strcpy(s + i, "joins, ");
+  if (x & LOG_MODES)
+    i += my_strcpy(s + i, "kicks/modes, ");
+  if (x & LOG_CMDS)
+    i += my_strcpy(s + i, "cmds, ");
+  if (x & LOG_MISC)
+    i += my_strcpy(s + i, "misc, ");
+  if (x & LOG_BOTS)
+    i += my_strcpy(s + i, "bots, ");
+  if ((x & LOG_RAW) && use_console_r)
+    i += my_strcpy(s + i, "raw, ");
+  if (x & LOG_FILES)
+    i += my_strcpy(s + i, "files, ");
+  if (x & LOG_SERV)
+    i += my_strcpy(s + i, "server, ");
+  if (x & LOG_DEBUG)
+    i += my_strcpy(s + i, "debug, ");
+  if (x & LOG_WALL)
+    i += my_strcpy(s + i, "wallops, ");
+  if ((x & LOG_SRVOUT) && debug_output)
+    i += my_strcpy(s + i, "server output, ");
+  if ((x & LOG_BOTNET) && debug_output)
+    i += my_strcpy(s + i, "botnet traffic, ");
+  if ((x & LOG_BOTSHARE) && debug_output)
+    i += my_strcpy(s + i, "share traffic, ");
+  if (x & LOG_ERRORS)
+    i += my_strcpy(s + i, "errors, ");
+  if (x & LOG_GETIN)
+    i += my_strcpy(s + i, "getin, ");
+  if (x & LOG_WARN)
+    i += my_strcpy(s + i, "warnings, ");
+  if (i)
+    s[i - 2] = 0;
+  else
+    strcpy(s, "none");
+  return s;
+}
+
+
+/*
+ *    Logging functions
+ */
+
+/* Log something
+ * putlog(level,channel_name,format,...);
+ * Broadcast the log if chname is not '@'
+ */
+void putlog(int type, char *chname, char *format, ...)
+{
+  int idx, tsl = 0;
+  char s[LOGLINELEN], *out = NULL, stamp[34];
+  va_list va;
+#ifdef HUB
+  struct tm *t;
+#endif /* HUB */
+
+  va_start(va, format);
+
+#ifdef HUB
+#ifdef S_UTCTIME
+  t = gmtime(&now);
+#else /* !S_UTCTIME */
+  t = localtime(&now);
+#endif /* S_UTCTIME */
+
+  egg_strftime(stamp, sizeof(stamp) - 2, LOG_TS, t);
+  strcat(stamp, " ");
+  tsl = strlen(stamp);
+#endif /* HUB */
+
+  /* Format log entry at offset 'tsl,' then i can prepend the timestamp */
+  out = s + tsl;
+
+  /* No need to check if out should be null-terminated here,
+   * just do it! <cybah>
+   */
+
+  egg_vsnprintf(out, LOGLINEMAX - tsl, format, va);
+  va_end(va);
+
+  out[LOGLINEMAX - tsl] = 0;
+
+  /* Place the timestamp in the string to be printed */
+  if (out[0]) {
+    strncpy(s, stamp, tsl);
+    out = s;
+  }
+
+  strcat(out, "\n");
+  /* FIXME: WRITE LOG HERE */
+
+  /* broadcast to hubs */
+  if (chname[0] == '*') {
+    char outbuf[LOGLINEMAX] = "";
+
+    egg_snprintf(outbuf, sizeof outbuf, "hl %d %s", type, out);
+    if (userlist && !loading) {
+      tand_t *bot;
+      struct userrec *ubot;
+
+      for (bot = tandbot ; bot; bot = bot->next) {
+        if ((ubot = get_user_by_handle(userlist, bot->bot))) {
+          if (bot_hublevel(ubot) < 999)
+            putbot(ubot->handle, outbuf);
+        }
+      }
+    } else {
+      putallbots(outbuf);
+    }
+  }
+
+  for (idx = 0; idx < dcc_total; idx++) {
+    if ((dcc[idx].type == &DCC_CHAT && !dcc[idx].simul) && (dcc[idx].u.chat->con_flags & type)) {
+      if ((chname[0] == '@') || (chname[0] == '*') || (dcc[idx].u.chat->con_chan[0] == '*') ||
+          (!rfc_casecmp(chname, dcc[idx].u.chat->con_chan)))
+        dprintf(idx, "%s", out);
+    }
+  }
+
+  if ((!backgrd) && (!term_z)) {
+    dprintf(DP_STDOUT, "%s", out);
+  } else if ((type & LOG_ERRORS) && use_stderr) {
+    out += tsl;
+    dprintf(DP_STDERR, "%s", s);
+  }
+}
+

+ 46 - 0
src/log.h

@@ -0,0 +1,46 @@
+#ifndef _LOG_H
+#define _LOG_H
+
+#define LOGLINEMAX     867     
+#define LOGLINELEN     LOGLINEMAX + 1
+
+/* Logfile display flags
+ */
+#define LOG_MSGS     0x000001   /* m   msgs/notice/ctcps                */
+#define LOG_PUBLIC   0x000002   /* p   public msg/notice/ctcps          */
+#define LOG_JOIN     0x000004   /* j   channel joins/parts/etc          */
+#define LOG_MODES    0x000008   /* k   mode changes/kicks/bans          */
+#define LOG_CMDS     0x000010   /* c   user dcc or msg commands         */
+#define LOG_MISC     0x000020   /* o   other misc bot things            */
+#define LOG_BOTS     0x000040   /* b   bot notices                      */
+#define LOG_RAW      0x000080   /* r   raw server stuff coming in       */
+#define LOG_FILES    0x000100   /* x   file transfer commands and stats */
+#define LOG_ERRORS   0x000200   /* e   misc errors                      */
+#define LOG_ERROR    0x000200   /* e   misc errors                      */
+#define LOG_GETIN    0x000400   /* g   op system. (Getin)                       */
+#define LOG_WARN     0x000800   /* u   warnings                 */
+#define LOG_WARNING  0x000800   /* u   warnings                 */
+
+//the rest of these can be used for new console modes....
+#define LOG_LEV4     0x001000   /* 4   user log level                   */
+#define LOG_LEV5     0x002000   /* 5   user log level                   */
+#define LOG_LEV6     0x004000   /* 6   user log level                   */
+#define LOG_LEV7     0x008000   /* 7   user log level                   */
+#define LOG_LEV8     0x010000   /* 8   user log level                   */
+#define LOG_SERV     0x020000   /* s   server information               */
+#define LOG_DEBUG    0x040000   /* d   debug                            */
+#define LOG_WALL     0x080000   /* w   wallops                          */
+#define LOG_SRVOUT   0x100000   /* v   server output                    */
+#define LOG_BOTNET   0x200000   /* t   botnet traffic                   */
+#define LOG_BOTSHARE 0x400000   /* h   share traffic                    */
+#define LOG_ALL      0x7fffff   /* (dump to all logfiles)               */
+
+
+#ifndef MAKING_MODS
+void putlog (int, char *, char *, ...);
+int logmodes(char *);
+char *masktype(int);
+char *maskname(int);
+#endif /* !MAKING_MODS */
+
+#endif /* !_LOG_H */

+ 0 - 97
src/misc.c

@@ -50,7 +50,6 @@
 extern struct userrec 	*userlist;
 extern struct dcc_t	*dcc;
 extern struct chanset_t	*chanset;
-extern tand_t 		*tandbot;
 
 extern char		 version[], origbotname[], botname[],
 			 admin[], network[], motdfile[], ver[], botnetnick[],
@@ -69,10 +68,6 @@ extern struct cfg_entry	CFG_MOTD, CFG_LOGIN, CFG_BADPROCESS, CFG_PROCESSLIST, CF
 
 void detected(int, char *);
 
-int	 shtime = 1;		/* Whether or not to display the time
-				   with console output */
-int	 conmask = LOG_MODES | LOG_CMDS | LOG_MISC; /* Console mask */
-int	 debug_output = 1;	/* Disply output to server to LOG_SERVEROUT */
 int 	 server_lag = 0;	/* GUESS! */
 
 /*
@@ -554,98 +549,6 @@ int getting_users()
   return 0;
 }
 
-/*
- *    Logging functions
- */
-
-/* Log something
- * putlog(level,channel_name,format,...);
- */
-void putlog(int type, char *chname, char *format, ...)
-{
-  int i, tsl = 0, dohl = 0; //hl
-  char s[LOGLINELEN], *out = NULL, stamp[34], buf2[LOGLINELEN]; 
-  va_list va;
-#ifdef HUB
-  time_t now2 = time(NULL);
-#endif /* HUB */
-  struct tm *t;
-#ifdef LEAF
-  t = 0;
-#endif /* LEAF */
-  va_start(va, format);
-//The putlog should not be broadcast over bots, @ is *.
-  if ((chname[0] == '*'))
-    dohl = 1;
-#ifdef HUB
-#ifdef S_UTCTIME
-  t = gmtime(&now2);
-#else /* !S_UTCTIME */
-  t = localtime(&now2);
-#endif /* S_UTCTIME */
-  if (shtime) {
-    egg_strftime(stamp, sizeof(stamp) - 2, LOG_TS, t);
-    strcat(stamp, " ");
-   tsl = strlen(stamp);
-  }
-#endif /* HUB */
- 
-
-  /* Format log entry at offset 'tsl,' then i can prepend the timestamp */
-  out = s+tsl;
-
-  /* No need to check if out should be null-terminated here,
-   * just do it! <cybah>
-   */
-
-  egg_vsnprintf(out, LOGLINEMAX - tsl, format, va);
-  va_end(va);
-
-  out[LOGLINEMAX - tsl] = 0;
-
-  /* Place the timestamp in the string to be printed */
-  if ((out[0]) && (shtime)) {
-    strncpy(s, stamp, tsl);
-    out = s;
-  }
-
-  strcat(out, "\n");
-  /* WRITE LOG HERE */
-/* echo line to hubs (not if it was on a +h though)*/
-
-  if (dohl) {
-    tand_t *bot;
-    struct userrec *ubot;
-    sprintf(buf2, "hl %d %s", type, out);
-    if (userlist && !loading) {
-      for (bot = tandbot ;bot ; bot = bot->next) {
-        ubot = get_user_by_handle(userlist, bot->bot);
-        if (ubot) {
-          if (bot_hublevel(ubot) < 999) {
-            putbot(ubot->handle, buf2);
-          }
-        }
-      }
-    } else {
-      putallbots(buf2);
-    }
-  }
-
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_CHAT && !dcc[i].simul) && (dcc[i].u.chat->con_flags & type)) {
-      if ((chname[0] == '@') || (chname[0] == '*') || (dcc[i].u.chat->con_chan[0] == '*') ||
-	  (!rfc_casecmp(chname, dcc[i].u.chat->con_chan)))
-	dprintf(i, "%s", out);
-    }
-  if ((!backgrd) && (!term_z))
-    dprintf(DP_STDOUT, "%s", out);
-  else if ((type & LOG_MISC) && use_stderr) {
-    if (shtime)
-      out += tsl;
-    dprintf(DP_STDERR, "%s", s);
-  }
-}
-
 char *extracthostname(char *hostmask)
 {
   char *p = strrchr(hostmask, '@');

+ 0 - 1
src/misc.h

@@ -92,7 +92,6 @@ int updatebin(int, char *, int);
 int shell_exec(char * cmdline, char * input, char ** output, char ** erroutput);
 int egg_strcatn(char *dst, const char *src, size_t max);
 int my_strcpy(char *, char *);
-void putlog (int, char *, char *, ...);
 int ischanhub();
 int dovoice(struct chanset_t *);
 int dolimit(struct chanset_t *);