cpw.darkrain42.xmpp.bosh: 70280062: Support BOSH when connecting via the reg...

paul at darkrain42.org paul at darkrain42.org
Sat Apr 25 16:16:54 EDT 2009


-----------------------------------------------------------------
Revision: 70280062175f62b2632fae62b02997c8dca832b7
Ancestor: e6ffb2168588f0ef3faeb34d3beceb030eb89183
Author: paul at darkrain42.org
Date: 2009-04-18T17:50:44
Branch: im.pidgin.cpw.darkrain42.xmpp.bosh
URL: http://d.pidgin.im/viewmtn/revision/info/70280062175f62b2632fae62b02997c8dca832b7

Modified files:
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

Support BOSH when connecting via the register_account prpl.

Also add the explicit catching of SSL connection errors

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	9e0de918cd41bfa2b899748e54272d0879f7917a
+++ libpurple/protocols/jabber/jabber.c	dd507a4453f557ec8b083ec8d0ab2e717ef20fd3
@@ -1295,30 +1295,51 @@ void jabber_register_account(PurpleAccou
 
 	jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
 
+	/* TODO: Just use purple_url_parse? */
+	if (!g_ascii_strncasecmp(connect_server, "http://", 7) || !g_ascii_strncasecmp(connect_server, "https://", 8)) {
+		js->use_bosh = TRUE;
+		js->bosh = jabber_bosh_connection_init(js, connect_server);
+		if (!js->bosh) {
+			purple_connection_error_reason (js->gc,
+				PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
+				_("Malformed BOSH Connect Server"));
+			return;
+		}
+		jabber_bosh_connection_connect(js->bosh);
+		return;
+	} else {
+		js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain);
+	}
+
 	if(purple_account_get_bool(account, "old_ssl", FALSE)) {
 		if(purple_ssl_is_supported()) {
 			js->gsc = purple_ssl_connect(account, server,
 					purple_account_get_int(account, "port", 5222),
 					jabber_login_callback_ssl, jabber_ssl_connect_failure, gc);
+			if (!js->gsc) {
+				purple_connection_error_reason (js->gc,
+					PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
+					_("Unable to establish SSL connection"));
+			}
 		} else {
 			purple_connection_error_reason (gc,
 				PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
 				_("SSL support unavailable"));
 		}
+
+		return;
 	}
 
-	if(!js->gsc) {
-		if (connect_server[0]) {
-			jabber_login_connect(js, js->user->domain, server,
-			                     purple_account_get_int(account,
-			                                          "port", 5222), TRUE);
-		} else {
-			js->srv_query_data = purple_srv_resolve("xmpp-client",
-			                                      "tcp",
-			                                      js->user->domain,
-			                                      srv_resolved_cb,
-			                                      js);
-		}
+	if (connect_server[0]) {
+		jabber_login_connect(js, js->user->domain, server,
+		                     purple_account_get_int(account,
+		                                            "port", 5222), TRUE);
+	} else {
+		js->srv_query_data = purple_srv_resolve("xmpp-client",
+		                                        "tcp",
+		                                        js->user->domain,
+		                                        srv_resolved_cb,
+		                                        js);
 	}
 }
 


More information about the Commits mailing list