Index: ChangeLog
===================================================================
--- ChangeLog	(revision cb7888006643c68418952eac65870349f929096b)
+++ ChangeLog	(revision a0a517919ef86311a49f1e5652564bf3c3408ef0)
@@ -1,4 +1,7 @@
 $Id$
 
+2.0.13
+	Changed startup message for new mailing list
+	
 2.0.12
 	Command history now doesn't allow the last entry
Index: aim.c
===================================================================
--- aim.c	(revision 1db061d21d0e731372f0030eb5b47cfbe6521ff0)
+++ aim.c	(revision a0a517919ef86311a49f1e5652564bf3c3408ef0)
@@ -116,5 +116,5 @@
 
   /* an experiment to expose idle time */
-  aim_ssi_setpresence(owl_global_get_aimsess(&g), 0x00000400);
+  /* aim_ssi_setpresence(owl_global_get_aimsess(&g), 0x00000400); */
 }
 
@@ -136,5 +136,5 @@
   aim_tx_setenqueue(owl_global_get_aimsess(&g), AIM_TX_IMMEDIATE, NULL);
   
-  /* login */
+  /* request a login */
   ret=login(owl_global_get_aimsess(&g), priv->screenname, priv->password);
   if (ret) {
@@ -143,65 +143,10 @@
     return(-1);
   }
+
+  /* start processing AIM events */
   owl_global_set_doaimevents(&g);
 
   return(0);
 }
-
-#if 0
-static void oscar_login(GaimAccount *account)
-{
-  aim_session_t *sess;
-  aim_conn_t *conn;
-  char buf[256];
-  GaimConnection *gc = gaim_account_get_connection(account);
-  struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1);
-
-  gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc);
-
-  if (isdigit(*(gaim_account_get_username(account)))) {
-    od->icq = TRUE;
-  } else {
-    gc->flags |= GAIM_CONNECTION_HTML;
-    gc->flags |= GAIM_CONNECTION_AUTO_RESP;
-  }
-  od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo);
-
-  sess = g_new0(aim_session_t, 1);
-
-  aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0);
-  aim_setdebuggingcb(sess, oscar_debug);
-
-  /* we need an immediate queue because we don't use a while-loop to
-   * see if things need to be sent. */
-  aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
-  od->sess = sess;
-  sess->aux_data = gc;
-
-  conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
-  if (conn == NULL) {
-    gaim_debug(GAIM_DEBUG_ERROR, "oscar",
-	       "internal connection error\n");
-    gaim_connection_error(gc, _("Unable to login to AIM"));
-    return;
-  }
-
-  g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account));
-  gaim_connection_update_progress(gc, buf, 2, 5);
-
-  aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
-  aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
-  aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
-
-  conn->status |= AIM_CONN_STATUS_INPROGRESS;
-  if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER),
-			 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT),
-			 oscar_login_connect, gc) < 0) {
-    gaim_connection_error(gc, _("Couldn't connect to host"));
-    return;
-  }
-  aim_request_login(sess, conn, gaim_account_get_username(account));
-}
-#endif
-
 
 /* stuff to run once login has been successful */
@@ -269,5 +214,14 @@
 void owl_aim_addbuddy(char *name)
 {
+
   aim_ssi_addbuddy(owl_global_get_aimsess(&g), name, "Buddies", NULL, NULL, NULL, 0);
+
+  /*
+  aim_ssi_addbuddy(owl_global_get_aimsess(&g),
+		   name,
+		   "Buddies",
+		   NULL, NULL, NULL,
+		   aim_ssi_waitingforauth(owl_global_get_aimsess(&g)->ssi.local, "Buddies", name));
+  */
 }
 
@@ -566,5 +520,5 @@
   aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */
 
-  /* aim_bos_setprofile(owl_global_get_aimsess(&g), fr->conn, NULL, NULL, 0, NULL, NULL, 0, AIM_CAPS_CHAT); */
+  /* aim_bos_setprofile(owl_global_get_aimsess(&g), fr->conn, NULL, NULL, 0, NULL, NULL, 0, AIM_CAPS_EMPTY); */
 
 #ifdef NOSSI
