changeset 31932:b671728e6ee9

Use the new account-contextual DNS API everywhere. Refs #11110
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 19 Apr 2011 05:05:25 +0000
parents c6193e7def81
children 6b3bc0947068 eca71aa27e21 11e629e6c23d
files libpurple/network.c libpurple/protocols/bonjour/bonjour_ft.c libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/google/jingleinfo.c libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/si.c libpurple/protocols/qq/qq_network.c libpurple/protocols/simple/simple.c libpurple/protocols/yahoo/yahoo_filexfer.c libpurple/stun.c
diffstat 10 files changed, 34 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/network.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/network.c	Tue Apr 19 05:05:25 2011 +0000
@@ -991,7 +991,7 @@
 	if (stun_server && stun_server[0] != '\0') {
 		if (purple_network_is_available()) {
 			purple_debug_info("network", "running DNS query for STUN server\n");
-			purple_dnsquery_a(stun_server, 3478, purple_network_ip_lookup_cb,
+			purple_dnsquery_a_account(NULL, stun_server, 3478, purple_network_ip_lookup_cb,
 				&stun_ip);
 		} else {
 			purple_debug_info("network",
@@ -1009,7 +1009,7 @@
 	if (turn_server && turn_server[0] != '\0') {
 		if (purple_network_is_available()) {
 			purple_debug_info("network", "running DNS query for TURN server\n");
-			purple_dnsquery_a(turn_server,
+			purple_dnsquery_a_account(NULL, turn_server,
 				purple_prefs_get_int("/purple/network/turn_port"),
 				purple_network_ip_lookup_cb, &turn_ip);
 		} else {
--- a/libpurple/protocols/bonjour/bonjour_ft.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/bonjour/bonjour_ft.c	Tue Apr 19 05:05:25 2011 +0000
@@ -883,8 +883,9 @@
 	purple_proxy_info_set_type(xf->proxy_info, PURPLE_PROXY_SOCKS5);
 	purple_proxy_info_set_host(xf->proxy_info, xf->proxy_host);
 	purple_proxy_info_set_port(xf->proxy_info, xf->proxy_port);
-	xf->proxy_connection = purple_proxy_connect_socks5(
+	xf->proxy_connection = purple_proxy_connect_socks5_account(
 							   purple_account_get_connection(account),
+							   account,
 							   xf->proxy_info,
 							   dstaddr, 0,
 							   bonjour_bytestreams_connect_cb, xfer);
--- a/libpurple/protocols/jabber/disco.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/jabber/disco.c	Tue Apr 19 05:05:25 2011 +0000
@@ -480,10 +480,12 @@
 	js->srv_query_data = NULL;
 
 	if (results > 0) {
+		PurpleAccount *account;
 		purple_debug_info("jabber", "looking up IP for %s:%d\n",
 			resp[0].hostname, resp[0].port);
+		account = purple_connection_get_account(js->gc);
 		js->stun_query =
-			purple_dnsquery_a(resp[0].hostname, resp[0].port,
+			purple_dnsquery_a_account(account, resp[0].hostname, resp[0].port,
 				jabber_disco_stun_lookup_cb, js);
 	}
 }
@@ -548,7 +550,9 @@
 		} else if (purple_network_get_stun_ip() == NULL ||
 		    purple_strequal(purple_network_get_stun_ip(), "")) {
 			js->srv_query_data =
-				purple_srv_resolve("stun", "udp", js->user->domain,
+				purple_srv_resolve_account(
+					purple_connection_get_account(js->gc), "stun", "udp",
+					js->user->domain,
 					jabber_disco_stun_srv_resolve_cb, js);
 			/* TODO: add TURN support later... */
 		}
--- a/libpurple/protocols/jabber/google/jingleinfo.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/jabber/google/jingleinfo.c	Tue Apr 19 05:05:25 2011 +0000
@@ -109,13 +109,15 @@
 			const gchar *udp = xmlnode_get_attrib(server, "udp");
 
 			if (host && udp) {
+				PurpleAccount *account;
 				int port = atoi(udp);
 				/* if there, would already be an ongoing query,
 				 cancel it */
 				if (js->stun_query)
 					purple_dnsquery_destroy(js->stun_query);
 
-				js->stun_query = purple_dnsquery_a(host, port,
+				account = purple_connection_get_account(js->gc);
+				js->stun_query = purple_dnsquery_a_account(account, host, port,
 					jabber_google_stun_lookup_cb, js);
 			}
 		}
--- a/libpurple/protocols/jabber/jabber.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Apr 19 05:05:25 2011 +0000
@@ -813,7 +813,8 @@
 			try_srv_connect(js);
 		} else {
 			purple_debug_info("jabber","Couldn't connect directly to %s.  Trying to find alternative connection methods, like BOSH.\n", js->user->domain);
-			js->srv_query_data = purple_txt_resolve("_xmppconnect",
+			js->srv_query_data = purple_txt_resolve_account(
+					purple_connection_get_account(gc), "_xmppconnect",
 					js->user->domain, txt_resolved_cb, js);
 		}
 		return;
@@ -1072,7 +1073,7 @@
 		jabber_login_connect(js, js->user->domain, connect_server,
 				purple_account_get_int(account, "port", 5222), TRUE);
 	} else {
-		js->srv_query_data = purple_srv_resolve("xmpp-client",
+		js->srv_query_data = purple_srv_resolve_account(account, "xmpp-client",
 				"tcp", js->user->domain, srv_resolved_cb, js);
 	}
 }
--- a/libpurple/protocols/jabber/si.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/jabber/si.c	Tue Apr 19 05:05:25 2011 +0000
@@ -277,6 +277,7 @@
 
 	if(dstjid != NULL && streamhost->host && streamhost->port > 0) {
 		char *dstaddr, *hash;
+		PurpleAccount *account;
 		jsx->gpi = purple_proxy_info_new();
 		purple_proxy_info_set_type(jsx->gpi, PURPLE_PROXY_SOCKS5);
 		purple_proxy_info_set_host(jsx->gpi, streamhost->host);
@@ -293,8 +294,9 @@
 		/* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */
 		hash = jabber_calculate_data_hash(dstaddr, strlen(dstaddr), "sha1");
 
-		jsx->connect_data = purple_proxy_connect_socks5(NULL, jsx->gpi,
-				hash, 0,
+		account = purple_connection_get_account(jsx->js->gc);
+		jsx->connect_data = purple_proxy_connect_socks5_account(NULL, account,
+				jsx->gpi, hash, 0,
 				jabber_si_bytestreams_connect_cb, xfer);
 		g_free(hash);
 		g_free(dstaddr);
--- a/libpurple/protocols/qq/qq_network.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/qq/qq_network.c	Tue Apr 19 05:05:25 2011 +0000
@@ -987,7 +987,7 @@
 	}
 
 	purple_debug_info("QQ", "UDP Connect to %s:%d\n", server, port);
-	qd->udp_query_data = purple_dnsquery_a(server, port, udp_host_resolved, gc);
+	qd->udp_query_data = purple_dnsquery_a_account(account, server, port, udp_host_resolved, gc);
 	if ( qd->udp_query_data == NULL ) {
 		purple_debug_error("QQ", "Could not resolve hostname\n");
 		return FALSE;
--- a/libpurple/protocols/simple/simple.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/simple/simple.c	Tue Apr 19 05:05:25 2011 +0000
@@ -1903,7 +1903,8 @@
 	} else { /* UDP */
 		purple_debug_info("simple", "using udp with server %s and port %d\n", hostname, port);
 
-		sip->query_data = purple_dnsquery_a(hostname, port, simple_udp_host_resolved, sip);
+		sip->query_data = purple_dnsquery_a_account(sip->account, hostname,
+			port, simple_udp_host_resolved, sip);
 		if (sip->query_data == NULL) {
 			purple_connection_error_reason(sip->gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
@@ -1965,7 +1966,7 @@
 		hosttoconnect = purple_account_get_string(account, "proxy", sip->servername);
 	}
 
-	sip->srv_query_data = purple_srv_resolve("sip",
+	sip->srv_query_data = purple_srv_resolve_account(account, "sip",
 			sip->udp ? "udp" : "tcp", hosttoconnect, srvresolved, sip);
 }
 
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Tue Apr 19 05:05:25 2011 +0000
@@ -1660,6 +1660,7 @@
 	}
 	if(val_222 == 3)
 	{
+		PurpleAccount *account;
 		xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map,
 								   xfer_peer_idstring);
 		if(!xfer)
@@ -1679,14 +1680,17 @@
 			return;
 		}
 
+		account = purple_connection_get_account(gc);
 		if (yd->jp)
 		{
-			purple_dnsquery_a(YAHOOJP_XFER_RELAY_HOST, YAHOOJP_XFER_RELAY_PORT,
+			purple_dnsquery_a_account(account, YAHOOJP_XFER_RELAY_HOST,
+							YAHOOJP_XFER_RELAY_PORT,
 							yahoo_xfer_dns_connected_15, xfer);
 		}
 		else
 		{
-			purple_dnsquery_a(YAHOO_XFER_RELAY_HOST, YAHOO_XFER_RELAY_PORT,
+			purple_dnsquery_a_account(account, YAHOO_XFER_RELAY_HOST,
+							YAHOO_XFER_RELAY_PORT,
 							yahoo_xfer_dns_connected_15, xfer);
 		}
 		return;
@@ -1784,7 +1788,6 @@
 	char *xfer_idstring_for_relay = NULL;
 	GSList *l;
 	struct yahoo_packet *pkt_to_send;
-	PurpleAccount *account;
 	struct yahoo_p2p_data *p2p_data;
 
 	yd = gc->proto_data;
@@ -1838,7 +1841,8 @@
 
 	xfer_data->info_val_249 = val_249;
 	xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay);
-	if(val_249 == 1 || val_249 == 3)	{
+	if(val_249 == 1 || val_249 == 3) {
+		PurpleAccount *account;
 		if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) {
 			purple_xfer_cancel_remote(xfer);
 			return;
--- a/libpurple/stun.c	Tue Apr 19 04:59:30 2011 +0000
+++ b/libpurple/stun.c	Tue Apr 19 05:05:25 2011 +0000
@@ -365,7 +365,7 @@
 	purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n",
 		results, servername, port);
 
-	purple_dnsquery_a(servername, port, hbn_cb, NULL);
+	purple_dnsquery_a_account(NULL, servername, port, hbn_cb, NULL);
 	g_free(resp);
 }
 
@@ -424,7 +424,7 @@
 	nattype.servername = g_strdup(servername);
 
 	callbacks = g_slist_append(callbacks, cb);
-	purple_srv_resolve("stun", "udp", servername, do_test1,
+	purple_srv_resolve_account(NULL, "stun", "udp", servername, do_test1,
 		(gpointer) servername);
 
 	return &nattype;