pidgin: 075c2902: Use the new account-contextual DNS API e...

datallah at pidgin.im datallah at pidgin.im
Tue Apr 19 01:12:09 EDT 2011


----------------------------------------------------------------------
Revision: 075c2902b90abb6349a6b689e26fa0ecf720ca04
Parent:   21c3e20b4e28edf884a06855ee8a200cec46f6fb
Author:   datallah at pidgin.im
Date:     04/19/11 01:05:25
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/075c2902b90abb6349a6b689e26fa0ecf720ca04

Changelog: 

Use the new account-contextual DNS API everywhere. Refs #11110

Changes against parent 21c3e20b4e28edf884a06855ee8a200cec46f6fb

  patched  libpurple/network.c
  patched  libpurple/protocols/bonjour/bonjour_ft.c
  patched  libpurple/protocols/jabber/disco.c
  patched  libpurple/protocols/jabber/google/jingleinfo.c
  patched  libpurple/protocols/jabber/jabber.c
  patched  libpurple/protocols/jabber/si.c
  patched  libpurple/protocols/qq/qq_network.c
  patched  libpurple/protocols/simple/simple.c
  patched  libpurple/protocols/yahoo/yahoo_filexfer.c
  patched  libpurple/stun.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	7140ac4d990310cc716507d05d29c1cc413712c2
+++ libpurple/protocols/jabber/jabber.c	3f54d78e175972bddffad75e254f84e261f9bafc
@@ -813,7 +813,8 @@ jabber_login_callback(gpointer data, gin
 			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_stream_connect(JabberStream *js)
 		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);
 	}
 }
============================================================
--- libpurple/protocols/jabber/si.c	7ccadf1302e3767aefa4b53a03d64acaacdf7729
+++ libpurple/protocols/jabber/si.c	1ee7a2348a129aea94739f7d0f5f2fefd44cdd78
@@ -277,6 +277,7 @@ static void jabber_si_bytestreams_attemp
 
 	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 @@ static void jabber_si_bytestreams_attemp
 		/* 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);
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c	a7af403b4a6efac2ad704eb1dee234c0cd592b80
+++ libpurple/protocols/yahoo/yahoo_filexfer.c	de2505d7984848ba18c5783eec488894f9190d2c
@@ -1660,6 +1660,7 @@ void yahoo_process_filetrans_15(PurpleCo
 	}
 	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 @@ void yahoo_process_filetrans_15(PurpleCo
 			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 @@ void yahoo_process_filetrans_info_15(Pur
 	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 @@ void yahoo_process_filetrans_info_15(Pur
 
 	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;
============================================================
--- libpurple/network.c	cecea56b2fc49d2c96c29843b575083168be0807
+++ libpurple/network.c	1af5a26476244a4f69b919a99f8ac911da739a29
@@ -991,7 +991,7 @@ purple_network_set_stun_server(const gch
 	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 @@ purple_network_set_turn_server(const gch
 	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 {
============================================================
--- libpurple/protocols/jabber/disco.c	309a0a06612e494844b8585d5dff34f0af281692
+++ libpurple/protocols/jabber/disco.c	2b5e3edcf38d4fe902d67b4c4325c49bc621fe23
@@ -480,10 +480,12 @@ jabber_disco_stun_srv_resolve_cb(PurpleS
 	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 @@ jabber_disco_server_info_result_cb(Jabbe
 		} 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... */
 		}
============================================================
--- libpurple/protocols/simple/simple.c	8d392d04f8c644822f0826ee92941a8e72ed6a17
+++ libpurple/protocols/simple/simple.c	c6ab22d22448712f03560f71c92d48aaff8924d1
@@ -1903,7 +1903,8 @@ static void srvresolved(PurpleSrvRespons
 	} 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 @@ static void simple_login(PurpleAccount *
 		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);
 }
 
============================================================
--- libpurple/stun.c	a8e35764faf2fe8424ba8de9f5c7963d66d4ca6b
+++ libpurple/stun.c	e856545d1fac9bbaab3fa6f32f2b84fe4b013220
@@ -365,7 +365,7 @@ static void do_test1(PurpleSrvResponse *
 	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 @@ PurpleStunNatDiscovery *purple_stun_disc
 	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;
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c	db4ddb347410a58b2595c1115f6798e5b378d5ab
+++ libpurple/protocols/bonjour/bonjour_ft.c	32fa3fc9eaffd055c9bf7faee6d2f643cbd28349
@@ -883,8 +883,9 @@ bonjour_bytestreams_connect(PurpleXfer *
 	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);
============================================================
--- libpurple/protocols/qq/qq_network.c	50797fae2b215d4eb71b21a0128ce71a3b4a5996
+++ libpurple/protocols/qq/qq_network.c	85af9b8a7b22bdb9dc67ba0c815fa5223e9462d0
@@ -987,7 +987,7 @@ gboolean connect_to_server(PurpleConnect
 	}
 
 	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;
============================================================
--- libpurple/protocols/jabber/google/jingleinfo.c	b7d73a6b8c375f619c65f4a861f6c4322affe0b0
+++ libpurple/protocols/jabber/google/jingleinfo.c	70a53ff970e3705a25a264c748dac2f57218ce70
@@ -109,13 +109,15 @@ jabber_google_jingle_info_common(JabberS
 			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);
 			}
 		}


More information about the Commits mailing list