Index: Makefile.in
===================================================================
--- Makefile.in	(revision d09e5a1609d038695dbc6bc34a8177935a9bf7ea)
+++ Makefile.in	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
@@ -34,6 +34,6 @@
 OBJS = $(BASE_OBJS) $(GEN_O)
 
-#AUTOGEN=$(GEN_C) $(GEN_H)
-AUTOGEN=$(GEN_C)
+AUTOGEN=$(GEN_C) $(GEN_H)
+#AUTOGEN=$(GEN_C)
 
 
@@ -53,5 +53,5 @@
 	$(RM) config.cache config.log config.status Makefile config.h TAGS *~ core
 
-#proto: owl_prototypes.h
+proto: owl_prototypes.h
 
 perlglue.c: perlglue.xs
@@ -62,11 +62,11 @@
 
 # Only move owl_prototypes.h into place if the new one is different
-#owl_prototypes.h: codelist.pl varstubs.c $(BASE_SRCS)
-#	perl codelist.pl | grep -v ZWRITEOPTIONS > owl_prototypes.h.new
-#	@cmp -s owl_prototypes.h.new $@ || { \
-#	 echo 'Interfaces changed!'; \
-#	 echo mv -f owl_prototypes.h.new $@; \
-#	      mv -f owl_prototypes.h.new $@; }
-owl_prototypes.h:
+owl_prototypes.h: codelist.pl varstubs.c $(BASE_SRCS)
+	perl codelist.pl > owl_prototypes.h.new
+	@cmp -s owl_prototypes.h.new $@ || { \
+	 echo 'Interfaces changed!'; \
+	 echo mv -f owl_prototypes.h.new $@; \
+	      mv -f owl_prototypes.h.new $@; }
+#owl_prototypes.h:
 
 .PHONY: tags clean distclean proto test
@@ -77,6 +77,6 @@
 	etags $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H)
 
-#$(BASE_OBJS) varstubs.h:: owl.h config.h owl_prototypes.h
-$(BASE_OBJS) varstubs.h:: owl.h config.h
+$(BASE_OBJS) varstubs.h:: owl.h config.h owl_prototypes.h
+#$(BASE_OBJS) varstubs.h:: owl.h config.h
 
 libfaim: libfaim/libfaim.a
Index: aim.c
===================================================================
--- aim.c	(revision 440ce0128879af680216691261571cf7a278f993)
+++ aim.c	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
@@ -26,4 +26,5 @@
 };
 
+/*
 static char *msgerrreasons[] = {
 	"Invalid error",
@@ -54,4 +55,5 @@
 };
 static int msgerrreasonslen = 25;
+*/
 
 static void faimtest_debugcb(aim_session_t *sess, int level, const char *format, va_list va);
@@ -168,4 +170,7 @@
 {
   aim_send_im(owl_global_get_aimsess(&g), to, AIM_IMFLAGS_ACK, msg);
+
+  /* I don't know how to check for an error yet */
+  return(0);
 }
 
@@ -180,8 +185,8 @@
 int owl_aim_chat_sendmsg(char *chatroom, char *msg)
 {
+  return(0);
 }
 
 int owl_aim_process_events() {
-  int ret;
   aim_session_t *aimsess;
   aim_conn_t *waitingconn = NULL;
@@ -241,4 +246,5 @@
   /* free(priv->buddyicon); */
   /* exit(0); */
+  return(0);
 }
 
@@ -386,5 +392,4 @@
 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...)
 {
-  struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
   char buddies[128]; /* this is the new buddy list */
   char profile[256]; /* this is the new profile */
@@ -406,5 +411,5 @@
 
   /*aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE | AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS | AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_ICQ | AIM_CAPS_ICQUNKNOWN | AIM_CAPS_ICQRTF | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_TRILLIANCRYPT); */
-  aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_CHAT | AIM_CAPS_ICQ | AIM_CAPS_ICQUNKNOWN | AIM_CAPS_ICQRTF | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_TRILLIANCRYPT);
+  aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_CHAT );
   aim_bos_reqbuddyrights(sess, fr->conn);
 
