cpw.malu.xmpp.google_ft: d42c2cf4: send channel create message and use the ...
malu at pidgin.im
malu at pidgin.im
Mon Sep 13 17:30:57 EDT 2010
----------------------------------------------------------------------
Revision: d42c2cf4ffffa6baf8f0561517d8f04a6e4f44b9
Parent: 9e2901a7a9c2eefdb124ff99b43fee19c6a5d025
Author: malu at pidgin.im
Date: 09/13/10 17:26:39
Branch: im.pidgin.cpw.malu.xmpp.google_ft
URL: http://d.pidgin.im/viewmtn/revision/info/d42c2cf4ffffa6baf8f0561517d8f04a6e4f44b9
Changelog:
send channel create message and use the allocated channel name on the candidates, this seems to be what gabble does...
Changes against parent 9e2901a7a9c2eefdb124ff99b43fee19c6a5d025
patched libpurple/protocols/jabber/google/google_session.c
patched libpurple/protocols/jabber/google/google_share.c
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google/google_session.c 81fefa9f4e2b619439e4014394de5dc9793772c3
+++ libpurple/protocols/jabber/google/google_session.c ef29beb85ad3f646f5da2068d41b7f1f19817180
@@ -28,7 +28,7 @@ void
static GList *google_sessions = NULL;
void
-google_session_destroy(GoogleSession *session)
+jabber_google_session_destroy(GoogleSession *session)
{
jabber_google_session_unregister(session);
============================================================
--- libpurple/protocols/jabber/google/google_share.c 386c492e5dcde31f598a9f3b8dfa8a12d23d9fe9
+++ libpurple/protocols/jabber/google/google_share.c 353271ef85659ca07046d31920e6a15361df1883
@@ -32,6 +32,7 @@ typedef struct {
PurpleXfer *xfer;
NiceAgent *agent;
guint stream_id;
+ gchar *channel_name;
GList *remote_candidates; /* list of PurpleMediaCandidate */
gboolean got_relay; /* this indicates if gotten relay credentials */
} GoogleShareSessionData;
@@ -50,7 +51,8 @@ static xmlnode *
}
static xmlnode *
-google_share_nice_candidate_to_xml(const NiceCandidate *cand)
+google_share_nice_candidate_to_xml(const NiceCandidate *cand,
+ const gchar *channel_name)
{
xmlnode *candidate = xmlnode_new("candidate");
gchar address[NICE_ADDRESS_STRING_LEN];
@@ -60,7 +62,7 @@ google_share_nice_candidate_to_xml(const
xmlnode_set_attrib(candidate, "address", address);
xmlnode_set_attrib(candidate, "port",
g_strdup_printf("%d", nice_address_get_port(&cand->addr)));
- xmlnode_set_attrib(candidate, "name", "rtp");
+ xmlnode_set_attrib(candidate, "name", channel_name);
xmlnode_set_attrib(candidate, "username", cand->username);
xmlnode_set_attrib(candidate, "password",
cand->password != NULL ? cand->password : "");
@@ -99,7 +101,8 @@ google_share_candidate_gathering_done_cb
xmlnode_insert_child(iq->node, sess);
xmlnode_set_attrib(iq->node, "to", session->remote_jid);
xmlnode_insert_child(sess,
- google_share_nice_candidate_to_xml(candidate));
+ google_share_nice_candidate_to_xml(candidate,
+ session_data->channel_name));
jabber_iq_send(iq);
@@ -126,15 +129,30 @@ google_share_init(PurpleXfer *xfer)
session->js->user->node,
session->js->user->domain,
session->js->user->resource);
- JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
- xmlnode *sess = google_session_create_xmlnode(session, "accept");
-
+ JabberIq *iq;
+ xmlnode *sess;
+ xmlnode *channel;
+
/* send accept */
+ iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+ sess = google_session_create_xmlnode(session, "accept");
xmlnode_set_attrib(iq->node, "to", session->remote_jid);
xmlnode_set_attrib(iq->node, "from", me);
xmlnode_insert_child(iq->node, sess);
xmlnode_insert_child(sess, xmlnode_copy(session->description));
jabber_iq_send(iq);
+
+ /* create channel */
+ session_data->channel_name = jabber_get_next_id(session->js);
+ iq = jabber_iq_new(session->js, JABBER_IQ_SET);
+ sess = google_session_create_xmlnode(session, "info");
+ channel = xmlnode_new_child(sess, "channel");
+ xmlnode_set_namespace(channel, NS_GOOGLE_SHARE);
+ xmlnode_set_attrib(channel, "name", session_data->channel_name);
+ xmlnode_set_attrib(iq->node, "to", session->remote_jid);
+ xmlnode_set_attrib(iq->node, "from", me);
+ xmlnode_insert_child(iq->node, sess);
+ jabber_iq_send(iq);
/* start agent */
nice_agent_gather_candidates(session_data->agent, session_data->stream_id);
More information about the Commits
mailing list