pidgin.vv: 522b28dc: Send candidates more like GMail.
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Mon Mar 23 04:10:30 EDT 2009
-----------------------------------------------------------------
Revision: 522b28dcbc930bb24ddce8eb7d1ae6210ca3d75a
Ancestor: dcebdcbd0f8b5de73d367ab373e91b35a3e1a3c1
Author: maiku at soc.pidgin.im
Date: 2009-03-23T07:37:40
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/522b28dcbc930bb24ddce8eb7d1ae6210ca3d75a
Modified files:
libpurple/protocols/jabber/google.c
ChangeLog:
Send candidates more like GMail.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google.c ad5bc43161f250b37431612f36d0a4ed56f7e4af
+++ libpurple/protocols/jabber/google.c aa2ae3714a98c238489f50609517162cbe78d9d4
@@ -104,28 +104,31 @@ google_session_send_candidates(PurpleMed
google_session_send_candidates(PurpleMedia *media, gchar *session_id,
gchar *participant, GoogleSession *session)
{
- JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
GList *candidates = purple_media_get_local_candidates(session->media, "google-voice",
session->remote_jid);
PurpleMediaCandidate *transport;
- xmlnode *sess;
- xmlnode *candidate;
- sess = google_session_create_xmlnode(session, "candidates");
- xmlnode_insert_child(iq->node, sess);
- xmlnode_set_attrib(iq->node, "to", session->remote_jid);
for (;candidates;candidates = candidates->next) {
+ JabberIq *iq;
char port[8];
char pref[8];
+ xmlnode *sess;
+ xmlnode *candidate;
transport = (PurpleMediaCandidate*)(candidates->data);
- if (!strcmp(transport->ip, "127.0.0.1"))
+ if (transport->component_id != PURPLE_MEDIA_COMPONENT_RTP)
continue;
+ iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+ sess = google_session_create_xmlnode(session, "candidates");
+ xmlnode_insert_child(iq->node, sess);
+ xmlnode_set_attrib(iq->node, "to", session->remote_jid);
+
candidate = xmlnode_new("candidate");
g_snprintf(port, sizeof(port), "%d", transport->port);
- g_snprintf(pref, sizeof(pref), "%d", transport->priority);
+ g_snprintf(pref, sizeof(pref), "%f",
+ transport->priority/1000.0);
xmlnode_set_attrib(candidate, "address", transport->ip);
xmlnode_set_attrib(candidate, "port", port);
@@ -151,8 +154,9 @@ google_session_send_candidates(PurpleMed
xmlnode_set_attrib(candidate, "generation", "0");
xmlnode_set_attrib(candidate, "network", "0");
xmlnode_insert_child(sess, candidate);
+
+ jabber_iq_send(iq);
}
- jabber_iq_send(iq);
}
static void
@@ -183,6 +187,9 @@ google_session_ready(GoogleSession *sess
xmlnode_set_attrib(iq->node, "from", session->id.initiator);
sess = google_session_create_xmlnode(session, "initiate");
} else {
+ google_session_send_candidates(session->media,
+ "google-voice", session->remote_jid,
+ session);
xmlnode_set_attrib(iq->node, "to", session->remote_jid);
xmlnode_set_attrib(iq->node, "from", me);
sess = google_session_create_xmlnode(session, "accept");
@@ -208,8 +215,10 @@ google_session_ready(GoogleSession *sess
jabber_iq_send(iq);
- google_session_send_candidates(session->media,
- "google-voice", session->remote_jid, session);
+ if (is_initiator)
+ google_session_send_candidates(session->media,
+ "google-voice", session->remote_jid,
+ session);
g_signal_handlers_disconnect_by_func(G_OBJECT(session->media),
G_CALLBACK(google_session_ready), session);
More information about the Commits
mailing list