Index: aim.c
===================================================================
--- aim.c	(revision c675b3959f4b4476da37b65a66b27fa38163c845)
+++ aim.c	(revision c0b1a40528c557618ae85287d5f346e4def1811a)
@@ -63,5 +63,4 @@
 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...);
 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...);
-static int conninitdone_chatnav  (aim_session_t *, aim_frame_t *, ...);
 static int conninitdone_chat     (aim_session_t *, aim_frame_t *, ...);
 int logout(aim_session_t *sess);
@@ -82,5 +81,4 @@
 /* static void printuserflags(fu16_t flags); */
 static int faimtest_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...);
-static int faimtest_handlecmd(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, const char *tmpstr);
 static int faimtest_parse_incoming_im_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args);
 static int faimtest_parse_incoming_im_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args);
@@ -1165,219 +1163,4 @@
 }
 
-#if 0
-static int faimtest_handlecmd(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, const char *tmpstr)
-{
-  struct owlfaim_priv *priv = (struct owlfaim_priv *)sess->aux_data;
-  
-  if (!strncmp(tmpstr, "disconnect", 10)) {
-    logout(sess);
-  } else if (strstr(tmpstr, "goodday")) {
-    /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_ACK, "Good day to you too."); */
-  } else if (strstr(tmpstr, "haveicon") && priv->buddyicon) {
-    struct aim_sendimext_args args;
-    /* static const char iconmsg[] = {"I have an icon"}; */
-    static const char iconmsg[] = {""};
-    
-    args.destsn = userinfo->sn;
-    args.flags = AIM_IMFLAGS_HASICON;
-    args.msg = iconmsg;
-    args.msglen = strlen(iconmsg);
-    args.iconlen = priv->buddyiconlen;
-    args.iconstamp = priv->buddyiconstamp;
-    args.iconsum = priv->buddyiconsum;
-    
-    /* aim_send_im_ext(sess, &args); */
-    
-  } else if (strstr(tmpstr, "sendbin")) {
-    struct aim_sendimext_args args;
-    static const unsigned char data[] = {
-      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-      0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
-      0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
-    };
-    
-    /*
-     * I put this here as a demonstration of how to send 
-     * arbitrary binary data via OSCAR ICBM's without the need
-     * for escape or baseN encoding of any sort.  
-     *
-     * Apparently if you set the charset to something WinAIM
-     * doesn't recognize, it will completly ignore the message.
-     * That is, it will not display anything in the conversation
-     * window for the user that recieved it.
-     *
-     * HOWEVER, if they do not have a conversation window open
-     * for you, a new one will be created, but it will not have
-     * any messages in it.  Therefore sending these things could
-     * be a great way to seemingly subliminally convince people
-     * to talk to you...
-     *
-     */
-    args.destsn = userinfo->sn;
-    /* args.flags = AIM_IMFLAGS_CUSTOMCHARSET; */
-    args.charset = args.charsubset = 0x4242;
-    args.msg = data;
-    args.msglen = sizeof(data);
-    /* aim_send_im_ext(sess, &args); */
-   } else if (strstr(tmpstr, "sendmulti")) {
-    struct aim_sendimext_args args;
-    aim_mpmsg_t mpm;
-    static const fu16_t unidata[] = { /* "UNICODE." */
-      0x0055, 0x004e, 0x0049, 0x0043,
-      0x004f, 0x0044, 0x0045, 0x002e,
-    };
-    static const int unidatalen = 8;
-    
-    /*
-     * This is how multipart messages should be sent.
-     *
-     * This should render as:
-     *        "Part 1, ASCII.  UNICODE.Part 3, ASCII.  "
-     */
-    
-    aim_mpmsg_init(sess, &mpm);
-    aim_mpmsg_addascii(sess, &mpm, "Part 1, ASCII.  ");
-    aim_mpmsg_addunicode(sess, &mpm, unidata, unidatalen);
-    aim_mpmsg_addascii(sess, &mpm, "Part 3, ASCII.  ");
-    
-    args.destsn = userinfo->sn;
-    args.flags = AIM_IMFLAGS_MULTIPART;
-    args.mpmsg = &mpm;
-    
-    /* aim_send_im_ext(sess, &args); */
-    
-    aim_mpmsg_free(sess, &mpm);
-    
-  } else if (strstr(tmpstr, "sendprebin")) {
-    static const unsigned char data[] = {
-      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-      0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
-      0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
-    };
-    struct aim_sendimext_args args;
-    aim_mpmsg_t mpm;
-    
-    /*
-     * This demonstrates sending a human-readable preamble,
-     * and then arbitrary binary data.
-     *
-     * This means that you can very inconspicuously send binary
-     * attachments to other users.  In WinAIM, this appears as
-     * though it only had the ASCII portion.
-     *
-     */
-    
-    aim_mpmsg_init(sess, &mpm);
-    aim_mpmsg_addascii(sess, &mpm, "This message has binary data.");
-    aim_mpmsg_addraw(sess, &mpm, 0x4242, 0x4242, data, sizeof(data));
-    
-    args.destsn = userinfo->sn;
-    args.flags = AIM_IMFLAGS_MULTIPART;
-    args.mpmsg = &mpm;
-    
-    /* aim_send_im_ext(sess, &args); */
-    aim_mpmsg_free(sess, &mpm);
-    
-  } else if (strstr(tmpstr, "havefeat")) {
-    struct aim_sendimext_args args;
-    static const char featmsg[] = {"I have nifty features."};
-    fu8_t features[] = {0x01, 0x01, 0x01, 0x02, 0x42, 0x43, 0x44, 0x45};
-    
-    args.destsn = userinfo->sn;
-    args.flags = AIM_IMFLAGS_CUSTOMFEATURES;
-    args.msg = featmsg;
-    args.msglen = strlen(featmsg);
-    args.features = features;
-    args.featureslen = sizeof(features);
-    
-    /* aim_send_im_ext(sess, &args); */
-  } else if (strstr(tmpstr, "sendicon") && priv->buddyicon) {
-    /* aim_send_icon(sess, userinfo->sn, priv->buddyicon, priv->buddyiconlen, priv->buddyiconstamp, priv->buddyiconsum); */
-  } else if (strstr(tmpstr, "warnme")) {
-    /* printf("icbm: sending non-anon warning\n"); */
-    /* aim_send_warning(sess, conn, userinfo->sn, 0); */
-  } else if (strstr(tmpstr, "anonwarn")) {
-    /* printf("icbm: sending anon warning\n"); */
-    /* aim_send_warning(sess, conn, userinfo->sn, AIM_WARN_ANON); */
-  } else if (strstr(tmpstr, "setdirectoryinfo")) {
-    /* printf("icbm: sending backwards profile data\n"); */
-    aim_setdirectoryinfo(sess, conn, "tsrif", "elddim", "tsal", "nediam", "emankcin", "teerts", "ytic", "etats", "piz", 0, 1);
-  } else if (strstr(tmpstr, "setinterests")) {
-    /* printf("icbm: setting fun interests\n"); */
-    aim_setuserinterests(sess, conn, "interest1", "interest2", "interest3", "interest4", "interest5", 1);
-  } else if (!strncmp(tmpstr, "open chatnav", 12)) {
-    aim_reqservice(sess, conn, AIM_CONN_TYPE_CHATNAV);
-  } else if (!strncmp(tmpstr, "create", 6)) {
-    aim_chatnav_createroom(sess,aim_getconn_type(sess, AIM_CONN_TYPE_CHATNAV), (strlen(tmpstr) < 7)?"WorldDomination":tmpstr+7, 0x0004);
-  } else if (!strncmp(tmpstr, "close chatnav", 13)) {
-    aim_conn_t *chatnavconn;
-    if ((chatnavconn = aim_getconn_type(sess, AIM_CONN_TYPE_CHATNAV)))
-      aim_conn_kill(sess, &chatnavconn);
-  } else if (!strncmp(tmpstr, "join", 4)) {
-    aim_chat_join(sess, conn, 0x0004, "worlddomination", 0x0000);
-  } else if (!strncmp(tmpstr, "leave", 5)) {
-    aim_chat_leaveroom(sess, "worlddomination");
-  } else if (!strncmp(tmpstr, "getinfo", 7)) {
-    aim_getinfo(sess, conn, "midendian", AIM_GETINFO_GENERALINFO);
-    aim_getinfo(sess, conn, "midendian", AIM_GETINFO_AWAYMESSAGE);
-    aim_getinfo(sess, conn, "midendian", AIM_GETINFO_CAPABILITIES);
-  } else if(strstr(tmpstr, "lookup")) {
-    /* aim_usersearch_address(sess, conn, "mid@auk.cx"); */
-  } else if (!strncmp(tmpstr, "reqsendmsg", 10)) {
-    /* aim_send_im(sess, priv->ohcaptainmycaptain, 0, "sendmsg 7900"); */
-  } else if (!strncmp(tmpstr, "reqadmin", 8)) {
-    aim_reqservice(sess, conn, AIM_CONN_TYPE_AUTH);
-  } else if (!strncmp(tmpstr, "changenick", 10)) {
-    aim_admin_setnick(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH), "diputs8  1");
-  } else if (!strncmp(tmpstr, "reqconfirm", 10)) {
-    aim_admin_reqconfirm(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH));
-  } else if (!strncmp(tmpstr, "reqemail", 8)) {
-    aim_admin_getinfo(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH), 0x0011);
-  } else if (!strncmp(tmpstr, "changepass", 8)) {
-    aim_admin_changepasswd(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH), "NEWPASSWORD", "OLDPASSWORD");
-  } else if (!strncmp(tmpstr, "setemail", 8)) {
-    aim_admin_setemail(sess, aim_getconn_type(sess, AIM_CONN_TYPE_AUTH), "NEWEMAILADDRESS");
-  } else if (!strncmp(tmpstr, "sendmsg", 7)) {
-    int i;
-    
-    i = atoi(tmpstr+8);
-    if (i < 10000) {
-      char *newbuf;
-      int z;
-      
-      newbuf = owl_malloc(i+1);
-      for (z = 0; z < i; z++)
-	newbuf[z] = (z % 10)+0x30;
-      newbuf[i] = '\0';
-      /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_ACK | AIM_IMFLAGS_AWAY, newbuf); */
-      owl_free(newbuf);
-    }
-  } else if (strstr(tmpstr, "seticqstatus")) {
-    aim_setextstatus(sess, AIM_ICQ_STATE_DND);
-  } else if (strstr(tmpstr, "rtfmsg")) {
-    static const char rtfmsg[] = {"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fcharset0 Arial;}{\\f1\\froman\\fprq2\\fcharset0 Georgia;}{\\f2\\fmodern\\fprq1\\fcharset0 MS Mincho;}{\\f3\\froman\\fprq2\\fcharset2 Symbol;}}\\viewkind4\\uc1\\pard\\f0\\fs20 Test\\f1 test\\f2\fs44 test\\f3\\fs20 test\\f0\\par}"};
-    struct aim_sendrtfmsg_args rtfargs;
-    
-    memset(&rtfargs, 0, sizeof(rtfargs));
-    rtfargs.destsn = userinfo->sn;
-    rtfargs.fgcolor = 0xffffffff;
-    rtfargs.bgcolor = 0x00000000;
-    rtfargs.rtfmsg = rtfmsg;
-    /* aim_send_rtfmsg(sess, &rtfargs); */
-  } else {
-    /* printf("unknown command.\n"); */
-    aim_add_buddy(sess, conn, userinfo->sn);
-  }  
-  
-  return 0;
-}
-#endif
-
 /*
  * Channel 1: Standard Message
@@ -2172,71 +1955,4 @@
 }
 
-static int faimtest_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  fu16_t type;
-  va_list ap;
-  
-  va_start(ap, fr);
-  type = (fu16_t)va_arg(ap, unsigned int);
-
-  owl_function_debugmsg("in faimtest_chatnav_info");
-  
-  if (type == 0x0002) {
-    int maxrooms;
-    struct aim_chat_exchangeinfo *exchanges;
-    int exchangecount;
-    /* int i; */
-    
-    maxrooms = va_arg(ap, int);
-    exchangecount = va_arg(ap, int);
-    exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
-    va_end(ap);
-
-    /*
-    printf("chat info: Chat Rights:\n");
-    printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms);
-    printf("chat info: \tExchange List: (%d total)\n", exchangecount);
-    for (i = 0; i < exchangecount; i++) {
-      printf("chat info: \t\t%x: %s (%s/%s) (0x%04x = %s%s%s%s)\n", 
-	     exchanges[i].number,
-	     exchanges[i].name,
-	     exchanges[i].charset1,
-	     exchanges[i].lang1,
-	     exchanges[i].flags,
-	     (exchanges[i].flags & AIM_CHATROOM_FLAG_EVILABLE) ? "Evilable, " : "",
-	     (exchanges[i].flags & AIM_CHATROOM_FLAG_NAV_ONLY) ? "Nav Only, " : "",
-	     (exchanges[i].flags & AIM_CHATROOM_FLAG_INSTANCING_ALLOWED) ? "Instancing allowed, " : "",
-	     (exchanges[i].flags & AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED) ? "Occupant peek allowed, " : "");
-    }
-    */
-  } else if (type == 0x0008) {
-    char *fqcn, *name, *ck;
-    fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange;
-    fu8_t createperms;
-    fu32_t createtime;
-    
-    fqcn = va_arg(ap, char *);
-    instance = (fu16_t)va_arg(ap, unsigned int);
-    exchange = (fu16_t)va_arg(ap, unsigned int);
-    flags = (fu16_t)va_arg(ap, unsigned int);
-    createtime = va_arg(ap, fu32_t);
-    maxmsglen = (fu16_t)va_arg(ap, unsigned int);
-    maxoccupancy = (fu16_t)va_arg(ap, unsigned int);
-    createperms = (fu8_t)va_arg(ap, unsigned int);
-    unknown = (fu16_t)va_arg(ap, unsigned int);
-    name = va_arg(ap, char *);
-    ck = va_arg(ap, char *);
-    va_end(ap);
-    
-    /* printf("received room create reply for %s/0x%04x\n", fqcn, exchange); */
-    
-  } else {
-    va_end(ap);
-    /* printf("chatnav info: unknown type (%04x)\n", type); */
-  }
-  
-  return 1;
-}
-
 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...)
 {
@@ -2258,18 +1974,4 @@
     chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show);
   */
