Index: ChangeLog
===================================================================
--- ChangeLog	(revision 578923063811aaac872c32fbf07dfbbde5cf868f)
+++ ChangeLog	(revision aac889a55d28c6586a8ad7d7dbd397a6870a211e)
@@ -90,4 +90,6 @@
 	improved 'info' function lists seperate info for zephyr, aim and
 	   also prints all message attributes
+	AIM logging (both in and out) now works
+	Disabled 'addbuddy' and 'delbuddy' for aim since it doesn't work yet
 	
 1.2.8
Index: commands.c
===================================================================
--- commands.c	(revision 65ad0739d37ef1c668cb1440cc31a672f39d7246)
+++ commands.c	(revision aac889a55d28c6586a8ad7d7dbd397a6870a211e)
@@ -892,4 +892,6 @@
       return(NULL);
     }
+    owl_function_makemsg("This function is not yet operational.  Stay tuned.");
+    return(NULL);
     owl_aim_addbuddy(argv[2]);
     owl_function_makemsg("%s added as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g));
@@ -916,4 +918,6 @@
       return(NULL);
     }
+    owl_function_makemsg("This function is not yet operational.  Stay tuned.");
+    return(NULL);
     owl_aim_delbuddy(argv[2]);
     owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g));
Index: functions.c
===================================================================
--- functions.c	(revision 578923063811aaac872c32fbf07dfbbde5cf868f)
+++ functions.c	(revision aac889a55d28c6586a8ad7d7dbd397a6870a211e)
@@ -296,5 +296,5 @@
     j=owl_zwrite_get_numrecips(&z);
     for (i=0; i<j; i++) {
-      owl_log_outgoing(owl_zwrite_get_recip_n(&z, i),
+      owl_log_outgoing_zephyr(owl_zwrite_get_recip_n(&z, i),
 		       owl_editwin_get_text(owl_global_get_typwin(&g)));
     }
@@ -317,11 +317,8 @@
   }
 
-  /* not yet */
-#if 0
   /* log it if we have logging turned on */
   if (owl_global_is_logging(&g)) {
-    owl_log_outgoing(to, owl_editwin_get_text(owl_global_get_typwin(&g)));
-  }
-#endif
+    owl_log_outgoing_aim(to, owl_editwin_get_text(owl_global_get_typwin(&g)));
+  }
 }
 
Index: logging.c
===================================================================
--- logging.c	(revision d09e5a1609d038695dbc6bc34a8177935a9bf7ea)
+++ logging.c	(revision aac889a55d28c6586a8ad7d7dbd397a6870a211e)
@@ -7,5 +7,5 @@
 static const char fileIdent[] = "$Id$";
 
-void owl_log_outgoing(char *to, char *text) {
+void owl_log_outgoing_zephyr(char *to, char *text) {
   FILE *file;
   char filename[MAXPATHLEN], *logpath;
@@ -20,4 +20,44 @@
     *ptr='\0';
   }
+
+  /* expand ~ in path names */
+  logpath = owl_util_substitute(owl_global_get_logpath(&g), "~", 
+				owl_global_get_homedir(&g));
+
+  snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff);
+  file=fopen(filename, "a");
+  if (!file) {
+    owl_function_makemsg("Unable to open file for outgoing logging");
+    owl_free(logpath);
+    return;
+  }
+  fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text);
+  if (text[strlen(text)-1]!='\n') {
+    fprintf(file, "\n");
+  }
+  fclose(file);
+
+  snprintf(filename, MAXPATHLEN, "%s/all", logpath);
+  owl_free(logpath);
+  file=fopen(filename, "a");
+  if (!file) {
+    owl_function_makemsg("Unable to open file for outgoing logging");
+    return;
+  }
+  fprintf(file, "OUTGOING (owl): %s\n%s\n", tobuff, text);
+  if (text[strlen(text)-1]!='\n') {
+    fprintf(file, "\n");
+  }
+  fclose(file);
+
+  owl_free(tobuff);
+}
+
+void owl_log_outgoing_aim(char *to, char *text) {
+  FILE *file;
+  char filename[MAXPATHLEN], *logpath;
+  char *tobuff, *ptr;
+
+  tobuff=owl_sprintf("aim:%s", to);
 
   /* expand ~ in path names */
@@ -59,7 +99,4 @@
   char *frombuff, *ptr, *from, *buff, *tmp;
   int len, ch, i, personal;
-
-  /* we only do zephyrs right now */
-  if (!owl_message_is_type_zephyr(m)) return;
       
   /* check for nolog */
@@ -67,21 +104,40 @@
       !strcasecmp(owl_message_get_instance(m), "nolog")) return;
 
-  if (owl_message_is_personal(m)) {
-    personal=1;
-    if (!owl_global_is_logging(&g)) return;
+  /* this is kind of a mess */
+  if (owl_message_is_type_zephyr(m)) {
+    if (owl_message_is_personal(m)) {
+      personal=1;
+      if (!owl_global_is_logging(&g)) return;
+    } else {
+      personal=0;
+      if (!owl_global_is_classlogging(&g)) return;
+    }
   } else {
-    personal=0;
-    if (!owl_global_is_classlogging(&g)) return;
-  }
-
-  if (personal) {
-    from=frombuff=owl_strdup(owl_message_get_sender(m));
-    /* chop off a local realm */
-    ptr=strchr(frombuff, '@');
-    if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) {
-      *ptr='\0';
-    }
-  } else {
-    from=frombuff=owl_strdup(owl_message_get_class(m));
+    if (owl_message_is_private(m)) {
+      personal=1;
+      if (!owl_global_is_logging(&g)) return;
+    } else {
+      personal=0;
+      if (!owl_global_is_classlogging(&g)) return;
+    }
+  }
+
+  if (owl_message_is_type_zephyr(m)) {
+    /* chop off a local realm for personal zephyr messages */
+    if (personal) {
+      if (owl_message_is_type_zephyr(m)) {
+	from=frombuff=owl_strdup(owl_message_get_sender(m));
+	ptr=strchr(frombuff, '@');
+	if (ptr && !strncmp(ptr+1, ZGetRealm(), strlen(ZGetRealm()))) {
+	  *ptr='\0';
+	}
+      }
+    } else {
+      /* we assume zephyr for now */
+      from=frombuff=owl_strdup(owl_message_get_class(m));
+    }
+  } else if (owl_message_is_type_aim(m)) {
+    /* we do not yet handle chat rooms */
+    from=frombuff=owl_sprintf("aim:%s", owl_message_get_sender(m));
   }
   
