pidgin.vv: 4316683a: Add the id attribute to ice-udp accordin...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Thu Feb 5 05:40:25 EST 2009
-----------------------------------------------------------------
Revision: 4316683ac01a13b979533e848b317372eaf61301
Ancestor: e48407df3a7626d82c3bd94cee02ad3be9a52cd7
Author: maiku at soc.pidgin.im
Date: 2009-02-05T09:36:23
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/4316683ac01a13b979533e848b317372eaf61301
Modified files:
libpurple/protocols/jabber/jingle/iceudp.c
libpurple/protocols/jabber/jingle/iceudp.h
libpurple/protocols/jabber/jingle/rtp.c
ChangeLog:
Add the id attribute to ice-udp according to the XEP.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/iceudp.c 6061e950c2b968ea84f2c2a23cb0c2a118240a39
+++ libpurple/protocols/jabber/jingle/iceudp.c c8b0e47119ee73fadcfa9b0ca6d9588192821849
@@ -57,6 +57,7 @@ jingle_iceudp_candidate_copy(JingleIceUd
new_candidate->component = candidate->component;
new_candidate->foundation = g_strdup(candidate->foundation);
new_candidate->generation = candidate->generation;
+ new_candidate->id = g_strdup(candidate->id);
new_candidate->ip = g_strdup(candidate->ip);
new_candidate->network = candidate->network;
new_candidate->port = candidate->port;
@@ -74,6 +75,7 @@ jingle_iceudp_candidate_free(JingleIceUd
jingle_iceudp_candidate_free(JingleIceUdpCandidate *candidate)
{
g_free(candidate->foundation);
+ g_free(candidate->id);
g_free(candidate->ip);
g_free(candidate->protocol);
g_free(candidate->type);
@@ -97,14 +99,16 @@ jingle_iceudp_candidate_new(guint compon
JingleIceUdpCandidate *
jingle_iceudp_candidate_new(guint component, const gchar *foundation,
- guint generation, const gchar *ip, guint network,
- guint port, guint priority, const gchar *protocol,
- const gchar *type, const gchar *username, const gchar *password)
+ guint generation, const gchar *id, const gchar *ip,
+ guint network, guint port, guint priority,
+ const gchar *protocol, const gchar *type,
+ const gchar *username, const gchar *password)
{
JingleIceUdpCandidate *candidate = g_new0(JingleIceUdpCandidate, 1);
candidate->component = component;
candidate->foundation = g_strdup(foundation);
candidate->generation = generation;
+ candidate->id = g_strdup(id);
candidate->ip = g_strdup(ip);
candidate->network = network;
candidate->port = port;
@@ -233,8 +237,7 @@ jingle_iceudp_add_local_candidate(Jingle
for (; iter; iter = g_list_next(iter)) {
JingleIceUdpCandidate *c = iter->data;
- if ((c->component == candidate->component) &&
- !strcmp(c->foundation, candidate->foundation)) {
+ if (!strcmp(c->id, candidate->id)) {
guint generation = c->generation + 1;
g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, c);
@@ -261,13 +264,12 @@ jingle_iceudp_get_remote_candidate_by_id
static JingleIceUdpCandidate *
jingle_iceudp_get_remote_candidate_by_id(JingleIceUdp *iceudp,
- guint component, const gchar *foundation)
+ const gchar *id)
{
GList *iter = iceudp->priv->remote_candidates;
for (; iter; iter = g_list_next(iter)) {
JingleIceUdpCandidate *candidate = iter->data;
- if ((candidate->component == component) &&
- !strcmp(candidate->foundation, foundation)) {
+ if (!strcmp(candidate->id, id)) {
return candidate;
}
}
@@ -280,7 +282,7 @@ jingle_iceudp_add_remote_candidate(Jingl
JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp);
JingleIceUdpCandidate *iceudp_candidate =
jingle_iceudp_get_remote_candidate_by_id(iceudp,
- candidate->component, candidate->foundation);
+ candidate->id);
if (iceudp_candidate != NULL) {
priv->remote_candidates = g_list_remove(
priv->remote_candidates, iceudp_candidate);
@@ -304,6 +306,7 @@ jingle_iceudp_parse_internal(xmlnode *ic
atoi(xmlnode_get_attrib(candidate, "component")),
xmlnode_get_attrib(candidate, "foundation"),
atoi(xmlnode_get_attrib(candidate, "generation")),
+ xmlnode_get_attrib(candidate, "id"),
xmlnode_get_attrib(candidate, "ip"),
atoi(xmlnode_get_attrib(candidate, "network")),
atoi(xmlnode_get_attrib(candidate, "port")),
@@ -347,6 +350,7 @@ jingle_iceudp_to_xml_internal(JingleTran
xmlnode_set_attrib(xmltransport, "component", component);
xmlnode_set_attrib(xmltransport, "foundation", candidate->foundation);
xmlnode_set_attrib(xmltransport, "generation", generation);
+ xmlnode_set_attrib(xmltransport, "id", candidate->id);
xmlnode_set_attrib(xmltransport, "ip", candidate->ip);
xmlnode_set_attrib(xmltransport, "network", network);
xmlnode_set_attrib(xmltransport, "port", port);
============================================================
--- libpurple/protocols/jabber/jingle/iceudp.h d64294b4e4ffbef599e101e44cfc2e26685a2185
+++ libpurple/protocols/jabber/jingle/iceudp.h 05e048ce2b3640c8dbf077ecc9614639289812eb
@@ -66,6 +66,7 @@ struct _JingleIceUdpCandidate
guint component;
gchar *foundation;
guint generation;
+ gchar *id;
gchar *ip;
guint network;
guint port;
@@ -91,9 +92,10 @@ JingleIceUdpCandidate *jingle_iceudp_can
GType jingle_iceudp_get_type(void);
JingleIceUdpCandidate *jingle_iceudp_candidate_new(guint component,
- const gchar *foundation, guint generation, const gchar *ip,
- guint network, guint port, guint priority, const gchar *protocol,
- const gchar *type, const gchar *username, const gchar *password);
+ const gchar *foundation, guint generation, const gchar *id,
+ const gchar *ip, guint network, guint port, guint priority,
+ const gchar *protocol, const gchar *type,
+ const gchar *username, const gchar *password);
void jingle_iceudp_add_local_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate);
GList *jingle_iceudp_get_remote_candidates(JingleIceUdp *iceudp);
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c 7b59484de69bb7150b13f150be58f736b3d91289
+++ libpurple/protocols/jabber/jingle/rtp.c 55bddce2006e17372b1f84b60b2159a405031cf0
@@ -207,8 +207,10 @@ jingle_rtp_candidates_to_transport(Jingl
JingleIceUdpCandidate *iceudp_candidate;
for (; candidates; candidates = g_list_next(candidates)) {
PurpleMediaCandidate *candidate = candidates->data;
+ gchar *id = jabber_get_next_id(
+ jingle_session_get_js(session));
iceudp_candidate = jingle_iceudp_candidate_new(candidate->component_id,
- candidate->foundation, generation, candidate->ip,
+ candidate->foundation, generation, id, candidate->ip,
0, candidate->port, candidate->priority, "udp",
candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" :
candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" :
@@ -216,6 +218,7 @@ jingle_rtp_candidates_to_transport(Jingl
candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : "",
candidate->username, candidate->password);
jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), iceudp_candidate);
+ g_free(id);
}
return transport;
} else {
More information about the Commits
mailing list