changeset 1002:1d8f05ea6bdf

[gaim-migrate @ 1012] i don't even remember what happened. all good things, i hope committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 18 Oct 2000 02:38:18 +0000
parents b8a819390499
children f8f7f3ed2edb
files libfaim/CHANGES libfaim/CHANGES.gaim libfaim/README.gaim libfaim/aim_conn.c libfaim/aim_ft.c libfaim/aim_info.c libfaim/aim_tlv.c libfaim/faim/aim.h src/aim.c src/buddy.c src/conversation.c src/gaim.h src/gaimrc.c src/multi.c src/multi.h src/oscar.c src/prefs.c src/server.c src/toc.c
diffstat 19 files changed, 222 insertions(+), 392 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/CHANGES	Wed Oct 18 02:38:18 2000 +0000
@@ -1,6 +1,27 @@
 
 No release numbers
 ------------------
+ - Tue Oct 17 02:10:13 UTC 2000
+  - Rearrange a few things
+
+ - Mon Oct 16 20:56:59 UTC 2000
+  - Remove some warnings
+
+ - Mon Oct  9 04:24:56 CDT 2000 (jbm)
+  - took care of the XXXs in aim_putuserinfo()
+     - now use dynamic TLV count to send ("look ma, no magic!")
+     - now send cap blocks
+     - now send icq info if a numeric SN
+
+ - Wed Oct  4 21:29:47 CDT 2000 (jbm)
+  - Fix borked disconnect callbacks
+  - Add aim_conn_in_sess()
+  - A little housekeeping in faimtest ("fixing" order of printf, 
+      remove a comment)
+
+ - Mon Sep 25 00:21:31 CDT 2000 (jbm)
+  - Add a couple of ICQ userinfo parses
+
  - Fri Sep 22 22:47:49 UTC 2000
   - Add aim_icq_setstatus() (jbm)
 
--- a/libfaim/CHANGES.gaim	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/CHANGES.gaim	Wed Oct 18 02:38:18 2000 +0000
@@ -1,3 +1,7 @@
+
+Wed Oct 18 02:29:38 UTC 2000 EWarmenhoven
+	- removed Direct IM temporarily while I figure out the UI for how
+	  to do stuff
 
 Mon Oct  9 22:40:56 UTC 2000 EWarmenhoven
 	- added multiple connections to gaim. This actually happened over
--- a/libfaim/README.gaim	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/README.gaim	Wed Oct 18 02:38:18 2000 +0000
@@ -51,7 +51,6 @@
  - getting invited
  - creating rooms (needed to join empty rooms)
  - refreshing the chatlist in the preferences dialog
-Direct IM (aka IM Image, for sounds and pictures)
 
 CURRENTLY UNSUPPORTED FEATURES
 ==============================
@@ -63,6 +62,7 @@
 File Transfer (Get/Send)
 Voice Chat
 Buddy Icon
+Direct IM (aka IM Image, for sounds and pictures)
 
 KNOWN ISSUES
 ============
@@ -80,8 +80,7 @@
 - What *is* protocol-dependent about the RVOUS stuff is that only Oscar can
 request RVOUS actions, though both can receive them.
 
-- Direct IM has problems. Don't accept a Direct IM if you're offered one, it
-may cause you to segfault.
+- Temporarily removed Direct IM pending a UI change
 
 - Getting Dir Info is not in libfaim yet, and so is not in Gaim/Faim yet.
 
--- a/libfaim/aim_conn.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/aim_conn.c	Wed Oct 18 02:38:18 2000 +0000
@@ -314,7 +314,6 @@
  *
  * Opens a new connection to the specified dest host of type type.
  *
- * TODO: fix for proxies
  * FIXME: Return errors in a more sane way.
  *
  */
@@ -323,8 +322,6 @@
 {
   struct aim_conn_t *connstruct;
   int ret;
-  struct sockaddr_in sa;
-  struct hostent *hp;
   u_short port = FAIM_LOGIN_PORT;
   char *host = NULL;
   int i=0;
@@ -406,6 +403,20 @@
   return cnt;
 }
 
+faim_export int aim_conn_in_sess(struct aim_session_t *sess, struct aim_conn_t *conn)
+{
+  struct aim_conn_t *cur;
+
+  faim_mutex_lock(&sess->connlistlock);
+  for(cur = sess->connlist; cur; cur = cur->next)
+    if(cur == conn) {
+      faim_mutex_unlock(&sess->connlistlock);
+      return 1;
+    }
+  faim_mutex_unlock(&sess->connlistlock);
+  return 0;
+}
+
 /*
  * aim_select(timeout)
  *
--- a/libfaim/aim_ft.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/aim_ft.c	Wed Oct 18 02:38:18 2000 +0000
@@ -847,53 +847,61 @@
  
     faimdprintf(2, "faim: rend: read error (fd: %i) %02x%02x%02x%02x%02x%02x (%i)\n", conn->fd, hdrbuf1[0],hdrbuf1[1],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrlen);
     faim_mutex_unlock(&conn->active);
-    aim_conn_close(conn);
     
     if(hdrlen < 0)
       perror("read");
     else { /* disconnected */
