# HG changeset patch # User Kim Alvefur # Date 1430509584 -7200 # Node ID d80d27234e38559f0e538965158147727934b675 # Parent 154c2f04d73b0a3ba1d4e0b12295c804f0fc3927 plugins.jingle_ft: Update to version 0.16 diff -r 154c2f04d73b -r d80d27234e38 plugins/jingle_ft.lua --- a/plugins/jingle_ft.lua Sun Nov 16 19:33:18 2014 +0100 +++ b/plugins/jingle_ft.lua Fri May 01 21:46:24 2015 +0200 @@ -3,8 +3,7 @@ local dirsep = package.config:sub(1,1); -local xmlns_jingle_ft = "urn:xmpp:jingle:apps:file-transfer:1"; -local xmlns_si_file_transfer = "http://jabber.org/protocol/si/profile/file-transfer"; +local xmlns_jingle_ft = "urn:xmpp:jingle:apps:file-transfer:4"; function verse.plugins.jingle_ft(stream) stream:hook("ready", function () @@ -26,10 +25,12 @@ local ft_mt = { __index = ft_content }; stream:hook("jingle/content/"..xmlns_jingle_ft, function (jingle, description_tag) - local file_tag = description_tag:get_child("offer"):get_child("file", xmlns_si_file_transfer); + local file_tag = description_tag:get_child("file"); local file = { - name = file_tag.attr.name; - size = tonumber(file_tag.attr.size); + name = file_tag:get_child_text("name"); + size = tonumber(file_tag:get_child_text("size")); + desc = file_tag:get_child_text("desc"); + date = file_tag:get_child_text("date"); }; return setmetatable({ jingle = jingle, file = file }, ft_mt); @@ -42,14 +43,12 @@ date = os.date("!%Y-%m-%dT%H:%M:%SZ", file_info.timestamp); end return verse.stanza("description", { xmlns = xmlns_jingle_ft }) - :tag("offer") - :tag("file", { xmlns = xmlns_si_file_transfer, - name = file_info.filename, -- Mandatory - size = file_info.size, -- Mandatory - date = date, - hash = file_info.hash, - }) - :tag("desc"):text(file_info.description or ""); + :tag("file") + :tag("name"):text(file_info.filename):up() + :tag("size"):text(tostring(file_info.size)):up() + :tag("date"):text(date):up() + :tag("desc"):text(file_info.description):up() + :up(); end); function stream:send_file(to, filename)