Software /
code /
prosody
Comparison
plugins/mod_storage_xep0227.lua @ 6699:ccdd0b615106
mod_storage_xep0227: Open file for writing even if removing so os.remove has a file to delete
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 15 May 2015 15:25:37 +0200 |
parent | 6698:95a8aeca1fc9 |
child | 6700:0103dc8fa179 |
comparison
equal
deleted
inserted
replaced
6698:95a8aeca1fc9 | 6699:ccdd0b615106 |
---|---|
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"); | |
27 if not f then return; end | |
26 if xml then | 28 if xml then |
27 local f = io_open(path, "w"); | |
28 if not f then return; end | |
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; |
33 else | 33 else |
34 f:close(); | |
34 return os_remove(path); | 35 return os_remove(path); |
35 end | 36 end |
36 end | 37 end |
37 local function getUserElement(xml) | 38 local function getUserElement(xml) |
38 if xml and xml.name == "server-data" then | 39 if xml and xml.name == "server-data" then |