[telepathy-gabble/master] Updated RawUdp to implement inject_candidates
Will Thompson
will.thompson at collabora.co.uk
Sat Jun 27 04:06:32 PDT 2009
XEP-0177 says that rawudp candidates MUST/SHOULD be in
{add,initiate}/accept, respectively, and says absolutely nothing about
transport-info. So we inject our candidates into those messages, and
leave _send() unimplemented.
---
src/jingle-transport-rawudp.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/src/jingle-transport-rawudp.c b/src/jingle-transport-rawudp.c
index da12361..ac18e4b 100644
--- a/src/jingle-transport-rawudp.c
+++ b/src/jingle-transport-rawudp.c
@@ -305,25 +305,16 @@ parse_candidates (GabbleJingleTransportIface *obj,
priv->remote_candidates = candidates;
}
-static LmMessageNode *
-produce_node (GabbleJingleTransportIface *obj, LmMessageNode *parent,
- JingleAction action)
+static void
+inject_candidates (GabbleJingleTransportIface *obj,
+ LmMessageNode *transport_node)
{
- GabbleJingleTransportRawUdp *transport =
- GABBLE_JINGLE_TRANSPORT_RAWUDP (obj);
- GabbleJingleTransportRawUdpPrivate *priv =
- GABBLE_JINGLE_TRANSPORT_RAWUDP_GET_PRIVATE (transport);
+ GabbleJingleTransportRawUdp *self = GABBLE_JINGLE_TRANSPORT_RAWUDP (obj);
+ GabbleJingleTransportRawUdpPrivate *priv = self->priv;
JingleCandidate *c;
GList *li;
gchar port_str[16];
LmMessageNode *cnode;
- LmMessageNode *trans_node;
-
- /* Note: we're producing the candidate(s) in both transport-info
- * and -add/-accept until the RAW-UDP XEP is updated */
-
- trans_node = lm_message_node_add_child (parent, "transport", NULL);
- lm_message_node_set_attribute (parent, "xmlns", priv->transport_ns);
/* If we don't have the local candidates yet, we should've waited with
* the session initiation. */
@@ -334,7 +325,7 @@ produce_node (GabbleJingleTransportIface *obj, LmMessageNode *parent,
c = (JingleCandidate *) li->data;
sprintf (port_str, "%d", c->port);
- cnode = lm_message_node_add_child (trans_node, "candidate", NULL);
+ cnode = lm_message_node_add_child (transport_node, "candidate", NULL);
lm_message_node_set_attributes (cnode,
"ip", c->address,
"port", port_str,
@@ -343,8 +334,6 @@ produce_node (GabbleJingleTransportIface *obj, LmMessageNode *parent,
"component", c->component,
NULL);
}
-
- return trans_node;
}
/* Takes in a list of slice-allocated JingleCandidate structs */
@@ -401,8 +390,13 @@ transport_iface_init (gpointer g_iface, gpointer iface_data)
GabbleJingleTransportIfaceClass *klass = (GabbleJingleTransportIfaceClass *) g_iface;
klass->parse_candidates = parse_candidates;
- klass->produce_node = produce_node;
+
klass->new_local_candidates = new_local_candidates;
+ klass->inject_candidates = inject_candidates;
+ /* Not implementing _send: XEP-0177 says that the candidates live in
+ * content-{add,accept}, not in transport-info.
+ */
+
klass->get_remote_candidates = get_remote_candidates;
klass->get_transport_type = get_transport_type;
}
--
1.5.6.5
More information about the telepathy-commits
mailing list