comparison mod_compat_muc_admin/mod_compat_muc_admin.lua @ 630:ab2a1564da9b

mod_compat_muc_admin: adding last missing local (getUsingPath).
author Marco Cirillo <maranda@lightwitch.org>
date Tue, 27 Mar 2012 16:57:00 +0000
parents 7d4cde86b12e
children c9084b4c14f0
comparison
equal deleted inserted replaced
629:7d4cde86b12e 630:ab2a1564da9b
33 if text then 33 if text then
34 error_message = error_message..": "..text; 34 error_message = error_message..": "..text;
35 end 35 end
36 return st.presence({type='unavailable', from=stanza.attr.from, to=stanza.attr.to}) 36 return st.presence({type='unavailable', from=stanza.attr.from, to=stanza.attr.to})
37 :tag('status'):text(error_message); 37 :tag('status'):text(error_message);
38 end
39 local function getUsingPath(stanza, path, getText)
40 local tag = stanza;
41 for _, name in ipairs(path) do
42 if type(tag) ~= 'table' then return; end
43 tag = tag:child_with_name(name);
44 end
45 if tag and getText then tag = table.concat(tag); end
46 return tag;
38 end 47 end
39 local function getText(stanza, path) return getUsingPath(stanza, path, true); end 48 local function getText(stanza, path) return getUsingPath(stanza, path, true); end
40 49
41 -- COMPAT: iq condensed function 50 -- COMPAT: iq condensed function
42 hosts[muc_host].modules.muc.stanza_handler.muc_new_room.room_mt["compat_iq"] = function (self, origin, stanza, xmlns) 51 hosts[muc_host].modules.muc.stanza_handler.muc_new_room.room_mt["compat_iq"] = function (self, origin, stanza, xmlns)