-  return(1);
-}
-
-static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  owl_function_debugmsg("faimtest_conninitdone_chatnav:");
-
-  /* aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); */
-  /* aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); */
-
-  aim_clientready(sess, fr->conn);
-
-  aim_chatnav_reqrights(sess, fr->conn);
-
   return(1);
 }
@@ -2327,450 +2029,2 @@
   }
 }
-
-
-/**********************************************************************************/
-
-#if 0
-static int faimtest_ssi_rerequestdata(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  aim_ssi_reqdata(sess);
-  return(0);
-}
-
-static int faimtest_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  /* GaimConnection *gc = sess->aux_data; */
-  /*	OscarData *od = gc->proto_data; */
-  va_list ap;
-  fu16_t reason;
-
-  va_start(ap, fr);
-  reason = (fu16_t)va_arg(ap, unsigned int);
-  va_end(ap);
-
-  owl_function_debugmsg("faimtest_ssi_parseerr: ssi: SNAC error %hu", reason);
-
-  if (reason == 0x0005) {
-    owl_function_error("faimtest_ssi_parseerr: unable to retrieve buddy list");
-  }
-
-  /* Activate SSI */
-  /* Sending the enable causes other people to be able to see you, and you to see them */
-  /* Make sure your privacy setting/invisibility is set how you want it before this! */
-  owl_function_debugmsg("faimtest_ssi_parseerr: ssi: activating server-stored buddy list");
-  aim_ssi_enable(sess);
-  
-  return(1);
-}
-
-static int faimtest_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  /* GaimConnection *gc = sess->aux_data; */
-  /* OscarData *od = (OscarData *)gc->proto_data; */
-  int numtypes, i;
-  fu16_t *maxitems;
-  va_list ap;
-
-  va_start(ap, fr);
-  numtypes = va_arg(ap, int);
-  maxitems = va_arg(ap, fu16_t *);
-  va_end(ap);
-
-  owl_function_debugmsg("faimtest_ssi_parserights: ");
-  for (i=0; i<numtypes; i++) {
-    owl_function_debugmsg(" max type 0x%04x=%hd,", i, maxitems[i]);
-  }
-
-  /*
-  if (numtypes >= 0) od->rights.maxbuddies = maxitems[0];
-  if (numtypes >= 1) od->rights.maxgroups = maxitems[1];
-  if (numtypes >= 2) od->rights.maxpermits = maxitems[2];
-  if (numtypes >= 3) od->rights.maxdenies = maxitems[3];
-  */
-  
-  return(1);
-}
-
-static int faimtest_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  /* GaimConnection *gc = sess->aux_data; */
-  /* GaimAccount *account = gaim_connection_get_account(gc); */
-  /* OscarData *od = (OscarData *)gc->proto_data; */
-  struct aim_ssi_item *curitem;
-  int tmp;
-  int export = FALSE;
-  /* XXX - use these?
-     va_list ap;
-     
-     va_start(ap, fr);
-     fmtver = (fu16_t)va_arg(ap, int);
-     numitems = (fu16_t)va_arg(ap, int);
-     items = va_arg(ap, struct aim_ssi_item);
-     timestamp = va_arg(ap, fu32_t);
-     va_end(ap); */
-  
-  owl_function_debugmsg("faimtest_ssi_parselist: syncing local list and server list");
-
-  /* Clean the buddy list */
-  aim_ssi_cleanlist(sess);
-
-  /* Add from server list to local list */
-  for (curitem=sess->ssi.local; curitem; curitem=curitem->next) {
-    if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL)))
-      switch (curitem->type) {
-      case 0x0000: { /* Buddy */
-	if (curitem->name) {
-	  char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name);
-	  char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL;
-	  char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name);
-	  char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL;
-	  GaimBuddy *buddy = gaim_find_buddy(gc->account, curitem->name);
-	  /* Should gname be freed here? -- elb */
-	  /* Not with the current code, but that might be cleaner -- med */
-	  free(alias);
-	  if (buddy) {
-	    /* Get server stored alias */
-	    if (alias_utf8) {
-	      g_free(buddy->alias);
-	      buddy->alias = g_strdup(alias_utf8);
-	    }
-	  } else {
-	    GaimGroup *g;
-	    buddy = gaim_buddy_new(gc->account, curitem->name, alias_utf8);
-	    
-	    if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
-	      g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
-	      gaim_blist_add_group(g, NULL);
-	    }
-	    
-	    gaim_debug(GAIM_DEBUG_INFO, "oscar",
-		       "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans"));
-	    gaim_blist_add_buddy(buddy, NULL, g, NULL);
-	    export = TRUE;
-	  }
-	  g_free(gname_utf8);
-	  g_free(alias_utf8);
-	}
-      } break;
-      
-      case 0x0001: { /* Group */
-	/* Shouldn't add empty groups */
-      } break;
-      
-      case 0x0002: { /* Permit buddy */
-	if (curitem->name) {
-	  /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */
-	  GSList *list;
-	  for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
-	  if (!list) {
-	    gaim_debug(GAIM_DEBUG_INFO, "oscar",
-		       "ssi: adding permit buddy %s to local list\n", curitem->name);
-	    gaim_privacy_permit_add(account, curitem->name, TRUE);
-	    export = TRUE;
-	  }
-	}
-      } break;
-      
-      case 0x0003: { /* Deny buddy */
-	if (curitem->name) {
-	  GSList *list;
-	  for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
-	  if (!list) {
-	    gaim_debug(GAIM_DEBUG_INFO, "oscar",
-		       "ssi: adding deny buddy %s to local list\n", curitem->name);
-	    gaim_privacy_deny_add(account, curitem->name, TRUE);
-	    export = TRUE;
-	  }
-	}
-      } break;
-      
-      case 0x0004: { /* Permit/deny setting */
-	if (curitem->data) {
-	  fu8_t permdeny;
-	  if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) {
-	    gaim_debug(GAIM_DEBUG_INFO, "oscar",
-		       "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny);
-	    account->perm_deny = permdeny;
-	    if (od->icq && account->perm_deny == 0x03) {
-	      serv_set_away(gc, "Invisible", "");
-	    }
-	    export = TRUE;
-	  }
-	}
-      } break;
-      
-      case 0x0005: { /* Presence setting */
-	/* We don't want to change Gaim's setting because it applies to all accounts */
-      } break;
-      } /* End of switch on curitem->type */
-  } /* End of for loop */
-  
-  /* If changes were made, then flush buddy list to file */
-  if (export)
-    gaim_blist_save();
-  
-  { /* Add from local list to server list */
-    GaimBlistNode *gnode, *cnode, *bnode;
-    GaimGroup *group;
-    GaimBuddy *buddy;
-    GaimBuddyList *blist;
-    GSList *cur;
-    
-    /* Buddies */
-    if ((blist = gaim_get_blist()))
-      for (gnode = blist->root; gnode; gnode = gnode->next) {
-	if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
-	  continue;
-	group = (GaimGroup *)gnode;
-	for (cnode = gnode->child; cnode; cnode = cnode->next) {
-	  if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
-	    continue;
-	  for (bnode = cnode->child; bnode; bnode = bnode->next) {
-	    if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
-	      continue;
-	    buddy = (GaimBuddy *)bnode;
-	    if (buddy->account == gc->account) {
-	      const char *servernick = gaim_buddy_get_setting(buddy, "servernick");
-	      if (servernick)
-		serv_got_alias(gc, buddy->name, servernick);
-	      
-	      if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) {
-		/* Store local alias on server */
-		char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name);
-		if (!alias && buddy->alias && strlen(buddy->alias))
-		  aim_ssi_aliasbuddy(sess, group->name, buddy->name, buddy->alias);
-		free(alias);
-	      } else {
-		gaim_debug(GAIM_DEBUG_INFO, "oscar",
-			   "ssi: adding buddy %s from local list to server list\n", buddy->name);
-		aim_ssi_addbuddy(sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0);
-	      }
-	    }
-	  }
-	}
-      }
-    
-    /* Permit list */
-    if (gc->account->permit) {
-      for (cur=gc->account->permit; cur; cur=cur->next)
-	if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) {
-	  gaim_debug(GAIM_DEBUG_INFO, "oscar",
-		     "ssi: adding permit %s from local list to server list\n", (char *)cur->data);
-	  aim_ssi_addpermit(sess, cur->data);
-	}
-    }
-    
-    /* Deny list */
-    if (gc->account->deny) {
-      for (cur=gc->account->deny; cur; cur=cur->next)
-	if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) {
-	  gaim_debug(GAIM_DEBUG_INFO, "oscar",
-		     "ssi: adding deny %s from local list to server list\n", (char *)cur->data);
-	  aim_ssi_adddeny(sess, cur->data);
-	}
-    }
-    /* Presence settings (idle time visibility) */
-    if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF)
-      if (!(tmp & 0x400))
-	aim_ssi_setpresence(sess, tmp | 0x400);
-  } /* end adding buddies from local list to server list */
-  
-  /* Set our ICQ status */
-  if  (od->icq && !gc->away) {
-    aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL);
-  }
-  
-  /* Activate SSI */
-  /* Sending the enable causes other people to be able to see you, and you to see them */
-  /* Make sure your privacy setting/invisibility is set how you want it before this! */
-  gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: activating server-stored buddy list\n");
-  aim_ssi_enable(sess);
-  
-  return 1;
-}
-
-static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  GaimConnection *gc = sess->aux_data;
-  va_list ap;
-  struct aim_ssi_tmp *retval;
-  
-  va_start(ap, fr);
-  retval = va_arg(ap, struct aim_ssi_tmp *);
-  va_end(ap);
-  
-  while (retval) {
-    gaim_debug(GAIM_DEBUG_MISC, "oscar",
-	       "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack,  retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item");
-    
-    if (retval->ack != 0xffff)
-      switch (retval->ack) {
-      case 0x0000: { /* added successfully */
-      } break;
-      
-      case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */
-	gchar *buf;
-	buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list.  Please remove one and try again."), (retval->name ? retval->name : _("(no name)")));
-	gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
-	g_free(buf);
-      }
-	
-      case 0x000e: { /* buddy requires authorization */
-	if ((retval->action == AIM_CB_SSI_ADD) && (retval->name))
-	  gaim_auth_sendrequest(gc, retval->name);
-      } break;
-      
-      default: { /* La la la */
-	gchar *buf;
-	gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
-	buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason.  The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)")));
-	gaim_notify_error(gc, NULL, _("Unable To Add"), buf);
-	g_free(buf);
-	/* XXX - Should remove buddy from local list */
-      } break;
-      }
-    
-    retval = retval->next;
-  }
-  
-  return 1;
-}
-
-static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  GaimConnection *gc = sess->aux_data;
-  va_list ap;
-  char *sn, *msg;
-  gchar *dialog_msg, *nombre;
-  struct name_data *data;
-  GaimBuddy *buddy;
-  
-  va_start(ap, fr);
-  sn = va_arg(ap, char *);
-  msg = va_arg(ap, char *);
-  va_end(ap);
-  
-  gaim_debug(GAIM_DEBUG_INFO, "oscar",
-	     "ssi: %s has given you permission to add him to your buddy list\n", sn);
-  
-  buddy = gaim_find_buddy(gc->account, sn);
-  if (buddy && (gaim_get_buddy_alias_only(buddy)))
-    nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy));
-  else
-    nombre = g_strdup(sn);
-  
-  dialog_msg = g_strdup_printf(_("The user %s has given you permission to add you to their buddy list.  Do you want to add them?"), nombre);
-  data = g_new(struct name_data, 1);
-  data->gc = gc;
-  data->name = g_strdup(sn);
-  data->nick = NULL;
-  
-  gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg,
-		      0, data,
-		      G_CALLBACK(gaim_icq_buddyadd),
-		      G_CALLBACK(oscar_free_name_data));
-  
-  g_free(dialog_msg);
-  g_free(nombre);
-  
-  return 1;
-}
-
-static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  GaimConnection *gc = sess->aux_data;
-  va_list ap;
-  char *sn, *msg;
-  gchar *dialog_msg, *nombre;
-  struct name_data *data;
-  GaimBuddy *buddy;
-  
-  va_start(ap, fr);
-  sn = va_arg(ap, char *);
-  msg = va_arg(ap, char *);
-  va_end(ap);
-  
-  gaim_debug(GAIM_DEBUG_INFO, "oscar",
-	     "ssi: received authorization request from %s\n", sn);
-  
-  buddy = gaim_find_buddy(gc->account, sn);
-  if (buddy && (gaim_get_buddy_alias_only(buddy)))
-    nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy));
-  else
-    nombre = g_strdup(sn);
-  
-  dialog_msg = g_strdup_printf(_("The user %s wants to add you to their buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));
-  data = g_new(struct name_data, 1);
-  data->gc = gc;
-  data->name = g_strdup(sn);
-  data->nick = NULL;
-  
-  gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg,
-		      0, data, 2,
-		      _("Authorize"), G_CALLBACK(gaim_auth_grant),
-		      _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt));
-  
-  g_free(dialog_msg);
-  g_free(nombre);
-  
-  return 1;
-}
-
-static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  GaimConnection *gc = sess->aux_data;
-  va_list ap;
-  char *sn, *msg;
-  gchar *dialog_msg, *nombre;
-  fu8_t reply;
-  GaimBuddy *buddy;
-  
-  va_start(ap, fr);
-  sn = va_arg(ap, char *);
-  reply = (fu8_t)va_arg(ap, int);
-  msg = va_arg(ap, char *);
-  va_end(ap);
-  
-  gaim_debug(GAIM_DEBUG_INFO, "oscar",
-	     "ssi: received authorization reply from %s.  Reply is 0x%04hhx\n", sn, reply);
-  
-  buddy = gaim_find_buddy(gc->account, sn);
-  if (buddy && (gaim_get_buddy_alias_only(buddy)))
-    nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy));
-  else
-    nombre = g_strdup(sn);
-  
-  if (reply) {
-    /* Granted */
-    dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre);
-    gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg);
-  } else {
-    /* Denied */
-    dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));
-    gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg);
-  }
-  g_free(dialog_msg);
-  g_free(nombre);
-  
-  return 1;
-}
-
-static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...)
-{
-  GaimConnection *gc = sess->aux_data;
-  va_list ap;
-  char *sn;
-  GaimBuddy *buddy;
-  
-  va_start(ap, fr);
-  sn = va_arg(ap, char *);
-  va_end(ap);
-  
-  buddy = gaim_find_buddy(gc->account, sn);
-  gaim_debug(GAIM_DEBUG_INFO, "oscar",
-	     "ssi: %s added you to their buddy list\n", sn);
-  gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);
-  
-  return 1;
-}
-#endif
