cpw.malu.xmpp.google_ft: 17c13254: actually set the address and port on rem...

malu at pidgin.im malu at pidgin.im
Sun Sep 19 08:50:43 EDT 2010


----------------------------------------------------------------------
Revision: 17c13254fc41a7739bf0761d8309955911839865
Parent:   b06c4ed49f9dc58fabc28129333a3e89b6c731f9
Author:   malu at pidgin.im
Date:     09/19/10 08:44:37
Branch:   im.pidgin.cpw.malu.xmpp.google_ft
URL: http://d.pidgin.im/viewmtn/revision/info/17c13254fc41a7739bf0761d8309955911839865

Changelog: 

actually set the address and port on remote candidates

Changes against parent b06c4ed49f9dc58fabc28129333a3e89b6c731f9

  patched  libpurple/protocols/jabber/google/google_share.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google/google_share.c	6ea43e9476207afe8b54a037fc8a3e208fae7cfe
+++ libpurple/protocols/jabber/google/google_share.c	e2585a637c0113105f0a676b1bf28f424c3ad7ae
@@ -60,11 +60,11 @@ google_share_get_nice_candidate_from_xml
 	const gchar *name = xmlnode_get_attrib(candidate, "name");
 	const gchar *type = xmlnode_get_attrib(candidate, "type");
 	const gchar *address = xmlnode_get_attrib(candidate, "address");
-	const gchar *port = xmlnode_get_attrib(candidate, "port");
+	guint port = atoi(xmlnode_get_attrib(candidate, "port"));
 	const gchar *protocol = xmlnode_get_attrib(candidate, "protocol");
 	const gchar *preference = xmlnode_get_attrib(candidate, "preference");
 	
-	if (name && type && address && port) {
+	if (name && type && address && port != 0) {
 		guint prio = preference ? atof(preference) * 1000 : 0;
 		cand = nice_candidate_new(purple_strequal(type, "host") ?
 			NICE_CANDIDATE_TYPE_HOST :
@@ -72,6 +72,16 @@ google_share_get_nice_candidate_from_xml
 			purple_strequal(type, "relay") ? NICE_CANDIDATE_TYPE_RELAYED :
 			NICE_CANDIDATE_TYPE_HOST);
 
+		nice_address_init(&cand->addr);
+
+		if (!nice_address_set_from_string(&cand->addr, address)) {
+			purple_debug_error("google-share",
+				"got invalid address in remote candidate\n");
+			nice_candidate_free(cand);
+			return NULL;
+		}
+
+		nice_address_set_port(&cand->addr, port);
 		cand->priority = prio;
 		cand->stream_id = stream_id;
 		cand->username = g_strdup(xmlnode_get_attrib(candidate, "username"));


More information about the Commits mailing list