# HG changeset patch # User Mike Ruprecht # Date 1228530009 0 # Node ID 99055b8db16bc19786e73258e3b5f1e6868cc55f # Parent a62d10cce27a2259249306610f4587c15d533e02 Choose the transport type according to the responder's caps. diff -r a62d10cce27a -r 99055b8db16b libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Tue Nov 25 02:59:47 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sat Dec 06 02:20:09 2008 +0000 @@ -2431,6 +2431,15 @@ 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", diff -r a62d10cce27a -r 99055b8db16b libpurple/protocols/jabber/jingle/rtp.c --- a/libpurple/protocols/jabber/jingle/rtp.c Tue Nov 25 02:59:47 2008 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.c Sat Dec 06 02:20:09 2008 +0000 @@ -666,6 +666,7 @@ JabberBuddy *jb; JabberBuddyResource *jbr; PurpleMedia *media; + const gchar *transport_type; gchar *jid = NULL, *me = NULL, *sid = NULL; @@ -680,6 +681,16 @@ 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 @@ 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_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);