# HG changeset patch # User Paul Aurich # Date 1245898105 0 # Node ID a9fdf932765238ee41d4dd42fca47ea335caf491 # Parent 48df71b5cfd18b08c9206460b58c2019c110ed35 Make "BOSH URL" its own account option. diff -r 48df71b5cfd1 -r a9fdf9327652 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Thu Jun 25 02:23:40 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Thu Jun 25 02:48:25 2009 +0000 @@ -758,6 +758,8 @@ 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_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()) { diff -r 48df71b5cfd1 -r a9fdf9327652 libpurple/protocols/jabber/libxmpp.c --- a/libpurple/protocols/jabber/libxmpp.c Thu Jun 25 02:23:40 2009 +0000 +++ b/libpurple/protocols/jabber/libxmpp.c Thu Jun 25 02:48:25 2009 +0000 @@ -319,6 +319,11 @@ 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"),