pidgin.vv: 2149cf9a: Choose the transport type according to t...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Dec 5 21:30:50 EST 2008


-----------------------------------------------------------------
Revision: 2149cf9a6d4604f6e78ed9a2bdb0bbc3d6041a36
Ancestor: 1832b1eb95120e4bb35d7b15d6295bbe129b9bc1
Author: maiku at soc.pidgin.im
Date: 2008-12-06T02:20:09
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/2149cf9a6d4604f6e78ed9a2bdb0bbc3d6041a36

Modified files:
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/jabber/jingle/rtp.c

ChangeLog: 

Choose the transport type according to the responder's caps.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	9e658b4fec070e82fd7c14d4b4071ff32546a10f
+++ libpurple/protocols/jabber/jabber.c	16533b456bb1d6dc3d760937a598c58e0ed99392
@@ -2431,6 +2431,15 @@ gboolean jabber_can_do_media(PurpleConne
 		purple_debug_error("jabber", "Could not find buddy\n");
 		return FALSE;
 	}
+
+	if (!jabber_buddy_has_capability(jb, JINGLE_TRANSPORT_ICEUDP) &&
+			!jabber_buddy_has_capability(jb,
+			JINGLE_TRANSPORT_RAWUDP)) {
+		purple_debug_error("jingle-rtp", "Buddy doesn't support "
+				"the same transport types\n");
+		return FALSE;
+	}
+
 	/* XMPP will only support two-way media, AFAIK... */
 	if (type == (PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO)) {
 		purple_debug_info("jabber", 
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c	179441a6223449748de90916c82ff3ecbb55781f
+++ libpurple/protocols/jabber/jingle/rtp.c	ee8cb8290fd90351b04140e1dc5969bb9250f845
@@ -666,6 +666,7 @@ jingle_rtp_initiate_media(JabberStream *
 	JabberBuddy *jb;
 	JabberBuddyResource *jbr;
 	PurpleMedia *media;
+	const gchar *transport_type;
 	
 	gchar *jid = NULL, *me = NULL, *sid = NULL;
 
@@ -680,6 +681,16 @@ jingle_rtp_initiate_media(JabberStream *
 		purple_debug_error("jingle-rtp", "Could not find buddy's resource\n");
 	}
 
+	if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) {
+		transport_type = JINGLE_TRANSPORT_ICEUDP;
+	} else if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_RAWUDP)) {
+		transport_type = JINGLE_TRANSPORT_RAWUDP;
+	} else {
+		purple_debug_error("jingle-rtp", "Resource doesn't support "
+				"the same transport types\n");
+		return NULL;
+	}
+
 	if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) {
 		jid = g_strdup_printf("%s/%s", who, jbr->name);
 	} else {
@@ -695,7 +706,7 @@ jingle_rtp_initiate_media(JabberStream *
 
 
 	if (type & PURPLE_MEDIA_AUDIO) {
-		transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP);
+		transport = jingle_transport_create(transport_type);
 		content = jingle_content_create(JINGLE_APP_RTP, "initiator",
 				"session", "audio-session", "both", transport);
 		jingle_session_add_content(session, content);
@@ -703,7 +714,7 @@ jingle_rtp_initiate_media(JabberStream *
 		jingle_rtp_init_media(content);
 	}
 	if (type & PURPLE_MEDIA_VIDEO) {
-		transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP);
+		transport = jingle_transport_create(transport_type);
 		content = jingle_content_create(JINGLE_APP_RTP, "initiator",
 				"session", "video-session", "both", transport);
 		jingle_session_add_content(session, content);


More information about the Commits mailing list