changeset 975:a45991891aba

[gaim-migrate @ 985] signin mods. still need a better UI, but it's getting there. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 11 Oct 2000 03:56:46 +0000
parents a57fbdc1a758
children 2586b2a3725e
files src/aim.c src/buddy.c src/gaim.h src/oscar.c src/toc.c
diffstat 5 files changed, 26 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/src/aim.c	Wed Oct 11 03:06:50 2000 +0000
+++ b/src/aim.c	Wed Oct 11 03:56:46 2000 +0000
@@ -108,30 +108,11 @@
 #endif /* USE_APPLET */
 }
 
-void set_login_progress(int howfar, char *whattosay)
+void hide_login_progress(char *name, char *why)
 {
-	/* FIXME: we should do this on a per-connection basis
-	gtk_progress_bar_update(GTK_PROGRESS_BAR(progress),
-				((float)howfar / (float)LOGIN_STEPS));
-	gtk_statusbar_pop(GTK_STATUSBAR(notice), 1);
-	gtk_statusbar_push(GTK_STATUSBAR(notice), 1, whattosay);	
-
-        while (gtk_events_pending())
-               gtk_main_iteration();
-	*/
-}
-
-void hide_login_progress(char *why)
-{
-	/* FIXME: we should do this on a per-connection basis
-	gtk_progress_bar_update(GTK_PROGRESS_BAR(progress),
-				0);
-	gtk_statusbar_pop(GTK_STATUSBAR(notice), 1);
-	gtk_statusbar_push(GTK_STATUSBAR(notice), 1, why);	
-
-        while (gtk_events_pending())
-               gtk_main_iteration();
-	*/
+	char buf[2048];
+	sprintf(buf, _("%s was unable to sign on: %s"), name, why);
+	do_error_dialog(buf, _("Signon Error"));
 }
 
 static int snd_tmout;
--- a/src/buddy.c	Wed Oct 11 03:06:50 2000 +0000
+++ b/src/buddy.c	Wed Oct 11 03:56:46 2000 +0000
@@ -310,7 +310,6 @@
 	update_keepalive(gc, FALSE);
         destroy_all_dialogs();
         destroy_buddy();
-        hide_login_progress("");
 #ifdef USE_APPLET
 	set_user_state(offline);
 	applet_buddy_show = FALSE;
--- a/src/gaim.h	Wed Oct 11 03:06:50 2000 +0000
+++ b/src/gaim.h	Wed Oct 11 03:56:46 2000 +0000
@@ -751,8 +751,7 @@
 extern void away_list_clicked(GtkWidget *, struct away_message *);
 
 /* Functions in aim.c */
-extern void hide_login_progress(char *);
-extern void set_login_progress(int, char *);
+extern void hide_login_progress(char *, char *);
 extern void show_login();
 extern void gaim_setup(struct gaim_connection *gc);
 #ifdef USE_APPLET
--- a/src/oscar.c	Wed Oct 11 03:06:50 2000 +0000
+++ b/src/oscar.c	Wed Oct 11 03:56:46 2000 +0000
@@ -191,8 +191,8 @@
 	}
 
 	if (condition & GDK_INPUT_EXCEPTION) {
+		hide_login_progress(gc->username, _("Disconnected."));
 		signoff(gc);
-		hide_login_progress(_("Disconnected."));
 		return;
 	}
 	if (condition & GDK_INPUT_READ) {
@@ -217,8 +217,8 @@
 				} else if ((conn->type == AIM_CONN_TYPE_BOS) ||
 					   !(aim_getconn_type(gc->oscar_sess, AIM_CONN_TYPE_BOS))) {
 					debug_print(_("major connection error\n"));
+					hide_login_progress(gc->username, _("Disconnected."));
 					signoff(gc);
-					hide_login_progress(_("Disconnected."));
 				} else if (conn->type == AIM_CONN_TYPE_CHAT) {
 					struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
 					char buf[BUF_LONG];
@@ -268,35 +268,27 @@
 	gc->oscar_sess = sess;
 
 	sprintf(buf, _("Looking up %s"), FAIM_LOGIN_SERVER);
-	set_login_progress(1, buf);
 	conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, FAIM_LOGIN_SERVER);
 
 	if (conn == NULL) {
 		debug_print(_("internal connection error\n"));
-#ifdef USE_APPLET
-		set_user_state(offline);
-#endif
+		hide_login_progress(gc->username, _("Unable to login to AIM"));
 		destroy_gaim_conn(gc);
-		hide_login_progress(_("Unable to login to AIM"));
 		return NULL;
 	} else if (conn->fd == -1) {
-#ifdef USE_APPLET
-		set_user_state(offline);
-#endif
+		if (conn->status & AIM_CONN_STATUS_RESOLVERR) {
+			sprintf(debug_buff, _("couldn't resolve host"));
+			debug_print(debug_buff); debug_print("\n");
+			hide_login_progress(gc->username, debug_buff);
+		} else if (conn->status & AIM_CONN_STATUS_CONNERR) {
+			sprintf(debug_buff, _("couldn't connect to host"));
+			debug_print(debug_buff); debug_print("\n");
+			hide_login_progress(gc->username, debug_buff);
+		}
 		destroy_gaim_conn(gc);
-		if (conn->status & AIM_CONN_STATUS_RESOLVERR) {
-			sprintf(debug_buff, _("couldn't resolve host\n"));
-			debug_print(debug_buff);
-			hide_login_progress(debug_buff);
-		} else if (conn->status & AIM_CONN_STATUS_CONNERR) {
-			sprintf(debug_buff, _("couldn't connect to host\n"));
-			debug_print(debug_buff);
-			hide_login_progress(debug_buff);
-		}
 		return NULL;
 	}
 	g_snprintf(buf, sizeof(buf), _("Signon: %s"), username);
