changeset 17606:108f3b42976f

Introduced an additional connection stage to the jabber connection progress in order to be able to tell in the application, whether SSL/TLS is enabled, so it can display a lock icon next to the connection.
author Andreas Monitzer <pidgin@monitzer.com>
date Wed, 20 Jun 2007 10:18:52 +0000
parents 3399dd1c258d
children ca0b86f3dbd2
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/parser.c
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Wed Jun 20 00:25:37 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Wed Jun 20 10:18:52 2007 +0000
@@ -58,7 +58,7 @@
 
 #include <assert.h>
 
-#define JABBER_CONNECT_STEPS (js->gsc ? 8 : 5)
+#define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5)
 
 static PurplePlugin *my_protocol = NULL;
 GList *jabber_features;
@@ -453,11 +453,14 @@
 	}	
 
 	js = gc->proto_data;
-
+	
 	if(js->state == JABBER_STREAM_CONNECTING)
 		jabber_send_raw(js, "<?xml version='1.0' ?>", -1);
 	jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING);
 	purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc);
+	
+	/* Tell the app that we're doing encryption */
+	jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION);
 }
 
 
@@ -1134,9 +1137,14 @@
 					js->gsc ? 5 : 2, JABBER_CONNECT_STEPS);
 			jabber_stream_init(js);
 			break;
+		case JABBER_STREAM_INITIALIZING_ENCRYPTION:
+			purple_connection_update_progress(js->gc, _("Initializing SSL/TLS"),
+											  6, JABBER_CONNECT_STEPS);
+			jabber_stream_init(js);
+			break;
 		case JABBER_STREAM_AUTHENTICATING:
 			purple_connection_update_progress(js->gc, _("Authenticating"),
-					js->gsc ? 6 : 3, JABBER_CONNECT_STEPS);
+					js->gsc ? 7 : 3, JABBER_CONNECT_STEPS);
 			if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) {
 				jabber_register_start(js);
 			} else if(js->auth_type == JABBER_AUTH_IQ_AUTH) {
@@ -1145,7 +1153,7 @@
 			break;
 		case JABBER_STREAM_REINITIALIZING:
 			purple_connection_update_progress(js->gc, _("Re-initializing Stream"),
-					(js->gsc ? 7 : 4), JABBER_CONNECT_STEPS);
+					(js->gsc ? 8 : 4), JABBER_CONNECT_STEPS);
 
 			/* The stream will be reinitialized later, in jabber_recv_cb_ssl() */
 			js->reinit = TRUE;
--- a/libpurple/protocols/jabber/jabber.h	Wed Jun 20 00:25:37 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Wed Jun 20 10:18:52 2007 +0000
@@ -69,6 +69,7 @@
 	JABBER_STREAM_OFFLINE,
 	JABBER_STREAM_CONNECTING,
 	JABBER_STREAM_INITIALIZING,
+	JABBER_STREAM_INITIALIZING_ENCRYPTION,
 	JABBER_STREAM_AUTHENTICATING,
 	JABBER_STREAM_REINITIALIZING,
 	JABBER_STREAM_CONNECTED
--- a/libpurple/protocols/jabber/parser.c	Wed Jun 20 00:25:37 2007 +0000
+++ b/libpurple/protocols/jabber/parser.c	Wed Jun 20 10:18:52 2007 +0000
@@ -63,7 +63,7 @@
 		if(js->protocol_version == JABBER_PROTO_0_9)
 			js->auth_type = JABBER_AUTH_IQ_AUTH;
 
-		if(js->state == JABBER_STREAM_INITIALIZING)
+		if(js->state == JABBER_STREAM_INITIALIZING || js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION)
 			jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING);
 	} else {