@@ -588,16 +542,16 @@
 
   if (!priv->screenname || !priv->password) {
-    /* printf("need SN and password\n"); */
+    owl_function_error("Internal error: aim login called without screenname or password");
     return(-1);
   }
 
   if (!(authconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, priv->server ? priv->server : FAIM_LOGIN_SERVER))) {
-    /* printf("internal connection error during login\n"); */
+    owl_function_error("Internal error: connection error during AIM login\n");
     return (-1);
   } else if (authconn->fd == -1) {
     if (authconn->status & AIM_CONN_STATUS_RESOLVERR) {
-      /* printf("could not resolve authorizer name\n");*/
+      owl_function_error("AIM: could not resolve authorize name");
     } else if (authconn->status & AIM_CONN_STATUS_CONNERR) {
-      /* printf("could not connect to authorizer\n"); */
+      owl_function_error("AIM: could not connect to authorizer");
     }
     aim_conn_kill(sess, &authconn);
@@ -612,6 +566,6 @@
   /* If the connection is in progress, this will just be queued */
   aim_request_login(sess, authconn, priv->screenname);
-
-  /* printf("login request sent\n"); */
+  owl_function_debugmsg("AIM login request sent for %s", priv->screenname);
+
   return(0);
 }
@@ -621,5 +575,5 @@
 {
   aim_clientready(sess, fr->conn);
-  /* printf("initialization done for admin connection\n"); */
+  owl_function_debugmsg("conninitdone_admin: initializtion done for admin connection");
   return(1);
 }
@@ -629,6 +583,7 @@
   aim_session_kill(sess);
   owl_aim_init();
-  
-  /* kretch
+
+  owl_function_debugmsg("libfaim logout called");
+  /*
   if (faimtest_init() == -1)
     printf("faimtest_init failed\n");
@@ -770,4 +725,5 @@
   
   /* printf("buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers); */
+  owl_function_debugmsg("in faimtest_parse_buddyrights");
   
   /* aim_ssi_reqrights(sess, fr->conn); */
@@ -802,4 +758,6 @@
   maxsiglen = va_arg(ap, int);
   va_end(ap);
+
+  owl_function_debugmsg("in faimtest_parse_locrights");
 
   /* printf("locate rights: max signature length = %d\n", maxsiglen); */
Index: fmtext.c
===================================================================
--- fmtext.c	(revision 252a5c273749b01d1dd408741d34a29b800faebb)
+++ fmtext.c	(revision a0a517919ef86311a49f1e5652564bf3c3408ef0)
@@ -157,32 +157,4 @@
   for (i=0; i<nspaces; i++) {
     owl_fmtext_append_normal(f, " ");
-  }
-}
-
-/* requires that the list values are strings or NULL.
- * joins the elements together with join_with. 
- * If format_fn is specified, passes it the list element value
- * and it will return a string which this needs to free. */
-void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(void*))
-{
-  int i, size;
-  void *elem;
-  char *text;
-
-  size = owl_list_get_size(l);
-  for (i=0; i<size; i++) {
-    elem = (char*)owl_list_get_element(l,i);
-    if (elem && format_fn) {
-      text = format_fn(elem);
-      if (text) {
-	owl_fmtext_append_normal(f, text);
-	owl_free(text);
-      }
-    } else if (elem) {
-      owl_fmtext_append_normal(f, elem);
-    }
-    if ((i < size-1) && join_with) {
-      owl_fmtext_append_normal(f, join_with);
-    }
   }
 }
@@ -362,18 +334,10 @@
 }
 
+/* set the charater at 'index' to be 'char'.  If index is out of
+ * bounds don't do anything */
 void owl_fmtext_set_char(owl_fmtext *f, int index, int ch)
 {
-  /* set the charater at 'index' to be 'char'.  If index is out of
-   * bounds don't do anything */
   if ((index < 0) || (index > f->textlen-1)) return;
   f->textbuff[index]=ch;
-}
-
-/* Free all memory allocated by the object */
-void owl_fmtext_free(owl_fmtext *f)
-{
-  if (f->textbuff) owl_free(f->textbuff);
-  if (f->fmbuff) owl_free(f->fmbuff);
-  if (f->colorbuff) owl_free(f->colorbuff);
 }
 
