diff -Nru lachesis-0.2.5/cmd/authcmd.cc lachesis/cmd/authcmd.cc
--- lachesis-0.2.5/cmd/authcmd.cc	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/cmd/authcmd.cc	2007-04-30 21:14:48.000000000 -0700
@@ -130,7 +130,7 @@
   const char *ts;
 
   if (str==NULL || strchr(str, 32)==NULL)
-    Auth_CmdResult(ticket, auth, "Usage: auth login <acct> <pass>");
+    return Auth_CmdResult(ticket, auth, "Usage: auth login <acct> <pass>");
   ts = str;
   Util_SepTo(acct, ALLOC_ACCT, &ts, 32);
   if (strchr(ts, 32))
diff -Nru lachesis-0.2.5/cmd/logcmd.cc lachesis/cmd/logcmd.cc
--- lachesis-0.2.5/cmd/logcmd.cc	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/cmd/logcmd.cc	2007-04-30 21:24:35.000000000 -0700
@@ -30,7 +30,7 @@
 #include "../lachesis.h"
 #include "../config.h"
 
-static char* id="@(#) $Id: logcmd.cc,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $";
+static char* id="@(#) $Id: logcmd.cc,v 1.1.1.1.2.1 2006/03/08 17:42:43 lachesis Exp $";
 
 extern TF log_active;
 extern FILE *log_file;
@@ -74,6 +74,36 @@
     cmd = data;
     data = NULL;
   }