-	set_login_progress(2, buf);
 
 	aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
 	aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
@@ -368,7 +360,7 @@
 		set_user_state(offline);
 #endif
 		gdk_input_remove(gc->inpa);
-		hide_login_progress(_("Authentication Failed"));
+		hide_login_progress(gc->username, _("Authentication Failed"));
 		signoff(gc);
 		return 0;
 	}
@@ -390,15 +382,15 @@
 #ifdef USE_APPLET
 		set_user_state(offline);
 #endif
+		hide_login_progress(gc->username, _("Internal Error"));
 		destroy_gaim_conn(gc);
-		hide_login_progress(_("Internal Error"));
 		return -1;
 	} else if (bosconn->status != 0) {
 #ifdef USE_APPLET
 		set_user_state(offline);
 #endif
+		hide_login_progress(gc->username, _("Could Not Connect"));
 		destroy_gaim_conn(gc);
-		hide_login_progress(_("Could Not Connect"));
 		return -1;
 	}
 
@@ -428,7 +420,6 @@
 	gc->oscar_conn = bosconn;
 	gc->inpa = gdk_input_add(bosconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
 			oscar_callback, bosconn);
-	set_login_progress(4, _("Connection established, cookie sent"));
 	return 1;
 }
 
--- a/src/toc.c	Wed Oct 11 03:06:50 2000 +0000
+++ b/src/toc.c	Wed Oct 11 03:56:46 2000 +0000
@@ -39,7 +39,7 @@
 #include "gaim.h"
 #include "gnome_applet_mgr.h"
 
-#define REVISION "gaim:$Revision: 981 $"
+#define REVISION "gaim:$Revision: 985 $"
 
 
 static unsigned int peer_ver=0;
@@ -64,23 +64,17 @@
 	char buf2[2048];
 
 	g_snprintf(buf, sizeof(buf), "Looking up %s", aim_host);	
-	set_login_progress(1, buf);
 
 	sin = (struct in_addr *)get_address(aim_host);
 	if (!sin) {
-	        
-#ifdef USE_APPLET
-		set_user_state(offline);
-#endif /* USE_APPLET */
 		g_snprintf(buf, sizeof(buf), "Unable to lookup %s", aim_host);
-		hide_login_progress(buf);
+		hide_login_progress(username, buf);
 		return NULL;
 	}
 	
 	g_snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin));
 	g_snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin));
 	
-	set_login_progress(2, buf);
 
 
 	gc = new_gaim_conn(PROTO_TOC, username, password);
@@ -88,12 +82,9 @@
 	gc->toc_fd = connect_address(sin->s_addr, aim_port);
 
         if (gc->toc_fd < 0) {
-#ifdef USE_APPLET
-		set_user_state(offline);
-#endif /* USE_APPLET */
 		g_snprintf(buf, sizeof(buf), "Connect to %s failed",
 			 inet_ntoa(*sin));
-		hide_login_progress(buf);
+		hide_login_progress(gc->username, buf);
 		destroy_gaim_conn(gc);
 		return NULL;
         }
@@ -102,24 +93,15 @@
 	
 	g_snprintf(buf, sizeof(buf), "Signon: %s",username);
 	
-	set_login_progress(3, buf);
-	
 	if (toc_signon(gc) < 0) {
-#ifdef USE_APPLET
-		set_user_state(offline);
-#endif /* USE_APPLET */
-		hide_login_progress("Disconnected.");
+		hide_login_progress(gc->username, "Disconnected.");
 		destroy_gaim_conn(gc);
 		return NULL;
 	}
 
 	g_snprintf(buf, sizeof(buf), "Waiting for reply...");
-	set_login_progress(4, buf);
 	if (toc_wait_signon(gc) < 0) {
-#ifdef USE_APPLET
-		set_user_state(offline);
-#endif /* USE_APPLET */
-		hide_login_progress("Authentication Failed");
+		hide_login_progress(gc->username, "Authentication Failed");
 		destroy_gaim_conn(gc);
 		return NULL;
 	}
@@ -130,7 +112,6 @@
 	save_prefs();
 
 	g_snprintf(buf, sizeof(buf), "Retrieving config...");
-	set_login_progress(5, buf);
 	config = toc_wait_config(gc);
 	gc->state = STATE_ONLINE;
 
@@ -363,8 +344,8 @@
 
         buf = g_malloc(2 * BUF_LONG);
         if (wait_reply(gc, buf, 2 * BUF_LONG) < 0) {
+                hide_login_progress(gc->username, "Connection Closed");
                 signoff(gc); /* this will free gc for us */
-                hide_login_progress("Connection Closed");
                 g_free(buf);
 		return;
         }