@@ -623,2 +587,39 @@
   }
 }
+
+/* requires that the list values are strings or NULL.
+ * joins the elements together with join_with. 
+ * If format_fn is specified, passes it the list element value
+ * and it will return a string which this needs to free. */
+void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(void*))
+{
+  int i, size;
+  void *elem;
+  char *text;
+
+  size = owl_list_get_size(l);
+  for (i=0; i<size; i++) {
+    elem = (char*)owl_list_get_element(l,i);
+    if (elem && format_fn) {
+      text = format_fn(elem);
+      if (text) {
+	owl_fmtext_append_normal(f, text);
+	owl_free(text);
+      }
+    } else if (elem) {
+      owl_fmtext_append_normal(f, elem);
+    }
+    if ((i < size-1) && join_with) {
+      owl_fmtext_append_normal(f, join_with);
+    }
+  }
+}
+
+/* Free all memory allocated by the object */
+void owl_fmtext_free(owl_fmtext *f)
+{
+  if (f->textbuff) owl_free(f->textbuff);
+  if (f->fmbuff) owl_free(f->fmbuff);
+  if (f->colorbuff) owl_free(f->colorbuff);
+}
+
Index: functions.c
===================================================================
--- functions.c	(revision cee1f2510088aae21709facaab281ec4c317a926)
+++ functions.c	(revision a0a517919ef86311a49f1e5652564bf3c3408ef0)
@@ -3000,4 +3000,5 @@
   owl_fmtext_init_null(&fm);
 
+  /* AIM first */
   if (aim && owl_global_is_aimloggedin(&g)) {
     bl=owl_global_get_buddylist(&g);
@@ -3014,7 +3015,5 @@
 	timestr=owl_strdup("");
       }
-      foo=owl_sprintf("  %-20.20s %-12.12s\n",
-		      owl_buddy_get_name(b),
-		      timestr);
+      foo=owl_sprintf("  %-20.20s %-12.12s\n", owl_buddy_get_name(b), timestr);
       owl_fmtext_append_normal(&fm, foo);
       owl_free(timestr);
@@ -3027,73 +3026,67 @@
     if (file==NULL) {
       tmp=owl_global_get_homedir(&g);
-      if (!tmp) {
-	owl_function_error("Could not determine home directory");
-	return;
-      }
-      ourfile=owl_malloc(strlen(tmp)+50);
-      sprintf(ourfile, "%s/.anyone", owl_global_get_homedir(&g));
+      ourfile=owl_sprintf("%s/.anyone", owl_global_get_homedir(&g));
     } else {
       ourfile=owl_strdup(file);
     }