+  if (strcasecmp(cmd, "RESUME")==0) {
+    if (data==NULL||!*data)
+      Auth_CmdResult(ticket, auth, "Status and filename required.");
+    else {
+      cmd = Util_Separate(&data, 32);
+      if (!cmd)
+	Auth_CmdResult(ticket, auth, "Filename required.");
+      else {
+	int status;
+	if (strcasecmp(cmd, "IN")==0)
+	  status = 3;
+	else if (strcasecmp(cmd, "OUT")==0)
+	  status = 1;
+	else {
+	  Auth_CmdResult(ticket, auth, "Unrecognized status.");
+	  return;
+	}
+	Log_Cleanup();
+	if (options.logfile!=NULL)
+	  free(options.logfile);
+	options.logfile = strdup(data);
+	Log_Init(status);
+	if (log_file==NULL)
+	  Auth_CmdResult(ticket, auth, "Error resuming logfile.");
+	else
+	  Auth_CmdResult(ticket, auth, "Log resumed.");
+      }
+    }
+    return;
+  }
   if (strcasecmp(cmd, "FILE")==0) {
     if (data==NULL||!*data)
       Auth_CmdResult(ticket, auth, "Filename required.");
@@ -82,7 +112,7 @@
       if (options.logfile!=NULL)
 	free(options.logfile);
       options.logfile = strdup(data);
-      Log_Init();
+      Log_Init(0);
       if (log_file==NULL)
 	Auth_CmdResult(ticket, auth, "Invalid or existing filename.");
       else
diff -Nru lachesis-0.2.5/config.h lachesis/config.h
--- lachesis-0.2.5/config.h	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/config.h	2006-05-27 21:42:24.000000000 -0700
@@ -33,7 +33,7 @@
  * Define this to the name of a file where stderr messages will be logged.
  * Saves a bit of hassle trying to redirect this constantly.
  */
-#define STDERR_LOG_FILE "error.log"
+/* #define STDERR_LOG_FILE "error.log" */
 
 /*
  * Defining this will disable checking the userid of the process for
@@ -65,14 +65,25 @@
  * BE IMPOSSIBLE TO LOG IN, thus making the bot unusable. You should
  * probably have this set to something.
  */
-#define DFL_IRCCHAN "#dragoon's-birth"
+#define DFL_IRCCHAN "#lakitu"
+
+/*
+ * This is the default title to use when generating logfiles.
+ */
+#define DFL_LOGTITLE "Final Fantasy XI: Arinoru LS"
 
 /*
  * If this is defined, then Lachesis will try to reconnect to the server
  * instead of cleaning up and exiting when disconnected. I don't think this
  * is fully implemented yet. Use at your own risk.
+ * UPDATE: Recent code audits have addressed this. AUTO_RECONNECT should 
+ * work sanely now. However, Lachesis does not currently 'remember' very
+ * much about its state prior to disconnect; upon reconnect it will 
+ * assume the nick it originally connected under, and join the default
+ * channel just as if it had freshly connected. Logging will however 
+ * continue uninterrupted.
  */
-#undef AUTO_RECONNECT
+#define AUTO_RECONNECT
 
 /*
  * RPGServ only: Defining this will restrict RPGServ's MSG and NOTICE commands
@@ -95,4 +106,4 @@
 
 #endif /* _CONFIG_H_ */
 
-/* @(#) $Id: config.h,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $ */
+/* @(#) $Id: config.h,v 1.1.1.1.2.2 2006/03/12 09:43:10 lachesis Exp $ */
diff -Nru lachesis-0.2.5/docs/api/defines.txt lachesis/docs/api/defines.txt
--- lachesis-0.2.5/docs/api/defines.txt	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/docs/api/defines.txt	2006-03-12 01:43:30.000000000 -0800
@@ -69,6 +69,9 @@
 	to IRC when its current connection is lost. This is not fully
 	implemented yet and most likely will not work how you expect it to.
 	Leave it undefined for now.
+	Update: Recent code audits have addressed this. It should work
+		reasonably now. See comments in config.h for more 
+		details.
 
 DEBUG:			(config.h)
 	If this is defined, Lachesis will spam stderr with a LOT of minor
@@ -123,4 +126,4 @@
 	only if you roll a 1 without any successes. Defining this causes
 	wroll to implement Revised botching.
 
-@(#) $Id: defines.txt,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $
+@(#) $Id: defines.txt,v 1.1.1.1.2.1 2006/03/12 09:43:30 lachesis Exp $
diff -Nru lachesis-0.2.5/irc-native.c lachesis/irc-native.c
--- lachesis-0.2.5/irc-native.c	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/irc-native.c	2008-04-08 22:25:58.000000000 -0700
@@ -45,7 +45,7 @@
 #include "config.h"
 #undef _IN_LOWLEVEL_INTERFACE
 
-static char* id="@(#) $Id: irc-native.c,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $";
+static char* id="@(#) $Id: irc-native.c,v 1.1.1.1.2.1 2006/03/12 08:49:47 lachesis Exp $";
 
 fd_set *lin_read_fds = NULL;
 int lin_fd = -1;
@@ -864,6 +864,7 @@
 #endif
 }
 
+#if 0
 void OnPing(const char *str)
 {
   char server[ALLOC_HOST];
@@ -876,6 +877,13 @@
   else
     fdprintf(lin_fd, "PONG %s %s\r\n", lin_our_nick, server);
 }
+#else
+//Seems this syntax was abandoned at some point.
+void OnPing(const char *str)
+{
+  fdprintf(lin_fd, "PONG %s\r\n", str);
+}
+#endif
 
 struct strtofunc_map {
   const char *str;
@@ -932,6 +940,9 @@
 	Util_Eprintf("Error reading socket: %m\n");
 	// This is normal for a lost connection. Normal shutdown.
 	IRC_Disconnect(FALSE);
+#ifdef AUTO_RECONNECT
+	return;
+#endif
       }
       *(strchr(lin_input, '\n'))=0;
       ptr = strchr(lin_input, '\r');
diff -Nru lachesis-0.2.5/irc.cc lachesis/irc.cc
--- lachesis-0.2.5/irc.cc	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/irc.cc	2006-03-12 01:20:44.000000000 -0800
@@ -30,7 +30,7 @@
 #include "log.h"
 #include "config.h"
 
-static char* id="@(#) $Id: irc.cc,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $";
+static char* id="@(#) $Id: irc.cc,v 1.1.1.1.2.3 2006/03/12 09:20:44 lachesis Exp $";
 
 extern CmdOpts options;
 extern const char *SOFTWARE_NAME;
@@ -432,14 +432,15 @@
     free(irc_curchan);
     irc_curchan = NULL;
 #ifdef AUTO_RECONNECT
-    if (!flag && irc_interface_active)
-      HLIRC_BeginIRCInterface();
-#else
-    irc_interface_active = FALSE;
-    Shutdown();
+    if (flag || !irc_interface_active) {
+#endif
+      irc_interface_active = FALSE;
+      Shutdown();
+#ifdef AUTO_RECONNECT
+    }
 #endif
   }
-
+  // In the event we're supposed to reconnect, fall through here.
 }
 
 void HLIRC_BeginIRCInterface()
@@ -449,7 +450,6 @@
 #ifdef DEBUG
   Util_Eputs("DEBUG - HLIRC_BeginIRCInterface called\n");
 #endif
-  Log_Init();
   if (irc_curchan==NULL) {
     irc_curchan = (char *)(malloc(ALLOC_CHAN));
     *irc_curchan = 0;
@@ -478,7 +478,12 @@
     port = 6667;
 
   irc_interface_active = TRUE;
-  IRC_Connect(server, port, nick, user, name);
+#ifdef AUTO_RECONNECT
+  // To avoid cluttering the stack, we let the low-level interface bail out
+  // and then restart it.
+  while (1)
+#endif
+    IRC_Connect(server, port, nick, user, name);
 }
 
 void HLIRC_EndIRCInterface()
