comparison libpurple/protocols/jabber/jabber.c @ 25775:1516525c86fa

Track the TXT query in the js object so it will be cancelleable
author Paul Aurich <paul@darkrain42.org>
date Mon, 01 Dec 2008 04:00:41 +0000
parents 514051f3b6cf
children 7de1f124f95a
comparison
equal deleted inserted replaced
25774:514051f3b6cf 25775:1516525c86fa
574 { 574 {
575 PurpleConnection *gc = data; 575 PurpleConnection *gc = data;
576 JabberStream *js = gc->proto_data; 576 JabberStream *js = gc->proto_data;
577 int n; 577 int n;
578 578
579 js->srv_query_data = NULL;
580
579 if (results == 0) { 581 if (results == 0) {
580 gchar *tmp; 582 gchar *tmp;
581 tmp = g_strdup_printf(_("Could not find alternative XMPP connection methods after failing to connect directly.\n")); 583 tmp = g_strdup_printf(_("Could not find alternative XMPP connection methods after failing to connect directly.\n"));
582 purple_connection_error_reason (gc, 584 purple_connection_error_reason (gc,
583 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); 585 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
588 for (n = 0; n < results; n++) { 590 for (n = 0; n < results; n++) {
589 gchar **token; 591 gchar **token;
590 token = g_strsplit(resp[n].content, "=", 2); 592 token = g_strsplit(resp[n].content, "=", 2);
591 if (!strcmp(token[0], "_xmpp-client-xbosh")) { 593 if (!strcmp(token[0], "_xmpp-client-xbosh")) {
592 purple_debug_info("jabber","Found alternative connection method using %s at %s.\n", token[0], token[1]); 594 purple_debug_info("jabber","Found alternative connection method using %s at %s.\n", token[0], token[1]);
593 jabber_bosh_connection_init(&(js->bosh), gc->account, js, token[1]); 595 jabber_bosh_connection_init(&(js->bosh), js->gc->account, js, token[1]);
594 g_strfreev(token); 596 g_strfreev(token);
595 break; 597 break;
596 } 598 }
597 g_strfreev(token); 599 g_strfreev(token);
598 } 600 }
614 if (js->srv_rec != NULL) { 616 if (js->srv_rec != NULL) {
615 purple_debug_error("jabber", "Unable to connect to server: %s. Trying next SRV record.\n", error); 617 purple_debug_error("jabber", "Unable to connect to server: %s. Trying next SRV record.\n", error);
616 try_srv_connect(js); 618 try_srv_connect(js);
617 } else { 619 } else {
618 purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); 620 purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain);
619 purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, gc); 621 js->srv_query_data = purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, gc);
620 } 622 }
621 return; 623 return;
622 } 624 }
623 625
624 g_free(js->srv_rec); 626 g_free(js->srv_rec);
767 769
768 jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); 770 jabber_stream_set_state(js, JABBER_STREAM_CONNECTING);
769 771
770 /* XXX FORCE_BOSH: Remove this */ 772 /* XXX FORCE_BOSH: Remove this */
771 if (force_bosh) { 773 if (force_bosh) {
772 purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, gc); 774 js->srv_query_data = purple_txt_resolve("_xmppconnect", js->user->domain, txt_resolved_cb, gc);
773 return; 775 return;
774 } 776 }
775 777
776 /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ 778 /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */
777 if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) { 779 if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) {