-      int i = -1;
       switch(conn->subtype) {
       case AIM_CONN_SUBTYPE_OFT_DIRECTIM: { /* XXX: clean up cookies here ? */
-	struct aim_directim_priv *priv;
-	if(!(priv = (struct aim_directim_priv *)conn->priv) )
+	struct aim_directim_priv *priv = NULL;
+	if(!(priv = (struct aim_directim_priv *)conn->priv) ) 
 	  return -1; /* not much we can do */
+	aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTIM);
 
-	if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMDISCONNECT)) )
-	  i = userfunc(sess, NULL, conn, priv->sn);
-	else
-	  aim_conn_kill(sess, &conn);
+	
+	if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMDISCONNECT)) ) {
+	  aim_conn_close(conn);
+	  return  userfunc(sess, NULL, conn, priv->sn);
+	}
 
-	aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTIM);
+	break;
       }
+
       case AIM_CONN_SUBTYPE_OFT_GETFILE: {
 	struct aim_filetransfer_priv *priv;
 	if(!(priv = (struct aim_filetransfer_priv *)conn->priv))
 	  return -1;
 
-	if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEDISCONNECT)) )
-	  i = userfunc(sess, NULL, conn, priv->sn);
-	else
-	  aim_conn_kill(sess, &conn);
+	aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTGET);
 
-	aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTGET);
+	if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEDISCONNECT)) ) {
+	  aim_conn_close(conn);
+	  return userfunc(sess, NULL, conn, priv->sn);
+	}
+
+	break;
       }
+
       case AIM_CONN_SUBTYPE_OFT_SENDFILE: {
 	struct aim_filetransfer_priv *priv;
 	if(!(priv = (struct aim_filetransfer_priv *)conn->priv))
 	  return -1;
 
-	if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_SENDFILEDISCONNECT)) )
-	  i = userfunc(sess, NULL, conn, priv->sn);
-	else
-	  aim_conn_kill(sess, &conn);
+	aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTSEND);
 
+	if ( (userfunc = aim_callhandler(conn, AIM_CB_FAM_OFT, AIM_CB_OFT_SENDFILEDISCONNECT)) ) {
+	  aim_conn_close(conn);
+	  return userfunc(sess, NULL, conn, priv->sn);
+	}
 
-	aim_uncachecookie(sess, priv->cookie, AIM_COOKIETYPE_OFTSEND);
+	break;
       }
       }
 
-    return i;
+      aim_conn_close(conn);
+      aim_conn_kill(sess, &conn);
+      
+      return -1;
     }
   }
 
--- a/libfaim/aim_info.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/aim_info.c	Wed Oct 18 02:38:18 2000 +0000
@@ -320,11 +320,30 @@
        * Some decoding of values done by Scott <darkagl@pcnet.com>
        */
     case 0x0006:
-      if (aimutil_get16(buf+i+2) != 0x04)
-	break;
       outinfo->icqinfo.status = aimutil_get16(buf+i+2+2+2);
       break;
 
+
+      /*
+       * Type = 0x000a
+       *
+       * ICQ User IP Address.
+       * Ahh, the joy of ICQ security.
+       */
+    case 0x000a:
+      outinfo->icqinfo.ipaddr = aimutil_get32(&buf[i+4]);
+      break;
+
+      /* Type = 0x000c
+       *
+       * random crap containing the IP address,
+       * apparently a port number, and some Other Stuff.
+       *
+       */
+    case 0x000c:
+      memcpy(outinfo->icqinfo.crap, &buf[i+4], 0x25);
+      break;
+
       /*
        * Type = 0x000d
        *
@@ -562,7 +581,7 @@
  */
 faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info)
 {
-  int i = 0;
+  int i = 0, numtlv = 0;
   struct aim_tlvlist_t *tlvlist = NULL;
 
   if (!buf || !info)
@@ -573,18 +592,36 @@
 
   i += aimutil_put16(buf+i, info->warnlevel);
 
-  /* XXX: we only put down five */
-  i += aimutil_put16(buf+i, 5);
+
   aim_addtlvtochain16(&tlvlist, 0x0001, info->flags);
+  numtlv++;
+
   aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);
+  numtlv++;
+
   aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
+  numtlv++;
+
   aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
