Mercurial > pidgin
diff libpurple/protocols/jabber/jabber.c @ 30515:7f1da2fbe7fc
propagate from branch 'im.pidgin.pidgin' (head a582dd339f019301adca693df4b1a8fb135a1774)
to branch 'im.pidgin.cpw.malu.xmpp.google_relay' (head ed59323895a1ea93985fe761fbd1749dd8af5638)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Sun, 06 Dec 2009 19:06:42 +0000 |
parents | 0f7025534fc5 ef2c74d0ef19 |
children | 105437d8253f |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Sun Dec 06 04:31:39 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Dec 06 19:06:42 2009 +0000 @@ -857,6 +857,9 @@ js->stun_ip = NULL; js->stun_port = 0; js->stun_query = NULL; + js->google_relay_token = NULL; + js->google_relay_host = NULL; + js->google_relay_requests = NULL; /* if we are idle, set idle-ness on the stream (this could happen if we get disconnected and the reconnects while being idle. I don't think it makes @@ -1561,6 +1564,21 @@ js->stun_query = NULL; } + /* remove Google relay-related stuff */ + g_free(js->google_relay_token); + g_free(js->google_relay_host); + if (js->google_relay_requests) { + while (js->google_relay_requests) { + PurpleUtilFetchUrlData *url_data = + (PurpleUtilFetchUrlData *) js->google_relay_requests->data; + purple_util_fetch_url_cancel(url_data); + g_free(url_data); + js->google_relay_requests = + g_list_delete_link(js->google_relay_requests, + js->google_relay_requests); + } + } + g_free(js); gc->proto_data = NULL; @@ -3020,10 +3038,14 @@ jbr = jabber_buddy_find_resource(jb, resource); g_free(resource); - if (type & PURPLE_MEDIA_AUDIO && - !jabber_resource_has_capability(jbr, - JINGLE_APP_RTP_SUPPORT_AUDIO) && - jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) + /* if we are on a Google Talk connection and the remote supports + Google Jingle, we will go with that */ + if (((js->googletalk && js->google_relay_token) || + !jabber_resource_has_capability(jbr, JINGLE_APP_RTP_SUPPORT_AUDIO)) + && (((type & PURPLE_MEDIA_AUDIO) && + jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) + || ((type & PURPLE_MEDIA_VIDEO) && + jabber_resource_has_capability(jbr, NS_GOOGLE_VIDEO)))) return jabber_google_session_initiate(js, who, type); else return jingle_rtp_initiate_media(js, who, type);