cpw.malu.xmpp.jingle_ft: abfa505e: Always set "from JID" to the side sugges...

malu at pidgin.im malu at pidgin.im
Sun Apr 26 14:15:29 EDT 2009


-----------------------------------------------------------------
Revision: abfa505e8675242e74c6c45c38b66fb1c12f7162
Ancestor: 87608eb0a4946985272558c85bc6ef157c1b37ee
Author: malu at pidgin.im
Date: 2009-04-26T18:14:30
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/abfa505e8675242e74c6c45c38b66fb1c12f7162

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

ChangeLog: 

Always set "from JID" to the side suggesting the streamhost and "to JID" to
the side accepting the streamhost.
According to discussions in the Jingle MUC, this should allow the initiator
to accept bytestream proxies the receiver has suggested, this way the receiver
can activate the bytestream proxy acting as "from", as seen in the bytestream
negotiation-sense (see XEP-0065)

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c	1427ce19ab51ddcb2d31c1129d732bb8815020cc
+++ libpurple/protocols/jabber/jingle/s5b.c	91cce54b00190877005617b645ebaaa1e11546e9
@@ -619,14 +619,9 @@ jingle_s5b_send_read_again_cb(gpointer d
 	purple_input_remove(s5b->priv->watcher);
 	s5b->priv->watcher = 0;
 
-	if(jingle_session_is_initiator(session))
-		dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", s5b->priv->sid, 
-			js->user->node, js->user->domain, js->user->resource, 
-			dstjid->node, dstjid->domain, dstjid->resource);
-	else
-		dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", s5b->priv->sid, 
-			dstjid->node, dstjid->domain, dstjid->resource,
-			js->user->node, js->user->domain, js->user->resource);
+	dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", s5b->priv->sid, 
+		js->user->node, js->user->domain, js->user->resource, 
+		dstjid->node, dstjid->domain, dstjid->resource);
 
 	g_free(dstjid);
 		
@@ -1052,7 +1047,7 @@ jingle_s5b_connect_to_streamhost(JingleS
 	
 static void
 jingle_s5b_connect_to_streamhost(JingleS5BConnectData *data, 
-	const JabberBytestreamsStreamhost *sh, 
+	const JabberBytestreamsStreamhost *sh, gboolean is_proxy,
 	void (*connect_cb)(gpointer, gint, const gchar *),
 	GSourceFunc timeout_cb)
 {
@@ -1076,7 +1071,7 @@ jingle_s5b_connect_to_streamhost(JingleS
 	purple_proxy_info_set_host(s5b->priv->ppi, sh->host);
 	purple_proxy_info_set_port(s5b->priv->ppi, sh->port);
 	
-	if(jingle_session_is_initiator(session))
+	if (is_proxy)
 		dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", s5b->priv->sid, 
 			js->user->node, js->user->domain, js->user->resource, 
 			dstjid->node, dstjid->domain, dstjid->resource);
@@ -1119,8 +1114,8 @@ jingle_s5b_attempt_connect_internal(gpoi
 		JabberBytestreamsStreamhost *sh =
 			(JabberBytestreamsStreamhost *) s5b->priv->remaining_streamhosts->data;
 
-		jingle_s5b_connect_to_streamhost((JingleS5BConnectData *) data, sh,
-			jingle_s5b_connect_cb, jingle_s5b_connect_timeout_cb);
+		jingle_s5b_connect_to_streamhost((JingleS5BConnectData *) data, sh, 
+			FALSE, jingle_s5b_connect_cb, jingle_s5b_connect_timeout_cb);
 	} else {
 		/* send streamhost error */
 		
@@ -1234,11 +1229,8 @@ jingle_s5b_proxy_connect_cb(gpointer dat
 	query = xmlnode_get_child(iq->node, "query");
 	xmlnode_set_attrib(query, "sid", s5b->priv->sid);
 	activate = xmlnode_new_child(query, "activate");
-	if (jingle_session_is_initiator(session)) {
-		xmlnode_insert_data(activate, jingle_session_get_remote_jid(session), -1);
-	} else {
-		xmlnode_insert_data(activate, jingle_session_get_local_jid(session), -1);
-	}
+	xmlnode_insert_data(activate, jingle_session_get_remote_jid(session), -1);
+
 	jabber_iq_set_callback(iq, jingle_s5b_proxy_activate_cb, data);
 	jabber_iq_send(iq);
 }
@@ -1253,8 +1245,8 @@ jingle_s5b_connect_to_proxy(JingleSessio
 
 		data->session = session;
 		data->s5b = s5b;
-		jingle_s5b_connect_to_streamhost(data, sh, jingle_s5b_proxy_connect_cb,
-			jingle_s5b_proxy_timeout_cb);
+		jingle_s5b_connect_to_streamhost(data, sh, TRUE, 
+			jingle_s5b_proxy_connect_cb, jingle_s5b_proxy_timeout_cb);
 	} else {
 		purple_debug_error("jingle-s5b", 
 			"did not find the local streamhost specified in the "


More information about the Commits mailing list