-  /* XXX: should put caps here */
+  numtlv++;
+
+#if ICQ_OSCAR_SUPPORT
+  if(atoi(info->sn) != 0) {
+    aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status);
+    aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr);
+  }
+#endif
+
+  aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities);
+  numtlv++;
+
   aim_addtlvtochain32(&tlvlist, (unsigned short)((info->flags)&AIM_FLAG_AOL?0x0010:0x000f), info->sessionlen);
-  
-  i += aim_writetlvchain(buf+i, buflen-i, &tlvlist);
+  numtlv++;
+
+  i += aimutil_put16(buf+i, numtlv); /* tlvcount */
+  i += aim_writetlvchain(buf+i, buflen-i, &tlvlist); /* tlvs */
   aim_freetlvchain(&tlvlist);
-  
+
   return i;
 }
 
--- a/libfaim/aim_tlv.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/aim_tlv.c	Wed Oct 18 02:38:18 2000 +0000
@@ -95,6 +95,21 @@
   return count;
 }
 
+faim_export int aim_sizetlvchain(struct aim_tlvlist_t **list)
+{
+  struct aim_tlvlist_t *cur;
+  int size = 0;
+
+  if (!list || !(*list))
+    return 0;
+
+  for (cur = *list; cur; cur = cur->next)
+    size += (4 + cur->tlv->length);
+ 
+  return size;
+}
+
+
 faim_internal int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len)
 {
   struct aim_tlvlist_t *newtlv;
@@ -188,6 +203,39 @@
   return 4;
 }
 
+faim_internal int aim_addtlvtochain_caps(struct aim_tlvlist_t **list, unsigned short type, unsigned short caps)
+{
+  unsigned char buf[128]; /* icky fixed length buffer */
+  struct aim_tlvlist_t *newtl;
+  struct aim_tlvlist_t *cur;
+
+  if(!list)
+    return 0;
+
+  newtl = (struct aim_tlvlist_t *)malloc(sizeof(struct aim_tlvlist_t));
+  memset(newtl, 0x00, sizeof(struct aim_tlvlist_t));
+
+  newtl->tlv = aim_createtlv();	
+  newtl->tlv->type = type;
+
+  newtl->tlv->length = aim_putcap(buf, sizeof(buf), caps);
+  newtl->tlv->value = (unsigned char *)calloc(1, newtl->tlv->length);
+  memcpy(newtl->tlv->value, buf, newtl->tlv->length);
+
+  newtl->next = NULL;
+
+  if (*list == NULL) {
+    *list = newtl;
+  } else if ((*list)->next == NULL) {
+    (*list)->next = newtl;
+  } else {
+    for(cur = *list; cur->next; cur = cur->next)
+      ;
+    cur->next = newtl;
+  }
+  return newtl->tlv->length;
+}
+
 faim_internal int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list)
 {
   int goodbuflen = 0;
--- a/libfaim/faim/aim.h	Mon Oct 16 20:14:18 2000 +0000
+++ b/libfaim/faim/aim.h	Wed Oct 18 02:38:18 2000 +0000
@@ -368,6 +368,8 @@
   u_short capabilities;
   struct {
     unsigned short status;
+    unsigned int ipaddr;
+    char crap[0x25]; /* until we figure it out... */
   } icqinfo;
 };
 
@@ -416,6 +418,7 @@
 faim_internal int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val);
 faim_internal int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val);
 faim_internal int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len);
+faim_internal int aim_addtlvtochain_caps(struct aim_tlvlist_t **list, unsigned short type, unsigned short caps);
 faim_internal int aim_counttlvchain(struct aim_tlvlist_t **list);
 
 /*
@@ -439,6 +442,8 @@
 faim_internal unsigned long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *);
 
 faim_internal struct aim_fileheader_t *aim_oft_getfh(unsigned char *hdr);
+faim_export int aim_oft_registerlisting(struct aim_session_t *sess, FILE *file, char* listingdir);
+faim_export int aim_getfile_send(struct aim_conn_t *conn, FILE *tosend, struct aim_fileheader_t *fh);
 
 /* aim_login.c */
 faim_export int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn);
--- a/src/aim.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/aim.c	Wed Oct 18 02:38:18 2000 +0000
@@ -137,12 +137,6 @@
 			(AppletCallbackFunc)signoff_all,
 			NULL);
 #endif /* USE_APPLET */
-
-	account_online(gc);
-
-	plugin_event(event_signon, gc, 0, 0, 0);
-
-	return;
 }
 
 
--- a/src/buddy.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/buddy.c	Wed Oct 18 02:38:18 2000 +0000
@@ -394,6 +394,9 @@
                         c = new_conversation(b->name);
                 }
 	} else if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
+		/* FIXME: first, create a menu of each signed on name. then for each of those,
+		 * make a submenu based on which protocol is being used. this will help clarify
+		 * a lot of the UI and connection issues */
                 GtkWidget *menu, *button;
 		/* We're gonna make us a menu right here */
 
