diff src/oscar.c @ 1072:81d19577285a

[gaim-migrate @ 1082] got rid of a few FIXME's and implemented the option to hide (show) empty groups committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 06 Nov 2000 00:30:24 +0000
parents b0b40b5faede
children efcacae6acdb
line wrap: on
line diff
--- a/src/oscar.c	Sun Nov 05 22:19:30 2000 +0000
+++ b/src/oscar.c	Mon Nov 06 00:30:24 2000 +0000
@@ -692,6 +692,7 @@
 	struct gaim_connection *gc = d->gc;
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim;
+	char buf[256];
 
 	debug_printf("Accepted DirectIM.\n");
 
@@ -711,6 +712,9 @@
 	}
 
 	if (!(dim->cnv = find_conversation(d->sn))) dim->cnv = new_conversation(d->sn);
+	g_snprintf(buf, sizeof buf, _("<B>Direct IM with %s established</B>"), d->sn);
+	write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL);
+
 	gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy",
 			   GTK_SIGNAL_FUNC(delete_direct_im), dim);
 
@@ -1526,6 +1530,7 @@
 	struct aim_directim_priv *priv;
 	struct aim_conn_t *newconn;
 	struct direct_im *dim;
+	char buf[256];
 
 	va_start(ap, command);
 	newconn = va_arg(ap, struct aim_conn_t *);
@@ -1544,7 +1549,8 @@
 	dim->conn = newconn;
 	dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
 					oscar_callback, dim->conn);
-	/* FIXME: print to screen that this is now direct */
+	g_snprintf(buf, sizeof buf, _("<B>Direct IM with %s established</B>"), priv->sn);
+	write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL);
 
 	aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING,
 				gaim_directim_incoming, 0);
@@ -1582,6 +1588,7 @@
 	struct gaim_connection *gc = find_gaim_conn_by_aim_sess(sess);
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim;
+	char buf[256];
 
 	va_start(ap, command);
 	conn = va_arg(ap, struct aim_conn_t *);
@@ -1595,7 +1602,9 @@
 	gdk_input_remove(dim->watcher);
 	gtk_signal_disconnect_by_data(GTK_OBJECT(dim->cnv->window), dim);
 
-	/* FIXME: need to indicate no longer direct */
+	g_snprintf(buf, sizeof buf, _("<B>Direct IM with %s closed</B>"), sn);
+	if (dim->cnv)
+		write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL);
 
 	aim_conn_kill(sess, &conn);
 
@@ -1629,13 +1638,18 @@
 	dim = g_new0(struct direct_im, 1);
 	dim->gc = gc;
 	g_snprintf(dim->name, sizeof dim->name, "%s", who);
-	od->direct_ims = g_slist_append(od->direct_ims, dim);
 
 	dim->conn = aim_directim_initiate(od->sess, od->conn, NULL, who);
-	dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
-					oscar_callback, dim->conn);
-	aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE,
-				gaim_directim_initiate, 0);
+	if (dim->conn != NULL) {
+		od->direct_ims = g_slist_append(od->direct_ims, dim);
+		dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
+						oscar_callback, dim->conn);
+		aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE,
+					gaim_directim_initiate, 0);
+	} else {
+		do_error_dialog(_("Unable to open Direct IM"), _("Error"));
+		g_free(dim);
+	}
 }
 
 static void oscar_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) {