pidgin: a7708017: Make "BOSH URL" its own account option.

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Jun 24 22:55:27 EDT 2009


-----------------------------------------------------------------
Revision: a7708017b7ddc9af35ba10166a927f3ecde4f1bc
Ancestor: 602ee3404d02198f2a1430c98ac52ae487a0729c
Author: darkrain42 at pidgin.im
Date: 2009-06-25T02:48:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a7708017b7ddc9af35ba10166a927f3ecde4f1bc

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

ChangeLog: 

Make "BOSH URL" its own account option.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	1149e49ab4217c784cf07e36455ae72d89a28aac
+++ libpurple/protocols/jabber/jabber.c	7909c8ea5ac269638ce27f9f5c70b816bfd1df6a
@@ -758,6 +758,8 @@ jabber_login(PurpleAccount *account)
 	PurpleConnection *gc = purple_account_get_connection(account);
 	const char *connect_server = purple_account_get_string(account,
 			"connect_server", "");
+	const char *bosh_url = purple_account_get_string(account,
+			"bosh_url", "");
 	JabberStream *js;
 	PurplePresence *presence;
 	PurpleStoredImage *image;
@@ -824,21 +826,25 @@ jabber_login(PurpleAccount *account)
 	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)) {
+	/* If both BOSH and a Connect Server are specified, we prefer BOSH. I'm not
+	 * attached to that choice, though.
+	 */
+	if (*bosh_url) {
 		js->use_bosh = TRUE;
-		js->bosh = jabber_bosh_connection_init(js, connect_server);
-		if (!js->bosh) {
+		js->bosh = jabber_bosh_connection_init(js, bosh_url);
+		if (js->bosh)
+			jabber_bosh_connection_connect(js->bosh);
+		else {
 			purple_connection_error_reason (js->gc,
 				PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
-				_("Malformed BOSH Connect Server"));
-			return;
+				_("Malformed BOSH URL"));
 		}
-		jabber_bosh_connection_connect(js->bosh);
+
 		return;
-	} else {
-		js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain);
 	}
 
+	js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain);
+
 	/* if they've got old-ssl mode going, we probably want to ignore SRV lookups */
 	if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) {
 		if(purple_ssl_is_supported()) {
============================================================
--- libpurple/protocols/jabber/libxmpp.c	f9d790cbac8895b01124c5628315461898c26a67
+++ libpurple/protocols/jabber/libxmpp.c	c9e7ef75894ce4b26cc050f642400b255fd48145
@@ -319,6 +319,11 @@ init_plugin(PurplePlugin *plugin)
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
 						  option);
 
+	option = purple_account_option_string_new(_("BOSH URL"),
+						  "bosh_url", NULL);
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
+						  option);
+
 	/* this should probably be part of global smiley theme settings later on,
 	  shared with MSN */
 	option = purple_account_option_bool_new(_("Show Custom Smileys"),


More information about the Commits mailing list