@@ -134,30 +190,45 @@
   }
 
-  tmp=short_zuser(owl_message_get_sender(m));
-  
-  fprintf(file, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m));
-  if (strcmp(owl_message_get_opcode(m), "")) fprintf(file, " Opcode: %s", owl_message_get_opcode(m));
-  fprintf(file, "\n");
-  fprintf(file, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m));
-  ptr=owl_zephyr_get_zsig(owl_message_get_notice(m), &i);
-  buff=owl_malloc(i+10);
-  memcpy(buff, ptr, i);
-  buff[i]='\0';
-  fprintf(file, "From: %s <%s>\n\n", buff, tmp);
-  fprintf(file, "%s\n", owl_message_get_body(m));
-  fclose(file);
-
+  /* write to the main file */
+  if (owl_message_is_type_zephyr(m)) {
+    tmp=short_zuser(owl_message_get_sender(m));
+    fprintf(file, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m));
+    if (strcmp(owl_message_get_opcode(m), "")) fprintf(file, " Opcode: %s", owl_message_get_opcode(m));
+    fprintf(file, "\n");
+    fprintf(file, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m));
+    ptr=owl_zephyr_get_zsig(owl_message_get_notice(m), &i);
+    buff=owl_malloc(i+10);
+    memcpy(buff, ptr, i);
+    buff[i]='\0';
+    fprintf(file, "From: %s <%s>\n\n", buff, tmp);
+    fprintf(file, "%s\n", owl_message_get_body(m));
+  } else if (owl_message_is_type_aim(m)) {
+    fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
+    fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
+    fprintf(file, "%s\n\n", owl_message_get_body(m));
+  }
+  fclose(file);
+
+  /* if it's a personal message, also write to the 'all' file */
   if (personal) {
-    fprintf(allfile, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m));
-    if (strcmp(owl_message_get_opcode(m), "")) fprintf(allfile, " Opcode: %s", owl_message_get_opcode(m));
-    fprintf(allfile, "\n");
-    fprintf(allfile, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m));
-    fprintf(allfile, "From: %s <%s>\n\n", buff, tmp);
-    fprintf(allfile, "%s\n", owl_message_get_body(m));
-    fclose(allfile);
-  }
-
-  owl_free(tmp);
-  owl_free(buff);
+    if (owl_message_is_type_zephyr(m)) {
+      fprintf(allfile, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m));
+      if (strcmp(owl_message_get_opcode(m), "")) fprintf(allfile, " Opcode: %s", owl_message_get_opcode(m));
+      fprintf(allfile, "\n");
+      fprintf(allfile, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m));
+      fprintf(allfile, "From: %s <%s>\n\n", buff, tmp);
+      fprintf(allfile, "%s\n", owl_message_get_body(m));
+      fclose(allfile);
+    } else {
+      fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
+      fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
+      fprintf(file, "%s\n\n", owl_message_get_body(m));
+    }
+  }
+
+  if (owl_message_is_type_zephyr(m)) {
+    owl_free(tmp);
+    owl_free(buff);
+  }
   owl_free(frombuff);
 }
Index: owl.c
===================================================================
--- owl.c	(revision 578923063811aaac872c32fbf07dfbbde5cf868f)
+++ owl.c	(revision aac889a55d28c6586a8ad7d7dbd397a6870a211e)
@@ -297,5 +297,5 @@
     }
 
-    /* grab incoming zephyrs */
+    /* Grab incoming messages. */
     newmsgs=0;
     zpendcount=0;
@@ -348,5 +348,5 @@
 
       /* do we need to autoreply? */
-      if (owl_global_is_zaway(&g)) {
+      if (owl_message_is_type_zephyr(m) && owl_global_is_zaway(&g)) {
 	owl_zephyr_zaway(m);
       }
@@ -370,5 +370,4 @@
 	char *buff;
 	buff = owl_sprintf("@i(Burning ears message on class %s)", owl_message_get_class(m));
-	/* owl_function_makemsg(buff); */
 	owl_function_adminmsg(buff, "");
 	owl_free(buff);
Index: owl_prototypes.h
===================================================================
--- owl_prototypes.h	(revision 578923063811aaac872c32fbf07dfbbde5cf868f)
+++ owl_prototypes.h	(revision aac889a55d28c6586a8ad7d7dbd397a6870a211e)
@@ -567,5 +567,6 @@
 
 /* -------------------------------- logging.c -------------------------------- */
-extern void owl_log_outgoing(char *to, char *text);
+extern void owl_log_outgoing_zephyr(char *to, char *text);
+extern void owl_log_outgoing_aim(char *to, char *text);
 extern void owl_log_incoming(owl_message *m);
 