@@ -423,12 +426,6 @@
 		gtk_menu_append(GTK_MENU(menu), button);
 		gtk_widget_show(button);
 
-		button = gtk_menu_item_new_with_label(_("Direct IM"));
-		gtk_signal_connect(GTK_OBJECT(button), "activate",
-				   GTK_SIGNAL_FUNC(serv_do_imimage), b->name);
-		gtk_menu_append(GTK_MENU(menu), button);
-		gtk_widget_show(button);
-
 		button = gtk_menu_item_new_with_label(_("Away Msg"));
 		gtk_signal_connect(GTK_OBJECT(button), "activate",
 				   GTK_SIGNAL_FUNC(pressed_away_msg), b);
--- a/src/conversation.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/conversation.c	Wed Oct 18 02:38:18 2000 +0000
@@ -164,27 +164,6 @@
         return NULL;
 }
 
-void make_direct(struct conversation *c, gboolean direct, struct aim_conn_t *conn, gint watcher)
-{
-	char buf[BUF_LONG];
-	if (c == NULL) return;
-	c->is_direct = direct;
-	if (direct) {
-		c->conn = conn;
-		c->watcher = watcher;
-		g_snprintf(buf, sizeof buf, _("<HR><B>Direct Connection with %s established.</B><BR><HR>"),
-			c->name);
-		write_to_conv(c, buf, WFLAG_SYSTEM, NULL);
-	} else {
-		c->conn = NULL;
-		gdk_input_remove(c->watcher);
-		c->watcher = -1;
-		g_snprintf(buf, sizeof buf, _("<HR><B>Direct Connection with %s closed.</B><BR><HR>"),
-			c->name);
-		write_to_conv(c, buf, WFLAG_SYSTEM, NULL);
-	}
-}
-
 /* ---------------------------------------------------
  * Function to remove a log file entry
  * ---------------------------------------------------
@@ -390,19 +369,6 @@
 	if (c->is_chat) {
 		serv_chat_leave(c->gc, c->id);
 	} else {
-		if (c->is_direct) {
-			/* FIXME
-			if (c->gc->protocol == PROTO_OSCAR) {
-				gdk_input_remove(c->watcher);
-				sprintf(debug_buff, "Closing DirectIM conversation (%p)\n", c->conn);
-				debug_print(debug_buff);
-				aim_conn_kill(((struct oscar_data *)c->gc->proto_data)->sess,
-						&c->conn);
-			} else {
-				Direct IM TOC FIXME
-			}
-			*/
-		}
 	        delete_conversation(c);
 	}
 
@@ -615,11 +581,10 @@
 	int hdrlen, limit;
 
 	if (!c->gc) return;
-	if (c->is_direct) limit = 0x8000; /* 32 k */
-	else if (c->is_chat && c->gc->protocol == PROTO_OSCAR) limit = MAXCHATMSGLEN;
-	else if (c->gc->protocol == PROTO_OSCAR) limit = MAXMSGLEN;
-	else limit = MSG_LEN;
-	limit <<= 2;
+	/* FIXME! this used to have limits based on protocol limits (oscar chat was 512,
+	 * oscar im was 7985, toc was 4k). we shouldn't be using PROTO_whatever here. it
+	 * should be gotten from the PRPL somehow */
+	limit = 7985 << 2;
 
 	buf = g_malloc(limit);
 	
@@ -641,10 +606,10 @@
          * toc_send_im is 11 chars long + 2 quotes.
          * + 2 spaces + 6 for the header + 2 for good
          * measure = 23 bytes + the length of normalize c->name */
