Changeset

140:97bf22d6ff96

plugins.jingle, plugins.jingle_s5b: API changes to allow not sending <reason> inside <content> when transfer succeeds
author Matthew Wild <mwild1@gmail.com>
date Wed, 15 Sep 2010 16:31:24 +0100
parents 139:ccb8ecde8b09
children 141:15706f6492ae
files plugins/jingle.lua plugins/jingle_s5b.lua
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/jingle.lua	Wed Sep 15 16:17:40 2010 +0100
+++ b/plugins/jingle.lua	Wed Sep 15 16:31:24 2010 +0100
@@ -159,9 +159,7 @@
 				action = command,
 				initiator = self.role == "initiator" and self.stream.jid or nil,
 				responder = self.role == "responder" and self.jid or nil,
-			})
-				:tag("content", { creator = self.creator, name = self.name })
-					:add_child(element);
+			}):add_child(element);
 		if not callback then
 			self.stream:send(stanza);
 		else
--- a/plugins/jingle_s5b.lua	Wed Sep 15 16:17:40 2010 +0100
+++ b/plugins/jingle_s5b.lua	Wed Sep 15 16:31:24 2010 +0100
@@ -141,8 +141,9 @@
 		if #streamhost_array > 0 then
 			self.connecting_peer_candidates = true;
 			local function onconnect(streamhost, conn)
-				self.jingle:send_command("transport-info", verse.stanza("transport", { xmlns = xmlns_s5b, sid = self.s5b_sid })
-					:tag("candidate-used", { cid = streamhost.cid }));
+				self.jingle:send_command("transport-info", verse.stanza("content", { creator = self.creator, name = self.name })
+					:tag("transport", { xmlns = xmlns_s5b, sid = self.s5b_sid })
+						:tag("candidate-used", { cid = streamhost.cid }));
 				self.onconnect_callback = callback;
 				self.conn = conn;
 			end
@@ -156,7 +157,8 @@
 	
 	function s5b:info_received(jingle_tag)
 		stream:warn("Info received");
-		local transport_tag = jingle_tag:child_with_name("content"):child_with_name("transport");
+		local content_tag = jingle_tag:child_with_name("content");
+		local transport_tag = content_tag:child_with_name("transport");
 		if transport_tag:get_child("candidate-used") and not self.connecting_peer_candidates then
 			local candidate_used = transport_tag:child_with_name("candidate-used");
 			if candidate_used then
@@ -169,8 +171,9 @@
 								:tag("activate"):text(self.jingle.peer), function (result)
 							
 							if result.attr.type == "result" then
-								self.jingle:send_command("transport-info", verse.stanza("transport", { xmlns = xmlns_s5b, sid = self.s5b_sid })
-									:tag("activated", { cid = candidate_used.attr.cid }));
+								self.jingle:send_command("transport-info", verse.stanza("content", content_tag.attr)
+									:tag("transport", { xmlns = xmlns_s5b, sid = self.s5b_sid })
+										:tag("activated", { cid = candidate_used.attr.cid }));
 								self.conn = conn;
 								self.onconnect_callback(conn);
 							else