# HG changeset patch # User Paul Aurich # Date 1234844899 0 # Node ID 7d2e85f78aec5a74a8a4801acdafb1167eec0fcd # Parent 394252b681bc60a6c91f8ed3ea223c2fb732ce3a Allow the user to specify their own BOSH url in the Connect Server option If the Connect Server starts with "http(s?)://", use it as a BOSH connection URL and go connect to it. The use case for this is someone who wants to connect to their Google Talk account from behind a firewall that blocks everything but HTTP (and not just port 80), so the user runs a standalone BOSH Connection Manager on their home computer and connects through that. I'm not entirely happy with the how this leaves the advanced UI panel. The user specifies a BOSH connection port as part of the URL, whereas the non-srv connections use the separate 'port' account option. diff -r 394252b681bc -r 7d2e85f78aec libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Tue Feb 17 03:39:22 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Feb 17 04:28:19 2009 +0000 @@ -759,8 +759,6 @@ "connect_server", ""); JabberStream *js; JabberBuddy *my_jb = NULL; - /* XXX FORCE_BOSH */ - gboolean force_bosh = purple_account_get_bool(account, "force_bosh", FALSE); gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; @@ -780,7 +778,6 @@ js->write_buffer = purple_circ_buffer_new(512); js->old_length = 0; js->keepalive_timeout = -1; - js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL); if(!js->user) { purple_connection_error_reason (gc, @@ -801,10 +798,20 @@ jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); - /* XXX FORCE_BOSH: Remove this */ - if (force_bosh) { - js->srv_query_data = purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, js); + /* 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 they've got old-ssl mode going, we probably want to ignore SRV lookups */ diff -r 394252b681bc -r 7d2e85f78aec libpurple/protocols/jabber/libxmpp.c --- a/libpurple/protocols/jabber/libxmpp.c Tue Feb 17 03:39:22 2009 +0000 +++ b/libpurple/protocols/jabber/libxmpp.c Tue Feb 17 04:28:19 2009 +0000 @@ -236,12 +236,6 @@ prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - /* XXX FORCE_BOSH: Remove this before re-merging branch */ - option = purple_account_option_bool_new(_("Force BOSH (debugging)"), - "force_bosh", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - option = purple_account_option_int_new(_("Connect port"), "port", 5222); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);