Software /
code /
verse
Diff
plugins/jingle_ft.lua @ 380:0891b4e27766
Discard trailing whitespace
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 May 2015 23:27:29 +0200 |
parent | 379:d80d27234e38 |
line wrap: on
line diff
--- a/plugins/jingle_ft.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/jingle_ft.lua Fri May 01 23:27:29 2015 +0200 @@ -9,9 +9,9 @@ stream:hook("ready", function () stream:add_disco_feature(xmlns_jingle_ft); end, 10); - + local ft_content = { type = "file" }; - + function ft_content:generate_accept(description, options) if options and options.save_file then self.jingle:hook("connected", function () @@ -19,10 +19,10 @@ self.jingle:set_sink(sink); end); end - + return description; end - + local ft_mt = { __index = ft_content }; stream:hook("jingle/content/"..xmlns_jingle_ft, function (jingle, description_tag) local file_tag = description_tag:get_child("file"); @@ -32,10 +32,10 @@ desc = file_tag:get_child_text("desc"); date = file_tag:get_child_text("date"); }; - + return setmetatable({ jingle = jingle, file = file }, ft_mt); end); - + stream:hook("jingle/describe/file", function (file_info) -- Return <description/> local date; @@ -54,12 +54,12 @@ function stream:send_file(to, filename) local file, err = io.open(filename); if not file then return file, err; end - + local file_size = file:seek("end", 0); file:seek("set", 0); - + local source = ltn12.source.file(file); - + local jingle = self:jingle(to); jingle:offer("file", { filename = filename:match("[^"..dirsep.."]+$");