-	if (c->gc->protocol == PROTO_TOC)
-		hdrlen = 23 + strlen(normalize(c->name));
-	else
-		hdrlen = 0;
+	/* FIXME: the hdrlen is for how long the header is going to cut off the limit.
+	 * but since we don't know on a protocol basis anymore we can't do this. so we'll
+	 * just assume it's 23 + strlen(normalize(c->name)) for all protocols */
+	hdrlen = 23 + strlen(normalize(c->name));
 
         if (font_options & OPT_FONT_BOLD) {
                 g_snprintf(buf2, limit, "<B>%s</B>", buf);
--- a/src/gaim.h	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/gaim.h	Wed Oct 18 02:38:18 2000 +0000
@@ -330,11 +330,6 @@
 
 	/* something to distinguish */
 	gboolean is_chat;
-
-	/* DirectIM stuff */
-	gboolean is_direct;
-	struct aim_conn_t *conn; /* needed for Oscar */
-	int watcher;
 };
 
 struct file_header {
@@ -655,8 +650,6 @@
 extern void serv_chat_leave(struct gaim_connection *, int);
 extern void serv_chat_whisper(struct gaim_connection *, int, char *, char *);
 extern void serv_chat_send(struct gaim_connection *, int, char *);
-extern void serv_do_imimage(GtkWidget *, char *);
-extern void serv_got_imimage(struct gaim_connection *, char *, char *, char *, struct aim_conn_t *, int);
 
 /* output from serv */
 extern void serv_got_update(char *, int, int, time_t, time_t, int, u_short);
@@ -671,7 +664,6 @@
 
 /* Functions in conversation.c */
 extern void write_html_with_smileys(GtkWidget *, GtkWidget *, char *);
-extern void make_direct(struct conversation *, gboolean, struct aim_conn_t *, gint);
 extern void write_to_conv(struct conversation *, char *, int, char *);
 extern void show_conv(struct conversation *);
 extern struct conversation *new_conversation(char *);
@@ -705,7 +697,6 @@
 extern void oscar_login(struct aim_user *);
 extern void oscar_close(struct gaim_connection *);
 extern struct chat_connection *find_oscar_chat(struct gaim_connection *, char *name);
-extern void oscar_do_directim(struct gaim_connection *, char *);
 extern void update_keepalive(struct gaim_connection *, gboolean);
 
 /* Functions in toc.c */
--- a/src/gaimrc.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/gaimrc.c	Wed Oct 18 02:38:18 2000 +0000
@@ -442,7 +442,7 @@
 
         u->user_info[0] = 0;
 	u->options = OPT_USR_REM_PASS;
-	u->protocol = PROTO_TOC;
+	u->protocol = 0; /* PROTO_TOC */
 
         if (!fgets(buf, sizeof(buf), f))
                 return u;
--- a/src/multi.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/multi.c	Wed Oct 18 02:38:18 2000 +0000
@@ -57,28 +57,6 @@
 	gc->inpa = -1;
 	gc->buddy_chats = NULL;
 
-	/* this got moved to the void *proto_data, and each protocol can set this up
-	 * itself, thank you very much
-	switch(proto) {
-		case PROTO_TOC:
-			gc->toc_fd = -1;
-			gc->seqno = 0;
-			gc->state = 0;
-			gc->inpa = -1;
-			break;
-		case PROTO_OSCAR:
-			gc->oscar_sess = NULL;
-			gc->oscar_conn = NULL;
-			gc->inpa = -1;
-			gc->cnpa = -1;
-			gc->paspa = -1;
-			gc->create_exchange = 0;
-			gc->create_name = NULL;
-			gc->oscar_chats = NULL;
-			break;
-	}
-	*/
-
 	connections = g_slist_append(connections, gc);
 
 	return gc;
@@ -624,15 +602,45 @@
 {
 	struct aim_user *u;
 	int i;
+
+	/* first we hide the login progress meter */
 	if (gc->meter)
 		gtk_widget_destroy(gc->meter);
 	gc->meter = NULL;
+	
+	/* then we do the buddy list stuff */
+	if (mainwindow)
+		gtk_widget_hide(mainwindow);
+	show_buddy_list();
+	
+#ifdef USE_APPLET
+	if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
+		refresh_buddy_window();
+		createOnlinePopup();
+		applet_buddy_show = TRUE;
+	} else {
+		gtk_widget_hide(blist);
+		applet_buddy_show = FALSE;
+	}
+	set_user_state(online);
+#else
+	refresh_buddy_window();
+#endif
+	setup_buddy_chats();
+
+	redo_convo_menus();
+	gaim_setup(gc);
+
+	plugin_event(event_signon, gc, 0, 0, 0);
+
+	/* everything for the account editor */
 	if (!acctedit) return;
 	u = find_user(gc->username);
 	i = gtk_clist_find_row_from_data(GTK_CLIST(list), u);
 	gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes");
 	gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol));
-	redo_convo_menus();
+
+	return;
 }
 
 void account_offline(struct gaim_connection *gc)
--- a/src/multi.h	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/multi.h	Wed Oct 18 02:38:18 2000 +0000
@@ -26,9 +26,6 @@
 #include "gaim.h"
 #include "aim.h"
 