diff -Nru lachesis-0.2.5/lachesis.cc lachesis/lachesis.cc
--- lachesis-0.2.5/lachesis.cc	2004-03-16 21:35:53.000000000 -0800
+++ lachesis/lachesis.cc	2006-03-12 19:47:35.000000000 -0800
@@ -26,13 +26,14 @@
 #include <pwd.h>
 #include <signal.h>
 #include <time.h>
+#include "log.h"
 #include "lachesis.h"
 #include "utils.h"
 #include "irc.h"
 #include "auth.h"
 #include "config.h"
 
-static char* id="$(#) $Id: lachesis.cc,v 1.1.1.1.2.2 2004/03/17 05:35:53 lachesis Exp $";
+static char* id="$(#) $Id: lachesis.cc,v 1.1.1.1.2.3 2006/03/12 09:20:44 lachesis Exp $";
 
 CmdOpts options;
 
@@ -318,7 +319,7 @@
 #ifdef RPGSERV
       Util_Copy(options.single, optarg, ALLOC_ACCT);
 #else
-      fputs("Invalid argument.\n");
+      fputs("Invalid argument.\n", stderr);
       exit (EXIT_FAILURE);
 #endif
       break;
@@ -421,6 +422,7 @@
 
   // Launch the various sections of the program.
   Auth_Init();
+  Log_Init(0);
   HLIRC_BeginIRCInterface();
   // This should not return.
   Util_Eputs("Error: HLIRC_BeginIRCInterface returned!\n");
diff -Nru lachesis-0.2.5/log.cc lachesis/log.cc
--- lachesis-0.2.5/log.cc	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/log.cc	2007-03-20 20:25:01.000000000 -0700
@@ -27,15 +27,13 @@
 #include "utils.h"
 #include "config.h"
 
-static char* id="@(#) $Id: log.cc,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $";
+static char* id="@(#) $Id: log.cc,v 1.1.1.1.2.2 2006/03/08 17:42:10 lachesis Exp $";
 
 extern CmdOpts options;
 FILE *log_file = NULL;
 TF log_active = FALSE;
 TF log_bquote = FALSE;
 
-#define DFL_LOGTITLE "Final Fantasy: Dragoon's Birth"
-
 enum {
   LOG_LINE,
   LOG_DESC,
@@ -43,20 +41,29 @@
   LOG_FIX,
 };
 
-void Log_Init()
+void Log_Init(int status)
 {
   if (options.logfile==NULL||*options.logfile=='\0')
     return;
-  log_file = fopen(options.logfile, "wx");
-  if (log_file==NULL) {
-    Util_Eprintf("Failed to create logfile %s: %m\n", options.logfile);
-    return;
+  if (status==0) {
+    log_file = fopen(options.logfile, "wx");
+    if (log_file==NULL) {
+      Util_Eprintf("Failed to create logfile %s: %m\n", options.logfile);
+      return;
+    }
+    log_bquote = FALSE;
+    fprintf(log_file, "<HTML><HEAD>\n<TITLE>%s</TITLE>\n</HEAD><BODY>\n",
+	    (*options.logtitle=='\0') ? DFL_LOGTITLE : options.logtitle);
+    fflush(log_file);
+  } else {
+    log_file = fopen(options.logfile, "a");
+    if (log_file==NULL) {
+      Util_Eprintf("Failed to resume logfile %s: %m\n", options.logfile);
+      return;
+    }
+    log_bquote = status >> 1;
   }
   //  log_active = TRUE;
-  log_bquote = FALSE;
-  fprintf(log_file, "<HTML><HEAD>\n<TITLE>%s</TITLE>\n</HEAD><BODY>\n",
-	  (*options.logtitle=='\0') ? DFL_LOGTITLE : options.logtitle);
-  fflush(log_file);
 }
 
 void Log_Cleanup()
@@ -113,7 +120,8 @@
 	  out[d+2] = '>';
 	  d+=3;
 	  c+=3;
-	}
+	} else
+	  out[d++] = in[c++];
 	break;
       case 2:
       case 15:
diff -Nru lachesis-0.2.5/log.h lachesis/log.h
--- lachesis-0.2.5/log.h	2004-01-15 23:28:15.000000000 -0800
+++ lachesis/log.h	2006-03-08 09:42:10.000000000 -0800
@@ -23,7 +23,7 @@
 #include "auth.h"
 #include "types.h"
 
-void Log_Init();
+void Log_Init(int status);
 void Log_Cleanup();
 void Log_CommitComment(const char *);
 void Log_CommitDescription(const char *);
@@ -35,4 +35,4 @@
 
 #endif
 
-/* @(#) $Id: log.h,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $ */
+/* @(#) $Id: log.h,v 1.1.1.1.2.1 2006/03/08 17:42:10 lachesis Exp $ */