-    
+
+    owl_fmtext_append_bold(&fm, "Zephyr users logged in:\n");
     f=fopen(ourfile, "r");
     if (!f) {
-      owl_function_error("Error opening file %s: %s",
-			   ourfile,
-			   strerror(errno) ? strerror(errno) : "");
-      return;
-    }
-
-    owl_fmtext_append_bold(&fm, "Zephyr users logged in:\n");
-    
-    while (fgets(buff, LINE, f)!=NULL) {
-      /* ignore comments, blank lines etc. */
-      if (buff[0]=='#') continue;
-      if (buff[0]=='\n') continue;
-      if (buff[0]=='\0') continue;
-      
-      /* strip the \n */
-      buff[strlen(buff)-1]='\0';
-      
-      /* ingore from # on */
-      tmp=strchr(buff, '#');
-      if (tmp) tmp[0]='\0';
-      
-      /* ingore from SPC */
-      tmp=strchr(buff, ' ');
-      if (tmp) tmp[0]='\0';
-      
-      /* stick on the local realm. */
-      if (!strchr(buff, '@')) {
-	strcat(buff, "@");
-	strcat(buff, ZGetRealm());
-      }
-      
-      ret=ZLocateUser(buff, &numlocs, ZAUTH);
-      if (ret!=ZERR_NONE) {
-	owl_function_error("Error getting location for %s", buff);
-	continue;
-      }
-      
-      numlocs=200;
-      ret=ZGetLocations(location, &numlocs);
-      if (ret==0) {
-	for (i=0; i<numlocs; i++) {
-	  line=malloc(strlen(location[i].host)+strlen(location[i].time)+strlen(location[i].tty)+100);
-	  tmp=short_zuser(buff);
-	  sprintf(line, "  %-10.10s %-24.24s %-12.12s  %20.20s\n",
-		  tmp,
-		  location[i].host,
-		  location[i].tty,
-		  location[i].time);
-	  owl_fmtext_append_normal(&fm, line);
-	  owl_free(tmp);
+      owl_fmtext_append_normal(&fm, "  Error opening file ");
+      owl_fmtext_append_normal(&fm, ourfile);
+      owl_fmtext_append_normal(&fm, "\n");
+      owl_function_error("Error opening file %s: %s", ourfile, strerror(errno) ? strerror(errno) : "");
+    } else {
+      while (fgets(buff, LINE, f)!=NULL) {
+	/* ignore comments, blank lines etc. */
+	if (buff[0]=='#') continue;
+	if (buff[0]=='\n') continue;
+	if (buff[0]=='\0') continue;
+	
+	/* strip the \n */
+	buff[strlen(buff)-1]='\0';
+	
+	/* ingore from # on */
+	tmp=strchr(buff, '#');
+	if (tmp) tmp[0]='\0';
+	
+	/* ingore from SPC */
+	tmp=strchr(buff, ' ');
+	if (tmp) tmp[0]='\0';
+	
+	/* stick on the local realm. */
+	if (!strchr(buff, '@')) {
+	  strcat(buff, "@");
+	  strcat(buff, ZGetRealm());
 	}
-	if (numlocs>=200) {
-	  owl_fmtext_append_normal(&fm, "  Too many locations found for this user, truncating.\n");
+	
+	ret=ZLocateUser(buff, &numlocs, ZAUTH);
+	if (ret!=ZERR_NONE) {
+	  owl_function_error("Error getting location for %s", buff);
+	  continue;
+	}
+	
+	numlocs=200;
+	ret=ZGetLocations(location, &numlocs);
+	if (ret==0) {
+	  for (i=0; i<numlocs; i++) {
+	    line=malloc(strlen(location[i].host)+strlen(location[i].time)+strlen(location[i].tty)+100);
+	    tmp=short_zuser(buff);
+	    sprintf(line, "  %-10.10s %-24.24s %-12.12s  %20.20s\n",
+		    tmp,
+		    location[i].host,
+		    location[i].tty,
+		    location[i].time);
+	    owl_fmtext_append_normal(&fm, line);
+	    owl_free(tmp);
+	  }
+	  if (numlocs>=200) {
+	    owl_fmtext_append_normal(&fm, "  Too many locations found for this user, truncating.\n");
+	  }
 	}
       }
-    }
-    fclose(f);
+      fclose(f);
+    }
     owl_free(ourfile);
   }
Index: libfaim/aim_cbtypes.h
===================================================================
--- libfaim/aim_cbtypes.h	(revision e374dee70435f8c596358571092675644a9ba731)
+++ libfaim/aim_cbtypes.h	(revision a0a517919ef86311a49f1e5652564bf3c3408ef0)
@@ -212,4 +212,5 @@
 #define AIM_CB_SSI_REQDATA 0x0004
 #define AIM_CB_SSI_REQIFCHANGED 0x0005
+#define AIM_CB_SSI_REQLIST 0x0005
 #define AIM_CB_SSI_LIST 0x0006
 #define AIM_CB_SSI_ACTIVATE 0x0007
Index: libfaim/ssi.c
===================================================================
--- libfaim/ssi.c	(revision a053de89ecf8ca17b1ea41aadc0baa4b6a84f37e)
+++ libfaim/ssi.c	(revision a0a517919ef86311a49f1e5652564bf3c3408ef0)
@@ -41,11 +41,11 @@
   int newlen;
   struct aim_ssi_item *cur, *group;
-  
-  if (!list)
-    return NULL;
+
+  owl_function_debugmsg("aim_ssi_itemlist_rebuildgroup: in for group %s", name?name:"NULL");
+  
+  if (!list) return(NULL);
   
   /* Find the group */
-  if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP)))
-    return NULL;
+  if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP))) return(NULL);
   
   /* Free the old data */
