Comparison

plugins/mod_storage_xep0227.lua @ 6698:95a8aeca1fc9

mod_storage_xep0227: Close file handle after reading
author Kim Alvefur <zash@zash.se>
date Fri, 15 May 2015 15:17:27 +0200
parent 6697:3d27f5855f4b
child 6699:ccdd0b615106
comparison
equal deleted inserted replaced
6697:3d27f5855f4b 6698:95a8aeca1fc9
15 local jid = user.."@"..host; 15 local jid = user.."@"..host;
16 local path = paths.join(prosody.paths.data, jid..".xml"); 16 local path = paths.join(prosody.paths.data, jid..".xml");
17 local f = io_open(path); 17 local f = io_open(path);
18 if not f then return; end 18 if not f then return; end
19 local s = f:read("*a"); 19 local s = f:read("*a");
20 f:close();
20 return parse_xml_real(s); 21 return parse_xml_real(s);
21 end 22 end
22 local function setXml(user, host, xml) 23 local function setXml(user, host, xml)
23 local jid = user.."@"..host; 24 local jid = user.."@"..host;
24 local path = paths.join(prosody.paths.data, jid..".xml"); 25 local path = paths.join(prosody.paths.data, jid..".xml");