changeset 26554:3c684403ea10

Fix merge for ./jingle/
author Paul Aurich <paul@darkrain42.org>
date Fri, 03 Apr 2009 17:36:24 +0000
parents 91583903b478
children 50ff0162fe26
files libpurple/protocols/jabber/jingle/jingle.c libpurple/protocols/jabber/jingle/jingle.h libpurple/protocols/jabber/jingle/rtp.c
diffstat 3 files changed, 15 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/jingle.c	Fri Apr 03 17:15:40 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/jingle.c	Fri Apr 03 17:36:24 2009 +0000
@@ -359,28 +359,21 @@
 }
 
 void
-jingle_parse(JabberStream *js, xmlnode *packet)
+jingle_parse(JabberStream *js, const char *from, JabberIqType type,
+             const char *id, xmlnode *jingle)
 {
-	const gchar *type = xmlnode_get_attrib(packet, "type");
-	xmlnode *jingle;
 	const gchar *action;
 	const gchar *sid;
 	JingleActionType action_type;
 	JingleSession *session;
 
-	if (!type || strcmp(type, "set")) {
-		/* send iq error here */
-		return;
-	}
-
-	/* is this a Jingle package? */
-	if (!(jingle = xmlnode_get_child(packet, "jingle"))) {
-		/* send iq error here */
+	if (type != JABBER_IQ_SET) {
+		/* TODO: send iq error here */
 		return;
 	}
 
 	if (!(action = xmlnode_get_attrib(jingle, "action"))) {
-		/* send iq error here */
+		/* TODO: send iq error here */
 		return;
 	}
 
@@ -409,9 +402,10 @@
 			/* send iq error */
 			return;
 		} else {
-			session = jingle_session_create(js, sid,
-					xmlnode_get_attrib(packet, "to"),
-					xmlnode_get_attrib(packet, "from"), FALSE);
+			char *own_jid = g_strdup_printf("%s@%s/%s", js->user->node,
+					js->user->domain, js->user->resource);
+			session = jingle_session_create(js, sid, own_jid, from, FALSE);
+			g_free(own_jid);
 		}
 	}
 
--- a/libpurple/protocols/jabber/jingle/jingle.h	Fri Apr 03 17:15:40 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/jingle.h	Fri Apr 03 17:36:24 2009 +0000
@@ -69,7 +69,8 @@
 
 GType jingle_get_type(const gchar *type);
 
-void jingle_parse(JabberStream *js, xmlnode *packet);
+void jingle_parse(JabberStream *js, const char *from, JabberIqType type,
+                  const char *id, xmlnode *child);
 
 void jingle_terminate_sessions(JabberStream *js);
 
--- a/libpurple/protocols/jabber/jingle/rtp.c	Fri Apr 03 17:15:40 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Fri Apr 03 17:36:24 2009 +0000
@@ -438,12 +438,13 @@
 }
 
 static void
-jingle_rtp_initiate_ack_cb(JabberStream *js, xmlnode *packet, gpointer data)
+jingle_rtp_initiate_ack_cb(JabberStream *js, const char *from,
+                           JabberIqType type, const char *id,
+                           xmlnode *packet, gpointer data)
 {
 	JingleSession *session = data;
 
-	if (!strcmp(xmlnode_get_attrib(packet, "type"), "error") ||
-			xmlnode_get_child(packet, "error")) {
+	if (type == JABBER_IQ_ERROR || xmlnode_get_child(packet, "error")) {
 		purple_media_end(jingle_rtp_get_media(session), NULL, NULL);
 		g_object_unref(session);
 		return;