@@ -64,4 +64,5 @@
 	newlen += 2;
   }
+  owl_function_debugmsg("aim_ssi_itemlist_rebuildgroup: newlen is %i", newlen);
   
   /* Build the new TLV list */
@@ -69,6 +70,5 @@
     fu8_t *newdata;
     
-    if (!(newdata = (fu8_t *)malloc((newlen)*sizeof(fu8_t))))
-      return NULL;
+    if (!(newdata = (fu8_t *)malloc((newlen)*sizeof(fu8_t)))) return NULL;
     newlen = 0;
     if (group->gid == 0x0000) {
@@ -85,5 +85,6 @@
     free(newdata);
   }
-  
+
+  owl_function_debugmsg("aim_ssi_itemlist_rebuildgroup: exiting");
   return group;
 }
@@ -177,14 +178,18 @@
   if (!list || !(*list) || !del) return -EINVAL;
 
+  owl_function_debugmsg("aim_ssi_itemlist_del: in");
   /* Remove the item from the list */
   if (*list == del) {
     *list = (*list)->next;
+    owl_function_debugmsg("aim_ssi_itemlist_del: deleted %s from beginning of list", del->name);
   } else {
     struct aim_ssi_item *cur;
     for (cur=*list; (cur->next && (cur->next!=del)); cur=cur->next);
     if (cur->next) cur->next=cur->next->next;
+    owl_function_debugmsg("aim_ssi_itemlist_del: deleted %s from middle of list", del->name);
   }
 
   /* Free the deleted item */
+  owl_function_debugmsg("aim_ssi_itemlist_del: freeing");
   free(del->name);
   aim_freetlvchain(&del->data);
@@ -450,11 +455,14 @@
   struct aim_ssi_item *cur1, *cur2;
   struct aim_ssi_tmp *cur, *new;
-  
-  if (!sess)
-    return -EINVAL;
-  
+
+  owl_function_debugmsg("aim_ssi_sync: beginning");
+  
+  if (!sess) return (-EINVAL);
+
   /* If we're waiting for an ack, we shouldn't do anything else */
-  if (sess->ssi.waiting_for_ack)
+  if (sess->ssi.waiting_for_ack) {
+    owl_function_debugmsg("Aborting aim_ssi_sync, waiting for ack");
     return 0;
+  }
   
   /*
@@ -466,9 +474,10 @@
    * buddy ID#s, which makes things more efficient.  I think.
    */
-  
+
   /* Additions */
   if (!sess->ssi.pending) {
     for (cur1=sess->ssi.local; cur1; cur1=cur1->next) {
       if (!aim_ssi_itemlist_find(sess->ssi.official, cur1->gid, cur1->bid)) {
+	owl_function_debugmsg("aim_ssi_sync: doing addition");
 	new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp));
 	new->action = AIM_CB_SSI_ADD;
@@ -490,4 +499,5 @@
     for (cur1=sess->ssi.official; cur1; cur1=cur1->next) {
       if (!aim_ssi_itemlist_find(sess->ssi.local, cur1->gid, cur1->bid)) {
+	owl_function_debugmsg("aim_ssi_sync: doing deletion");
 	new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp));
 	new->action = AIM_CB_SSI_DEL;
@@ -510,4 +520,5 @@
       cur2 = aim_ssi_itemlist_find(sess->ssi.official, cur1->gid, cur1->bid);
       if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) {
+	owl_function_debugmsg("aim_ssi_sync: doing modification");
 	new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp));
 	new->action = AIM_CB_SSI_MOD;