-#define PROTO_TOC 0
-#define PROTO_OSCAR 1
-
 /* ok. now the fun begins. first we create a connection structure */
 struct gaim_connection {
 	/* we need to do either oscar or TOC */
--- a/src/oscar.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/oscar.c	Wed Oct 18 02:38:18 2000 +0000
@@ -161,10 +161,6 @@
 static int gaim_parse_buddyrights(struct aim_session_t *, struct command_rx_struct *, ...);
 static int gaim_parse_locerr     (struct aim_session_t *, struct command_rx_struct *, ...);
 
-static int gaim_directim_incoming(struct aim_session_t *, struct command_rx_struct *, ...);
-static int gaim_directim_typing  (struct aim_session_t *, struct command_rx_struct *, ...);
-static int gaim_directim_initiate(struct aim_session_t *, struct command_rx_struct *, ...);
-
 static char *msgerrreason[] = {
 	"Invalid error",
 	"Invalid SNAC",
@@ -221,16 +217,7 @@
 			if (aim_get_command(odata->sess, conn) >= 0) {
 				aim_rxdispatch(odata->sess);
 			} else {
-				if (conn->type == AIM_CONN_TYPE_RENDEZVOUS &&
-				    conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) {
-					struct conversation *cnv =
-						find_conversation(((struct aim_directim_priv *)conn->priv)->sn);
-					debug_print("connection error for directim\n");
-					if (cnv) {
-						make_direct(cnv, FALSE, NULL, 0);
-					}
-					aim_conn_kill(odata->sess, &conn);
-				} else if ((conn->type == AIM_CONN_TYPE_BOS) ||
+				if ((conn->type == AIM_CONN_TYPE_BOS) ||
 					   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
 					debug_print(_("major connection error\n"));
 					hide_login_progress(gc, _("Disconnected."));
@@ -485,7 +472,6 @@
 		serv_got_joined_chat(gc, id++, aim_chat_getname(command->conn));
 		break;
 	case AIM_CONN_TYPE_RENDEZVOUS:
-		aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_directim_incoming, 0);
 		break;
 	default: /* huh? */
 		sprintf(debug_buff, "server ready: got unexpected connection type %04x\n", command->conn->type);
@@ -626,89 +612,6 @@
 	return 1;
 }
 
-static void accept_directim(GtkWidget *w, GtkWidget *m)
-{
-	struct aim_conn_t *newconn;
-	struct aim_directim_priv *priv;
-	struct gaim_connection *gc;
-	struct oscar_data *odata;
-	int watcher;
-
-	priv = (struct aim_directim_priv *)gtk_object_get_user_data(GTK_OBJECT(m));
-	gc = (struct gaim_connection *)gtk_object_get_user_data(GTK_OBJECT(w));
-	odata = (struct oscar_data *)gc->proto_data;
-	gtk_widget_destroy(m);
-
-	if (!(newconn = aim_directim_connect(odata->sess, odata->conn, priv))) {
-		debug_print("imimage: could not connect\n");
-		return;
-	}
-
-	aim_conn_addhandler(odata->sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_directim_incoming, 0);
-	aim_conn_addhandler(odata->sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_directim_typing, 0);
-
-	watcher = gdk_input_add(newconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
-				oscar_callback, newconn);
-
-	sprintf(debug_buff, "DirectIM: connected to %s\n", priv->sn);
-	debug_print(debug_buff);
-
-	serv_got_imimage(gc, priv->sn, priv->cookie, priv->ip, newconn, watcher);
-
-	g_free(priv);
-}
-
-static void cancel_directim(GtkWidget *w, GtkWidget *m)
-{
-	gtk_widget_destroy(m);
-}
-
-static void directim_dialog(struct gaim_connection *gc, struct aim_directim_priv *priv)
-{
-	GtkWidget *window;
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *label;
-	GtkWidget *yes;
-	GtkWidget *no;
-	char buf[BUF_LONG];
-
-	window = gtk_window_new(GTK_WINDOW_DIALOG);
-	gtk_window_set_title(GTK_WINDOW(window), _("Accept Direct IM?"));
-	gtk_window_set_wmclass(GTK_WINDOW(window), "directim", "Gaim");
-	gtk_widget_realize(window);
-	aol_icon(window->window);
-	gtk_object_set_user_data(GTK_OBJECT(window), (void *)priv);
-
-	vbox = gtk_vbox_new(TRUE, 5);
-	gtk_container_add(GTK_CONTAINER(window), vbox);
-	gtk_widget_show(vbox);
-
-	sprintf(buf,  _("%s has requested to directly connect to your computer. "
-			"Do you accept?"), priv->sn);
-	label = gtk_label_new(buf);
-	gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
-	gtk_widget_show(label);
-
-	hbox = gtk_hbox_new(TRUE, 10);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
-	gtk_widget_show(hbox);
-
-	yes = picture_button(window, _("Accept"), ok_xpm);
-	gtk_box_pack_start(GTK_BOX(hbox), yes, FALSE, FALSE, 5);
-	gtk_object_set_user_data(GTK_OBJECT(yes), gc);
-
-	no = picture_button(window, _("Cancel"), cancel_xpm);
-	gtk_box_pack_end(GTK_BOX(hbox), no, FALSE, FALSE, 5);
-
-	gtk_signal_connect(GTK_OBJECT(yes), "clicked",
-			   GTK_SIGNAL_FUNC(accept_directim), window);
-	gtk_signal_connect(GTK_OBJECT(no), "clicked",
-			   GTK_SIGNAL_FUNC(cancel_directim), window);
-
-	gtk_widget_show(window);
-}
-
 int gaim_parse_incoming_im(struct aim_session_t *sess,
 			   struct command_rx_struct *command, ...) {
 	int channel;
@@ -765,20 +668,6 @@
 			/* bah */
 		} else if (rendtype & AIM_CAPS_IMIMAGE) {
 			/* DirectIM stuff */
-			struct aim_directim_priv *priv, *priv2;
-
-			userinfo = va_arg(ap, struct aim_userinfo_s *);
-			priv = va_arg(ap, struct aim_directim_priv *);
-			va_end(ap);
-
-			sprintf(debug_buff, "DirectIM request from %s (%s)\n", userinfo->sn, priv->ip);
-			debug_print(debug_buff);
-
-			priv2 = g_new0(struct aim_directim_priv, 1);
-			strcpy(priv2->cookie, priv->cookie);
-			strcpy(priv2->sn, priv->sn);
-			strcpy(priv2->ip, priv->ip);
-			directim_dialog(gc, priv2);
 		} else {
 			sprintf(debug_buff, "Unknown rendtype %d\n", rendtype);
 			debug_print(debug_buff);
@@ -1164,34 +1053,14 @@
 		aim_bos_setprofile(sess, command->conn, gc->user_info, NULL, gaim_caps);
 		aim_bos_reqbuddyrights(sess, command->conn);
 
-		if (mainwindow)
-			gtk_widget_hide(mainwindow);
-		show_buddy_list();
-
-#ifdef USE_APPLET
-		if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
-			refresh_buddy_window();
-			createOnlinePopup();
-			applet_buddy_show = TRUE;
-		} else {
-			gtk_widget_hide(blist);
-			applet_buddy_show = FALSE;
-		}
-		set_user_state(online);
-#else
-		refresh_buddy_window();
-#endif
-
 		serv_finish_login(gc);
-		gaim_setup(gc);
+		account_online(gc);
 
 		if (bud_list_cache_exists(gc))
 			do_import(NULL, gc);
 
 		debug_print("buddy list loaded\n");
 
-		setup_buddy_chats();
-
 		aim_addicbmparam(sess, command->conn);
 		aim_bos_reqicbmparaminfo(sess, command->conn);
 
@@ -1254,80 +1123,6 @@
 	return 1;
 }
 
-int gaim_directim_incoming(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
-	va_list ap;
-	char *sn = NULL, *msg = NULL;
-	struct aim_conn_t *conn;
-	struct gaim_connection *gc = find_gaim_conn_by_aim_sess(sess);
-
-	va_start(ap, command);
-	conn = va_arg(ap, struct aim_conn_t *);
-	sn = va_arg(ap, char *);
-	msg = va_arg(ap, char *);
-	va_end(ap);
-
-	sprintf(debug_buff, "Got DirectIM message from %s\n", sn);
-	debug_print(debug_buff);
-
-	serv_got_im(gc, sn, msg, 0);
-
-	return 1;
-}
-
-/* this is such a f*cked up function */
-int gaim_directim_initiate(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
-	va_list ap;
-	struct aim_directim_priv *priv;
-	struct aim_conn_t *newconn;
-	struct conversation *cnv;
-	int watcher;
-
-	va_start(ap, command);
-	newconn = va_arg(ap, struct aim_conn_t *);
-	va_end(ap);
-
-	priv = (struct aim_directim_priv *)newconn->priv;
-
-	sprintf(debug_buff, "DirectIM: initiate success to %s\n", priv->sn);
-	debug_print(debug_buff);
-
-	cnv = find_conversation(priv->sn);
-	gdk_input_remove(cnv->watcher);
-	watcher = gdk_input_add(newconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
-					oscar_callback, newconn);
-	make_direct(cnv, TRUE, newconn, watcher);
-
-	aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_directim_incoming, 0);
-	aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_directim_typing, 0);
-
-	return 1;
-}
-
-int gaim_directim_typing(struct aim_session_t *sess, struct command_rx_struct *command, ...) {
-	va_list ap;
-	char *sn;
-
-	va_start(ap, command);
-	sn = va_arg(ap, char *);
-	va_end(ap);
-
-	/* I had to leave this. It's just too funny. It reminds me of my sister. */
-	sprintf(debug_buff, "ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn);
-	debug_print(debug_buff);
-
-	return 1;
-}
-
-void oscar_do_directim(struct gaim_connection *gc, char *name) {
-	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
-	struct aim_conn_t *newconn = aim_directim_initiate(odata->sess, odata->conn, NULL, name);
-	struct conversation *cnv = find_conversation(name); /* this will never be null because
-							       it just got set up */
-	cnv->conn = newconn;
-	cnv->watcher = gdk_input_add(newconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, newconn);
-	aim_conn_addhandler(odata->sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE, gaim_directim_initiate, 0);
-}
-
 static void oscar_keepalive(struct gaim_connection *gc) {
 	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
 	aim_flap_nop(odata->sess, odata->conn);
@@ -1340,15 +1135,10 @@
 static void oscar_send_im(struct gaim_connection *gc, char *name, char *message, int away) {
 	struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
 	struct conversation *cnv = find_conversation(name);
-	if (cnv && cnv->is_direct) {
-		debug_printf("Sending DirectIM to %s\n", name);
-		aim_send_im_direct(odata->sess, cnv->conn, message);
-	} else {
-		if (away)
-			aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message);
-		else
-			aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_ACK, message);
-	}
+	if (away)
+		aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_AWAY, message);
+	else
+		aim_send_im(odata->sess, odata->conn, name, AIM_IMFLAGS_ACK, message);
 }
 
 static void oscar_get_info(struct gaim_connection *g, char *name) {
--- a/src/prefs.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/prefs.c	Wed Oct 18 02:38:18 2000 +0000
@@ -1982,7 +1982,7 @@
 					text, 5, NULL, NULL, NULL, NULL, 0, 1);
 	gtk_ctree_node_set_row_data(GTK_CTREE(preftree), parent, buddy_page);
 
