Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/jabber.c @ 27255:a9fdf9327652
Make "BOSH URL" its own account option.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 25 Jun 2009 02:48:25 +0000 |
parents | 01f1929d0936 |
children | 73c8e1964eef 552b5292f36f c815b2aa78ee |
line wrap: on
line diff
--- 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()) {