@@ -527,4 +538,5 @@
   /* We're out of stuff to do, so tell the AIM servers we're done and exit */
   if (!sess->ssi.pending) {
+    owl_function_debugmsg("aim_ssi_sync: telling server we're done modifying SSI data.");
     aim_ssi_modend(sess);
     return 0;
@@ -533,7 +545,9 @@
   /* Make sure we don't send anything else between now 
    * and when we receive the ack for the following operation */
+  owl_function_debugmsg("aim_ssi_sync: setting SSI waiting_for_ack");
   sess->ssi.waiting_for_ack = 1;
   
   /* Now go mail off our data and wait 4 to 6 weeks */
+  owl_function_debugmsg("aim_ssi_sync: about to call addmoddel to send SNACs to server");
   aim_ssi_addmoddel(sess);
   
@@ -789,5 +803,5 @@
   /* Remove the item from the list */
   aim_ssi_itemlist_del(&sess->ssi.local, del);
-  
+
   /* Modify the parent group */
   aim_ssi_itemlist_rebuildgroup(sess->ssi.local, group);
@@ -807,4 +821,5 @@
   
   /* Sync our local list with the server list */
+  owl_function_debugmsg("aim_ssi_delbuddy: about to sync");
   aim_ssi_sync(sess);
   
@@ -1261,6 +1276,8 @@
   struct aim_ssi_tmp *cur;
   
-  if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sess->ssi.pending || !sess->ssi.pending->item)
+  if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sess->ssi.pending || !sess->ssi.pending->item) {
+    owl_function_debugmsg("aim_ssi_addmoddel: aborting early");
     return -EINVAL;
+  }
   
   /* Calculate total SNAC size */
@@ -1268,12 +1285,9 @@
   for (cur=sess->ssi.pending; cur; cur=cur->next) {
     snaclen += 10; /* For length, GID, BID, type, and length */
-    if (cur->item->name)
-      snaclen += strlen(cur->item->name);
-    if (cur->item->data)
-      snaclen += aim_sizetlvchain(&cur->item->data);
-  }
-  
-  if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen)))
-    return -ENOMEM;
+    if (cur->item->name) snaclen += strlen(cur->item->name);
+    if (cur->item->data) snaclen += aim_sizetlvchain(&cur->item->data);
+  }
+  
+  if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen))) return (-ENOMEM);
   
   snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, sess->ssi.pending->action, 0x0000, NULL, 0);
@@ -1282,16 +1296,15 @@
   for (cur=sess->ssi.pending; cur; cur=cur->next) {
     aimbs_put16(&fr->data, cur->item->name ? strlen(cur->item->name) : 0);
-    if (cur->item->name)
-      aimbs_putraw(&fr->data, cur->item->name, strlen(cur->item->name));
+    if (cur->item->name) aimbs_putraw(&fr->data, cur->item->name, strlen(cur->item->name));
     aimbs_put16(&fr->data, cur->item->gid);
     aimbs_put16(&fr->data, cur->item->bid);
     aimbs_put16(&fr->data, cur->item->type);
     aimbs_put16(&fr->data, cur->item->data ? aim_sizetlvchain(&cur->item->data) : 0);
-    if (cur->item->data)
-      aim_writetlvchain(&fr->data, &cur->item->data);
+    if (cur->item->data) aim_writetlvchain(&fr->data, &cur->item->data);
   }
   
   aim_tx_enqueue(sess, fr);
-  
+
+  owl_function_debugmsg("aim_ssi_addmoddel: exiting normally");
   return 0;
 }
@@ -1441,4 +1454,6 @@
   aim_rxcallback_t userfunc;
   struct aim_ssi_tmp *cur, *del;
+
+  owl_function_debugmsg("Handling SNAC SSI ACK");
   
   /* Read in the success/failure flags from the ack SNAC */
