Mercurial > pidgin.yaz
changeset 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 | 48df71b5cfd1 |
children | 708f92703a13 |
files | libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/libxmpp.c |
diffstat | 2 files changed, 19 insertions(+), 8 deletions(-) [+] |
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()) {
--- 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"),