@@ -473,6 +478,4 @@
 int logout(aim_session_t *sess)
 {
-  struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
-
   aim_session_kill(sess);
 
@@ -674,4 +677,8 @@
 static int faimtest_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...)
 {
+  char *msg;
+  fu16_t id;
+  va_list ap;
+  /* static int codeslen = 5;
   static char *codes[] = {
     "Unknown",
@@ -681,9 +688,6 @@
     "Top o' the world!"
   };
-  static int codeslen = 5;
-  char *msg;
-  fu16_t id;
-  va_list ap;
-  
+  */
+
   return 1;
   
@@ -1462,4 +1466,5 @@
 static int faimtest_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...)
 {
+  /*
   static char *missedreasons[] = {
     "Invalid (0)",
@@ -1469,5 +1474,5 @@
     "Evil Receiver"
   };
-  static int missedreasonslen = 5;
+  static int missedreasonslen = 5; */
   
   va_list ap;
@@ -1508,4 +1513,5 @@
 static int faimtest_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...)
 {
+  /*
   static char *codes[5] = {
     "invalid",
@@ -1515,4 +1521,5 @@
     "limit cleared"
   };
+  */
   va_list ap;
   fu16_t code, rateclass;
@@ -1587,5 +1594,6 @@
   va_list ap;
   char *address, *SNs;
-  int i, num;
+  int num;
+  /* int i; */
   
   va_start(ap, fr);
@@ -1748,5 +1756,6 @@
   va_list ap;
   aim_userinfo_t *userinfo;
-  int count, i;
+  int count;
+  /* int i; */
   
   va_start(ap, fr);
@@ -1765,7 +1774,9 @@
 static int faimtest_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...)
 {
-  va_list ap;
   aim_userinfo_t *userinfo;
-  int count , i;
+  va_list ap;
+  int count;
+  /* int i; */
+
   
   va_start(ap, fr);
@@ -1789,9 +1800,10 @@
   struct aim_chat_roominfo *roominfo;
   char *roomname;
-  int usercount, i;
+  int usercount;
   char *roomdesc;
   fu16_t flags, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
   fu32_t creationtime;
   const char *croomname;
+  /* int i; */
   
   croomname = aim_chat_getname(fr->conn);
@@ -1875,5 +1887,6 @@
     int maxrooms;
     struct aim_chat_exchangeinfo *exchanges;
-    int exchangecount, i;
+    int exchangecount;
+    /* int i; */
     
     maxrooms = va_arg(ap, int);
Index: codelist.pl
===================================================================
--- codelist.pl	(revision 4594d83a1b2c714c7af2ee461bd2ec0917415585)
+++ codelist.pl	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
@@ -20,5 +20,8 @@
 	    && !/^system/
 	    && !/^XS/
-	    && !/\/\*/) {
+	    && !/\/\*/
+	    && !/ZWRITEOPTIONS/
+	    && !/owlfaim_priv/) 
+	{
 	    s/\s+\{/\;/;
 	    s/\)[ \t]*$/\)\;/;