@@ -1455,8 +1470,10 @@
    */
   for (cur=sess->ssi.pending; (cur && (cur->ack != 0xffff)); cur=cur->next) {
+    owl_function_debugmsg("parseack: processing a change");
     if (cur->item) {
       if (cur->ack) {
 	/* Our action was unsuccessful, so change the local list back to how it was */
 	if (cur->action == AIM_CB_SSI_ADD) {
+	  owl_function_debugmsg("parseack: unsuccesful add, reverting");
 	  /* Remove the item from the local list */
 	  /* Make sure cur->item is still valid memory */
@@ -1472,4 +1489,5 @@
 	} else if (cur->action == AIM_CB_SSI_MOD) {
 	  /* Replace the local item with the item from the official list */
+	  owl_function_debugmsg("parseack: unsuccesful modify, reverting");
 	  if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) {
 	    struct aim_ssi_item *cur1;
@@ -1489,4 +1507,5 @@
 	} else if (cur->action == AIM_CB_SSI_DEL) {
 	  /* Add the item back into the local list */
+	  owl_function_debugmsg("parseack: unsuccesful delete, reverting");
 	  if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item)) {
 	    aim_ssi_itemlist_add(&sess->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data);
@@ -1499,4 +1518,5 @@
 	if (cur->action == AIM_CB_SSI_ADD) {
 	  /* Add the local item to the official list */
+	  owl_function_debugmsg("parseack: succesful add");
 	  if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) {
 	    aim_ssi_itemlist_add(&sess->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data);
@@ -1506,4 +1526,5 @@
 	} else if (cur->action == AIM_CB_SSI_MOD) {
 	  /* Replace the official item with the item from the local list */
+	  owl_function_debugmsg("parseack: succesful modify");
 	  if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) {
 	    struct aim_ssi_item *cur1;
@@ -1523,4 +1544,5 @@
 	} else if (cur->action == AIM_CB_SSI_DEL) {
 	  /* Remove the item from the official list */
+	  owl_function_debugmsg("parseack: succesful delete");
 	  if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item))
 	    aim_ssi_itemlist_del(&sess->ssi.official, cur->item);
@@ -1546,9 +1568,13 @@
   
   /* If we're not waiting for any more acks, then send more SNACs */
+
   if (!sess->ssi.pending) {
     sess->ssi.pending = NULL;
     sess->ssi.waiting_for_ack = 0;
+    owl_function_debugmsg("parseack: Clearing SSI waiting_for_ack");
     aim_ssi_sync(sess);
   }
+
+  owl_function_debugmsg("parseack: returning with %i", ret);
   
   return ret;
@@ -1601,6 +1627,5 @@
   aim_conn_t *conn;
   
-  if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)))
-    return -EINVAL;
+  if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL;
   
   return aim_genericreq_n(sess, conn, AIM_CB_FAM_SSI, AIM_CB_SSI_EDITSTOP);
Index: owl.c
===================================================================
--- owl.c	(revision 52f35074cbf1b1c6d354ce19c191f15592eac3df)
+++ owl.c	(revision a0a517919ef86311a49f1e5652564bf3c3408ef0)
@@ -57,4 +57,7 @@
 #endif
 
+  owl_function_debugmsg("startup: it's the very best place to start");
+
+  owl_function_debugmsg("startup: processing command line arguments");
   argcsave=argc;
   argvsave=argv;
@@ -106,4 +109,5 @@
 #ifdef HAVE_LIBZEPHYR
   /* zephyr init */
