Mercurial > pidgin
changeset 25677:7d2e85f78aec
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.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 17 Feb 2009 04:28:19 +0000 |
parents | 394252b681bc |
children | 97a4d71e0c3d |
files | libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/libxmpp.c |
diffstat | 2 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 */
--- 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);