Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/jingle/iceudp.c @ 26201:36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Tue, 24 Feb 2009 23:36:51 +0000 |
parents | 84ea07648377 |
children | dfb6fbd89ac2 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/iceudp.c Tue Feb 24 08:25:23 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/iceudp.c Tue Feb 24 23:36:51 2009 +0000 @@ -78,6 +78,7 @@ g_free(candidate->id); g_free(candidate->ip); g_free(candidate->protocol); + g_free(candidate->reladdr); g_free(candidate->type); g_free(candidate->username); @@ -302,6 +303,8 @@ const gchar *password = xmlnode_get_attrib(iceudp, "pwd"); for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { + const gchar *relport = + xmlnode_get_attrib(candidate, "rel-port"); iceudp_candidate = jingle_iceudp_candidate_new( atoi(xmlnode_get_attrib(candidate, "component")), xmlnode_get_attrib(candidate, "foundation"), @@ -314,6 +317,10 @@ xmlnode_get_attrib(candidate, "protocol"), xmlnode_get_attrib(candidate, "type"), username, password); + iceudp_candidate->reladdr = g_strdup( + xmlnode_get_attrib(candidate, "rel-addr")); + iceudp_candidate->relport = + relport != NULL ? atoi(relport) : 0; jingle_iceudp_add_remote_candidate(JINGLE_ICEUDP(transport), iceudp_candidate); } @@ -357,10 +364,20 @@ xmlnode_set_attrib(xmltransport, "priority", priority); xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); + if (candidate->reladdr != NULL && + (strcmp(candidate->ip, candidate->reladdr) || + (candidate->port != candidate->relport))) { + gchar *relport = g_strdup_printf("%d", + candidate->relport); + xmlnode_set_attrib(xmltransport, "rel-addr", + candidate->reladdr); + xmlnode_set_attrib(xmltransport, "rel-port", + relport); + g_free(relport); + } + if (action == JINGLE_SESSION_ACCEPT) { /* XXX: fix this, it's dummy data */ - xmlnode_set_attrib(xmltransport, "rel-addr", "10.0.1.1"); - xmlnode_set_attrib(xmltransport, "rel-port", "8998"); xmlnode_set_attrib(xmltransport, "rem-addr", "192.0.2.1"); xmlnode_set_attrib(xmltransport, "rem-port", "3478"); }