+  owl_function_debugmsg("startup: initializing zephyr");
   ret=owl_zephyr_initialize();
   if (ret) {
@@ -113,4 +117,5 @@
   
   /* signal handler */
+  owl_function_debugmsg("startup: setting up signal handler");
   sigact.sa_handler=sig_handler;
   sigemptyset(&sigact.sa_mask);
@@ -120,4 +125,5 @@
 
   /* screen init */
+  owl_function_debugmsg("startup: initializing screen");
   sprintf(buff, "TERMINFO=%s", TERMINFO);
   putenv(buff);
@@ -143,4 +149,5 @@
 
   /* owl global init */
+  owl_function_debugmsg("startup: doing owl global initialization");
   owl_global_init(&g);
   if (debug) owl_global_set_debug_on(&g);
@@ -152,9 +159,11 @@
 
 #if OWL_STDERR_REDIR
-  /* Do this only after we've started curses up... */  
+  /* Do this only after we've started curses up... */
+  owl_function_debugmsg("startup: doing stderr redirection");
   newstderr = stderr_replace();
 #endif   
 
   /* create the owl directory, in case it does not exist */
+  owl_function_debugmsg("startup: creating owl directory, if not present");
   dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
   mkdir(dir, S_IRWXU);
@@ -162,4 +171,5 @@
 
   /* set the tty, either from the command line, or by figuring it out */
+  owl_function_debugmsg("startup: setting tty name");
   if (tty) {
     owl_global_set_tty(&g, tty);
@@ -169,4 +179,5 @@
 
   /* setup the built-in styles */
+  owl_function_debugmsg("startup: creating built-in styles");
   s=owl_malloc(sizeof(owl_style));
   owl_style_create_internal(s, "default", &owl_stylefunc_default,
@@ -192,4 +203,5 @@
   /* the personal filter will need to change again when AIM chat's are
    *  included.  Also, there should be an %aimme% */
+  owl_function_debugmsg("startup: creating default filters");
   f=owl_malloc(sizeof(owl_filter));
   owl_filter_init_fromstring(f, "personal", "( type ^zephyr$ "
@@ -240,13 +252,17 @@
 
   /* set the current view */
+  owl_function_debugmsg("startup: setting the current view");
   owl_view_create(owl_global_get_current_view(&g), "main", f, owl_global_get_style_by_name(&g, "default"));
 
   /* AIM init */
+  owl_function_debugmsg("startup: doing AIM initialization");
   owl_aim_init();
 
   /* process the startup file */
+  owl_function_debugmsg("startup: processing startup file");
   owl_function_source(NULL);
 
   /* read the config file */
+  owl_function_debugmsg("startup: processing config file");
   owl_context_set_readconfig(owl_global_get_context(&g));
   perlerr=owl_perlconfig_readconfig(configfile);
@@ -269,7 +285,7 @@
 
   /* execute the startup function in the configfile */
+  owl_function_debugmsg("startup: executing perl startup, if applicable");
   perlout = owl_perlconfig_execute("owl::startup();");
   if (perlout) owl_free(perlout);
-  owl_function_debugmsg("-- Owl Startup --");
   
   /* hold on to the window names for convenience */
@@ -281,4 +297,5 @@
 
   /* welcome message */
+  owl_function_debugmsg("startup: creating splash message");
   strcpy(startupmsg, "-----------------------------------------------------------------------\n");
   sprintf(buff,      "Welcome to Owl version %s.  Press 'h' for on-line help. \n", OWL_VERSION_STRING);
@@ -298,4 +315,5 @@
   /* load zephyr subs */
   if (initialsubs) {
+    owl_function_debugmsg("startup: loading initial zephyr subs");
     /* load normal subscriptions */
     ret=owl_zephyr_loadsubs(NULL);
@@ -312,4 +330,5 @@
     /* load login subscriptions */
     if (owl_global_is_loginsubs(&g)) {
+      owl_function_debugmsg("startup: loading login subs");
       owl_function_loadloginsubs(NULL);
     }
@@ -318,4 +337,5 @@
   /* set the startup and default style, based on userclue and presence of a
    * formatting function */
+  owl_function_debugmsg("startup: setting startup and default style");
   if (0 != strcmp(owl_global_get_default_style(&g), "__unspecified__")) {
     /* the style was set by the user: leave it alone */
@@ -330,10 +350,13 @@
   /* zlog in if we need to */
   if (owl_global_is_startuplogin(&g)) {
+    owl_function_debugmsg("startup: doing zlog in");
     owl_zephyr_zlog_in();
   }
 
+  owl_function_debugmsg("startup: set style for the view");
   owl_view_set_style(owl_global_get_current_view(&g), 
 		     owl_global_get_style_by_name(&g, owl_global_get_default_style(&g)));   
-  
+
+  owl_function_debugmsg("startup: setting context interactive");
   owl_context_set_interactive(owl_global_get_context(&g));
 
@@ -341,4 +364,5 @@
   nexttime=time(NULL);
 
+  owl_function_debugmsg("startup: entering main loop");
   /* main loop */
   while (1) {