-	/* FIXME ! We shouldn't be showing this if we're not signed on */
+	/* FIXME ! We should move this to a per-user configuration */
 	text[0] = _("Permit/Deny");
 	node = gtk_ctree_insert_node(GTK_CTREE(preftree), parent, NULL,
 					text, 5, NULL, NULL, NULL, NULL, 0, 1);
--- a/src/server.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/server.c	Wed Oct 18 02:38:18 2000 +0000
@@ -189,7 +189,6 @@
 
 void serv_set_away(char *message)
 {
-	/* FIXME: for now, setting away sets *everyone* to away */
 	GSList *c = connections;
 	struct gaim_connection *g;
 
@@ -857,31 +856,6 @@
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-void serv_do_imimage(GtkWidget *w, char *name) {
-	struct conversation *cnv = find_conversation(name);
-	if (!cnv) cnv = new_conversation(name);
-
-	if (cnv->gc->protocol == PROTO_TOC) {
-		/* Direct IM TOC FIXME */
-	} else if (cnv->gc->protocol == PROTO_OSCAR) {
-		/* PRPL
-		oscar_do_directim(cnv->gc, name);
-		*/
-	}
-}
-
-void serv_got_imimage(struct gaim_connection *gc, char *name, char *cookie, char *ip,
-			struct aim_conn_t *conn, int watcher)
-{
-	if (gc->protocol == PROTO_TOC) {
-		/* Direct IM TOC FIXME */
-	} else if (gc->protocol == PROTO_OSCAR) {
-		struct conversation *cnv = find_conversation(name);
-		if (!cnv) cnv = new_conversation(name);
-		make_direct(cnv, TRUE, conn, watcher);
-	}
-}
-
 void send_keepalive(gpointer d) {
 	struct gaim_connection *gc = (struct gaim_connection *)d;
 	debug_print("sending oscar NOP\n");
--- a/src/toc.c	Mon Oct 16 20:14:18 2000 +0000
+++ b/src/toc.c	Wed Oct 18 02:38:18 2000 +0000
@@ -40,7 +40,7 @@
 #include "gaim.h"
 #include "gnome_applet_mgr.h"
 
-#define REVISION "gaim:$Revision: 1010 $"
+#define REVISION "gaim:$Revision: 1012 $"
 
 struct toc_data {
 	int toc_fd;
@@ -136,33 +136,17 @@
 	while (gtk_events_pending())
 		gtk_main_iteration();
 
+	serv_finish_login(gc);
+	account_online(gc);
+
 	config = toc_wait_config(gc);
 	tdt->state = STATE_ONLINE;
 
-	if (mainwindow)
-		gtk_widget_hide(mainwindow);
-	show_buddy_list();
-#ifdef USE_APPLET
-	if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
-		refresh_buddy_window();
-		createOnlinePopup();
-                applet_buddy_show = TRUE;
-        } else {
-                gtk_widget_hide(blist);
-                applet_buddy_show = FALSE;
-        }
-
-	set_user_state(online);
-#else
-	refresh_buddy_window();
-#endif
 	if (config != NULL)
 		parse_toc_buddy_list(gc, config, 0);
 	else
 		do_import(0, gc);
         
-	setup_buddy_chats();
-
 	g_snprintf(buf2, sizeof(buf2), "toc_init_done");
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 
@@ -173,9 +157,6 @@
 
 	if (gc->keepalive < 0)
 		update_keepalive(gc, gc->options & OPT_USR_KEEPALV);
-
-	serv_finish_login(gc);
-	gaim_setup(gc);
 }
 
 void toc_close(struct gaim_connection *gc)