Index: commands.c
===================================================================
--- commands.c	(revision d09e5a1609d038695dbc6bc34a8177935a9bf7ea)
+++ commands.c	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
@@ -1376,5 +1376,5 @@
 
 char *owl_command_aimwrite(int argc, char **argv, char *buff) {
-  char *tmpbuff, *pos, *cmd, *msg;
+  char *tmpbuff;
 
   if (argc < 2) {
Index: functions.c
===================================================================
--- functions.c	(revision 440ce0128879af680216691261571cf7a278f993)
+++ functions.c	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
@@ -1297,6 +1297,16 @@
   owl_fmtext_append_normal(&fm, "\n");
 
+  owl_fmtext_append_normal(&fm, "Sender    : ");
+  owl_fmtext_append_normal(&fm, owl_message_get_sender(m));
+  owl_fmtext_append_normal(&fm, "\n");
+
+  owl_fmtext_append_normal(&fm, "Recipient : ");
+  owl_fmtext_append_normal(&fm, owl_message_get_recipient(m));
+  owl_fmtext_append_normal(&fm, "\n");
+
+
   if (owl_message_is_type_zephyr(m)) {
-
+    owl_fmtext_append_bold(&fm, "  Zephyr Specific Info\n");
+    
     if (owl_message_is_direction_in(m)) {
       n=owl_message_get_notice(m);
@@ -1306,10 +1316,4 @@
       owl_fmtext_append_normal(&fm, "Instance  : ");
       owl_fmtext_append_normal(&fm, owl_message_get_instance(m));
-      owl_fmtext_append_normal(&fm, "\n");
-      owl_fmtext_append_normal(&fm, "Sender    : ");
-      owl_fmtext_append_normal(&fm, owl_message_get_sender(m));
-      owl_fmtext_append_normal(&fm, "\n");
-      owl_fmtext_append_normal(&fm, "Recipient : ");
-      owl_fmtext_append_normal(&fm, owl_message_get_recipient(m));
       owl_fmtext_append_normal(&fm, "\n");
       owl_fmtext_append_normal(&fm, "Opcode    : ");
@@ -1384,5 +1388,4 @@
 	}
 	
-	/* just for testing for now */
 	for (j=0; j<strlen(tmpbuff); j++) {
 	  if (tmpbuff[j]=='\n') tmpbuff[j]='~';
@@ -1397,4 +1400,8 @@
       owl_fmtext_append_normal(&fm, n->z_default_format);
     }
+  }
+
+  if (owl_message_is_type_aim(m)) {
+
   }
   
Index: message.c
===================================================================
--- message.c	(revision 440ce0128879af680216691261571cf7a278f993)
+++ message.c	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
@@ -14,5 +14,6 @@
 static const char fileIdent[] = "$Id$";
 
-void owl_message_init(owl_message *m) {
+void owl_message_init(owl_message *m)
+{
   time_t t;
 
@@ -32,5 +33,6 @@
 }
 
-void owl_message_set_attribute(owl_message *m, char *attrname, char *attrvalue) {
+void owl_message_set_attribute(owl_message *m, char *attrname, char *attrvalue)
+{
   /* add the named attribute to the message.  If an attribute with the
      name already exists, replace the old value with the new value */
@@ -58,5 +60,6 @@
 }
 
-char *owl_message_get_attribute_value(owl_message *m, char *attrname) {
+char *owl_message_get_attribute_value(owl_message *m, char *attrname)
+{
   /* return the value associated with the named attribute, or NULL if
      the attribute does not exist */
@@ -76,13 +79,16 @@
 
 
-owl_fmtext *owl_message_get_fmtext(owl_message *m) {
+owl_fmtext *owl_message_get_fmtext(owl_message *m)
+{
   return(&(m->fmtext));
 }
 
-void owl_message_set_class(owl_message *m, char *class) {
+void owl_message_set_class(owl_message *m, char *class)
+{
   owl_message_set_attribute(m, "class", class);
 }
 
-char *owl_message_get_class(owl_message *m) {
+char *owl_message_get_class(owl_message *m)
+{
   char *class;
 
@@ -92,9 +98,11 @@
 }
 
-void owl_message_set_instance(owl_message *m, char *inst) {
+void owl_message_set_instance(owl_message *m, char *inst)
+{
   owl_message_set_attribute(m, "instance", inst);
 }
 
-char *owl_message_get_instance(owl_message *m) {
+char *owl_message_get_instance(owl_message *m)
+{
   char *instance;
 
@@ -104,9 +112,11 @@
 }
 
-void owl_message_set_sender(owl_message *m, char *sender) {
+void owl_message_set_sender(owl_message *m, char *sender)
+{
   owl_message_set_attribute(m, "sender", sender);
 }
 
-char *owl_message_get_sender(owl_message *m) {
+char *owl_message_get_sender(owl_message *m)
+{
   char *sender;
 
@@ -116,9 +126,11 @@
 }
 
-void owl_message_set_zsig(owl_message *m, char *zsig) {
+void owl_message_set_zsig(owl_message *m, char *zsig)
+{
   owl_message_set_attribute(m, "zsig", zsig);
 }
 
-char *owl_message_get_zsig(owl_message *m) {
+char *owl_message_get_zsig(owl_message *m)
+{
   char *zsig;
 
@@ -128,29 +140,27 @@
 }
 
-void owl_message_set_recipient(owl_message *m, char *recip) {
+void owl_message_set_recipient(owl_message *m, char *recip)
+{
   owl_message_set_attribute(m, "recipient", recip);
 }
 
-char *owl_message_get_recipient(owl_message *m) {
+char *owl_message_get_recipient(owl_message *m)
+{
   /* this is stupid for outgoing messages, we need to fix it. */
 
   char *recip;
-     
-  if (m->type==OWL_MESSAGE_TYPE_ZEPHYR) {
-    recip=owl_message_get_attribute_value(m, "recipient");
-  } else if (owl_message_is_direction_out(m)) {
-    recip=m->zwriteline;
-  } else {
-    recip=owl_message_get_attribute_value(m, "recipient");
-  }
+
+  recip=owl_message_get_attribute_value(m, "recipient");
   if (!recip) return("");
   return(recip);
 }
 
-void owl_message_set_realm(owl_message *m, char *realm) {
+void owl_message_set_realm(owl_message *m, char *realm)
+{
   owl_message_set_attribute(m, "realm", realm);
 }
 
-char *owl_message_get_realm(owl_message *m) {
+char *owl_message_get_realm(owl_message *m)
+{
   char *realm;
   
@@ -160,9 +170,11 @@
 }
 
-void owl_message_set_body(owl_message *m, char *body) {
+void owl_message_set_body(owl_message *m, char *body)
+{
   owl_message_set_attribute(m, "body", body);
 }
 
-char *owl_message_get_body(owl_message *m) {
+char *owl_message_get_body(owl_message *m)
+{
   char *body;
 
@@ -173,9 +185,11 @@
 
 
-void owl_message_set_opcode(owl_message *m, char *opcode) {
+void owl_message_set_opcode(owl_message *m, char *opcode)
+{
   owl_message_set_attribute(m, "opcode", opcode);
 }
 
-char *owl_message_get_opcode(owl_message *m) {
+char *owl_message_get_opcode(owl_message *m)
+{
   char *opcode;
 
@@ -185,95 +199,116 @@
 }
 
-char *owl_message_get_timestr(owl_message *m) {
+char *owl_message_get_timestr(owl_message *m)
+{
   return(m->time);
 }
 
-void owl_message_set_type_admin(owl_message *m) {
+void owl_message_set_type_admin(owl_message *m)
+{
   m->type=OWL_MESSAGE_TYPE_ADMIN;
 }
 
-void owl_message_set_type_zephyr(owl_message *m) {
+void owl_message_set_type_zephyr(owl_message *m)
+{
   m->type=OWL_MESSAGE_TYPE_ZEPHYR;
 }
 
-void owl_message_set_type_aim(owl_message *m) {
+void owl_message_set_type_aim(owl_message *m)
+{
   m->type=OWL_MESSAGE_TYPE_AIM;
 }
 						
-int owl_message_is_type_admin(owl_message *m) {
+int owl_message_is_type_admin(owl_message *m)
+{
   if (m->type==OWL_MESSAGE_TYPE_ADMIN) return(1);
   return(0);
 }
 
-int owl_message_is_type_zephyr(owl_message *m) {
+int owl_message_is_type_zephyr(owl_message *m)
+{
   if (m->type==OWL_MESSAGE_TYPE_ZEPHYR) return(1);
   return(0);
 }
 
-int owl_message_is_type_aim(owl_message *m) {
+int owl_message_is_type_aim(owl_message *m)
+{
   if (m->type==OWL_MESSAGE_TYPE_AIM) return(1);
   return(0);
 }
 
-int owl_message_is_type_generic(owl_message *m) {
+int owl_message_is_type_generic(owl_message *m)
+{
   if (m->type==OWL_MESSAGE_TYPE_GENERIC) return(1);
   return(0);
 }
 
-char *owl_message_get_text(owl_message *m) {
+char *owl_message_get_text(owl_message *m)
+{
   return(owl_fmtext_get_text(&(m->fmtext)));
 }
 
-void owl_message_set_direction_in(owl_message *m) {
+void owl_message_set_direction_in(owl_message *m)
+{
   m->direction=OWL_MESSAGE_DIRECTION_IN;
 }
 
-void owl_message_set_direction_out(owl_message *m) {
+void owl_message_set_direction_out(owl_message *m)
+{
   m->direction=OWL_MESSAGE_DIRECTION_OUT;
 }
 
-void owl_message_set_direction_none(owl_message *m) {
+void owl_message_set_direction_none(owl_message *m)
+{
   m->direction=OWL_MESSAGE_DIRECTION_NONE;
 }
 
-int owl_message_is_direction_in(owl_message *m) {
+int owl_message_is_direction_in(owl_message *m)
+{
   if (m->direction==OWL_MESSAGE_DIRECTION_IN) return(1);
   return(0);
 }
 
-int owl_message_is_direction_out(owl_message *m) {
+int owl_message_is_direction_out(owl_message *m)
+{
   if (m->direction==OWL_MESSAGE_DIRECTION_OUT) return(1);
   return(0);
 }
 
-int owl_message_is_direction_none(owl_message *m) {
+int owl_message_is_direction_none(owl_message *m)
+{
   if (m->direction==OWL_MESSAGE_DIRECTION_NONE) return(1);
   return(0);
 }
 
-int owl_message_get_numlines(owl_message *m) {
+int owl_message_get_numlines(owl_message *m)
+{
   if (m == NULL) return(0);
   return(owl_fmtext_num_lines(&(m->fmtext)));
 }
 
-void owl_message_mark_delete(owl_message *m) {
+void owl_message_mark_delete(owl_message *m)
+{
   if (m == NULL) return;
   m->delete=1;
 }
 
-void owl_message_unmark_delete(owl_message *m) {
+void owl_message_unmark_delete(owl_message *m)
+{
   if (m == NULL) return;
   m->delete=0;
 }
 
-char *owl_message_get_zwriteline(owl_message *m) {
+char *owl_message_get_zwriteline(owl_message *m)
+{
   return(m->zwriteline);
 }
 
-void owl_message_set_zwriteline(owl_message *m, char *line) {
+void owl_message_set_zwriteline(owl_message *m, char *line)
+{
   m->zwriteline=strdup(line);
 }
 
-int owl_message_is_delete(owl_message *m) {
+int owl_message_is_delete(owl_message *m)
+{
   if (m == NULL) return(0);
   if (m->delete==1) return(1);
@@ -281,14 +316,17 @@
 }
 
-ZNotice_t *owl_message_get_notice(owl_message *m) {
+ZNotice_t *owl_message_get_notice(owl_message *m)
+{
   return(&(m->notice));
 }
 
-char *owl_message_get_hostname(owl_message *m) {
+char *owl_message_get_hostname(owl_message *m)
+{
   return(m->hostname);
 }
 
 
-void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color) {
+void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color)
+{
   owl_fmtext a, b;
 
@@ -312,21 +350,30 @@
 }
 
-int owl_message_is_personal(owl_message *m) {
-  if (strcasecmp(owl_message_get_class(m), "message")) return(0);
-  if (strcasecmp(owl_message_get_instance(m), "personal")) return(0);
-  if (!strcasecmp(owl_message_get_recipient(m), ZGetSender()) ||
-      !strcasecmp(owl_message_get_sender(m), ZGetSender())) {
+int owl_message_is_personal(owl_message *m)
+{
+  if (owl_message_is_type_zephyr(m)) {
+    if (strcasecmp(owl_message_get_class(m), "message")) return(0);
+    if (strcasecmp(owl_message_get_instance(m), "personal")) return(0);
+    if (!strcasecmp(owl_message_get_recipient(m), ZGetSender()) ||
+	!strcasecmp(owl_message_get_sender(m), ZGetSender())) {
+      return(1);
+    }
+  }
+  return(0);
+}
+
+/* true if the message is only intended for one recipient (me) */
+int owl_message_is_to_me(owl_message *m)
+{
+  if (owl_message_is_type_zephyr(m)) {
+    if (!strcasecmp(owl_message_get_recipient(m), ZGetSender())) {
+      return(1);
+    } else {
+      return(0);
+    }
+  } else if (owl_message_is_type_aim(m)) {
+    /* right now we don't support chat rooms */
     return(1);
-  }
-  return(0);
-}
-
-int owl_message_is_private(owl_message *m) {
-  if (!strcasecmp(owl_message_get_recipient(m), ZGetSender())) return(1);
-  return(0);
-}
-
-int owl_message_is_mail(owl_message *m) {
-  if (!strcasecmp(owl_message_get_class(m), "mail") && owl_message_is_private(m)) {
+  } else if (owl_message_is_type_admin(m)) {
     return(1);
   }
@@ -334,26 +381,82 @@
 }
 
-int owl_message_is_ping(owl_message *m) {
-  if (!strcasecmp(owl_message_get_opcode(m), "ping")) return(1);
-  return(0);
-}
-
-int owl_message_is_login(owl_message *m) {
-  if (!strcasecmp(owl_message_get_class(m), "login")) return(1);
-  return(0);
-  /* is this good enough? */
-}
-
-int owl_message_is_burningears(owl_message *m) {
+
+int owl_message_is_from_me(owl_message *m)
+{
+  if (owl_message_is_type_zephyr(m)) {
+    if (!strcasecmp(owl_message_get_sender(m), ZGetSender())) {
+      return(1);
+    } else {
+      return(0);
+    }
+  } else if (owl_message_is_type_aim(m)) {
+    if (!strcasecmp(owl_message_get_sender(m), owl_global_get_aim_screenname(&g))) {
+      return(1);
+    } else {
+      return(0);
+    }
+  } else if (owl_message_is_type_admin(m)) {
+    return(0);
+  }
+  return(0);
+}
+
+int owl_message_is_mail(owl_message *m)
+{
+  if (owl_message_is_type_zephyr(m)) {
+    if (!strcasecmp(owl_message_get_class(m), "mail") && owl_message_is_to_me(m)) {
+      return(1);
+    } else {
+      return(0);
+    }
+  }
+  return(0);
+}
+
+int owl_message_is_ping(owl_message *m)
+{
+  if (owl_message_is_type_zephyr(m)) {
+    if (!strcasecmp(owl_message_get_opcode(m), "ping")) {
+      return(1);
+    } else {
+      return(0);
+    }
+  }
+  return(0);
+}
+
+int owl_message_is_login(owl_message *m)
+{
+  if (owl_message_is_type_zephyr(m)) {
+    if (!strcasecmp(owl_message_get_class(m), "login")) {
+      return(1);
+    } else {
+      return(0);
+    }
+  } else if (owl_message_is_type_aim(m)) {
+    /* deal with this once we can use buddy lists */
+    return(0);
+  }
+       
+  return(0);
+}
+
+int owl_message_is_burningears(owl_message *m)
+{
   /* we should add a global to cache the short zsender */
   char sender[LINE], *ptr;
 
   /* if the message is from us or to us, it doesn't count */
-  if (!strcasecmp(ZGetSender(), owl_message_get_sender(m))) return(0);
-  if (!strcasecmp(ZGetSender(), owl_message_get_recipient(m))) return(0);
-
-  strcpy(sender, ZGetSender());
-  ptr=strchr(sender, '@');
-  if (ptr) *ptr='\0';
+  if (owl_message_is_from_me(m) || owl_message_is_to_me(m)) return(0);
+
+  if (owl_message_is_type_zephyr(m)) {
+    strcpy(sender, ZGetSender());
+    ptr=strchr(sender, '@');
+    if (ptr) *ptr='\0';
+  } else if (owl_message_is_type_aim(m)) {
+    strcpy(sender, owl_global_get_aim_screenname(&g));
+  } else {
+    return(0);
+  }
 
   if (stristr(owl_message_get_body(m), sender)) {
@@ -364,5 +467,6 @@
 
 /* caller must free return value. */
-char *owl_message_get_cc(owl_message *m) {
+char *owl_message_get_cc(owl_message *m)
+{
   char *cur, *out, *end;
 
@@ -378,9 +482,11 @@
 }
 
-int owl_message_get_id(owl_message *m) {
+int owl_message_get_id(owl_message *m)
+{
   return(m->id);
 }
 					
-int owl_message_search(owl_message *m, char *string) {
+int owl_message_search(owl_message *m, char *string)
+{
   /* return 1 if the message contains "string", 0 otherwise.  This is
    * case insensitive because the functions it uses are */
@@ -389,5 +495,6 @@
 }
 
-void owl_message_create(owl_message *m, char *header, char *text) {
+void owl_message_create(owl_message *m, char *header, char *text)
+{
   char *indent;
 
@@ -409,5 +516,6 @@
 }
 
-void owl_message_create_aim(owl_message *m, char *sender, char *recipient, char *text) {
+void owl_message_create_aim(owl_message *m, char *sender, char *recipient, char *text)
+{
   char *indent;
 
@@ -435,5 +543,6 @@
 }
 
-void owl_message_create_admin(owl_message *m, char *header, char *text) {
+void owl_message_create_admin(owl_message *m, char *header, char *text)
+{
   char *indent;
 
@@ -460,5 +569,6 @@
 }
 
-void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n) {
+void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n)
+{
   struct hostent *hent;
   int k;
@@ -552,5 +662,6 @@
 }
 
-void owl_message_create_from_zwriteline(owl_message *m, char *line, char *body, char *zsig) {
+void owl_message_create_from_zwriteline(owl_message *m, char *line, char *body, char *zsig)
+{
   owl_zwrite z;
   int ret;
@@ -593,5 +704,6 @@
 }
 
-void _owl_message_make_text_from_config(owl_message *m) {
+void _owl_message_make_text_from_config(owl_message *m)
+{
   char *body, *indent;
 
@@ -612,5 +724,6 @@
 }
 
-void _owl_message_make_text_from_zwriteline_standard(owl_message *m) {
+void _owl_message_make_text_from_zwriteline_standard(owl_message *m)
+{
   char *indent, *text, *zsigbuff, *foo;
 
@@ -642,5 +755,6 @@
 }
 
-void _owl_message_make_text_from_zwriteline_simple(owl_message *m) {
+void _owl_message_make_text_from_zwriteline_simple(owl_message *m)
+{
   char *indent, *text, *zsigbuff, *foo;
 
@@ -672,5 +786,6 @@
 }
 
-void _owl_message_make_text_from_notice_standard(owl_message *m) {
+void _owl_message_make_text_from_notice_standard(owl_message *m)
+{
   char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
   ZNotice_t *n;
@@ -702,5 +817,5 @@
   owl_fmtext_append_normal(&(m->fmtext), OWL_TABSTR);
 
-  if (!strcasecmp(owl_message_get_opcode(m), "ping") && owl_message_is_private(m)) {
+  if (!strcasecmp(owl_message_get_opcode(m), "ping") && owl_message_is_to_me(m)) {
     owl_fmtext_append_bold(&(m->fmtext), "PING");
     owl_fmtext_append_normal(&(m->fmtext), " from ");
@@ -773,5 +888,6 @@
 }
 
-void _owl_message_make_text_from_notice_simple(owl_message *m) {
+void _owl_message_make_text_from_notice_simple(owl_message *m)
+{
   char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
   ZNotice_t *n;
@@ -873,5 +989,6 @@
 }
 
-void owl_message_pretty_zsig(owl_message *m, char *buff) {
+void owl_message_pretty_zsig(owl_message *m, char *buff)
+{
   /* stick a one line version of the zsig in buff */
   char *ptr;
@@ -882,5 +999,6 @@
 }
 
-void owl_message_free(owl_message *m) {
+void owl_message_free(owl_message *m)
+{
   int i, j;
   owl_pair *p;
Index: owl_prototypes.h
===================================================================
--- owl_prototypes.h	(revision 440ce0128879af680216691261571cf7a278f993)
+++ owl_prototypes.h	(revision 0ff8fb572754799e77ac2cf2d386b7699f995257)
@@ -8,4 +8,16 @@
 extern int owl_aim_chat_sendmsg(char *chatroom, char *msg);
 extern int owl_aim_process_events();
+extern int faimtest_flapversion(aim_session_t *sess, aim_frame_t *fr, ...);
+extern int faimtest_conncomplete(aim_session_t *sess, aim_frame_t *fr, ...);
+extern void addcb_bos(aim_session_t *sess, aim_conn_t *bosconn);
+extern int login(aim_session_t *sess, const char *sn, const char *passwd);
+extern int logout(aim_session_t *sess);
+extern int faimtest_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...);
+extern void chatnav_redirect(aim_session_t *sess, struct aim_redirect_data *redir);
+extern void chat_redirect(aim_session_t *sess, struct aim_redirect_data *redir);
+extern void getfile_start(aim_session_t *sess, aim_conn_t *conn, const char *sn);
+extern void getfile_requested(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args);
+extern void directim_start(aim_session_t *sess, const char *sn);
+extern void directim_requested(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args);
 
 /* -------------------------------- cmd.c -------------------------------- */
@@ -267,7 +279,10 @@
 extern void owl_function_adminmsg(char *header, char *body);
 extern void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig);
+extern void owl_function_make_outgoing_aim(char *body, char *to);
 extern void owl_function_zwrite_setup(char *line);
+extern void owl_function_aimwrite_setup(char *line);
 extern void owl_function_zcrypt_setup(char *line);
 extern void owl_function_zwrite(char *line);
+extern void owl_function_aimwrite(char *to);
 extern void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none);
 extern void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none);
@@ -586,5 +601,6 @@
 extern void owl_message_curs_waddstr(owl_message *m, WINDOW *win, int aline, int bline, int acol, int bcol, int color);
 extern int owl_message_is_personal(owl_message *m);
-extern int owl_message_is_private(owl_message *m);
+extern int owl_message_is_to_me(owl_message *m);
+extern int owl_message_is_from_me(owl_message *m);
 extern int owl_message_is_mail(owl_message *m);
 extern int owl_message_is_ping(owl_message *m);
@@ -931,2 +947,3 @@
 extern int owl_zwrite_is_personal(owl_zwrite *z);
 extern void owl_zwrite_free(owl_zwrite *z);
+
