Software /
code /
prosody
Comparison
plugins/mod_storage_xep0227.lua @ 6700:0103dc8fa179
mod_storage_xep0227: Return error from io.open if unable to open file for writing
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 15 May 2015 15:25:59 +0200 |
parent | 6699:ccdd0b615106 |
child | 6701:88a25c364a14 |
comparison
equal
deleted
inserted
replaced
6699:ccdd0b615106 | 6700:0103dc8fa179 |
---|---|
21 return parse_xml_real(s); | 21 return parse_xml_real(s); |
22 end | 22 end |
23 local function setXml(user, host, xml) | 23 local function setXml(user, host, xml) |
24 local jid = user.."@"..host; | 24 local jid = user.."@"..host; |
25 local path = paths.join(prosody.paths.data, jid..".xml"); | 25 local path = paths.join(prosody.paths.data, jid..".xml"); |
26 local f = io_open(path, "w"); | 26 local f, err = io_open(path, "w"); |
27 if not f then return; end | 27 if not f then return f, err; end |
28 if xml then | 28 if xml then |
29 local s = tostring(xml); | 29 local s = tostring(xml); |
30 f:write(s); | 30 f:write(s); |
31 f:close(); | 31 f:close(); |
32 return true; | 32 return true; |