Mercurial > prosody-modules
changeset 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 |
files | mod_compat_muc_admin/mod_compat_muc_admin.lua |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_compat_muc_admin/mod_compat_muc_admin.lua Tue Mar 27 16:51:59 2012 +0000 +++ b/mod_compat_muc_admin/mod_compat_muc_admin.lua Tue Mar 27 16:57:00 2012 +0000 @@ -36,6 +36,15 @@ return st.presence({type='unavailable', from=stanza.attr.from, to=stanza.attr.to}) :tag('status'):text(error_message); end +local function getUsingPath(stanza, path, getText) + local tag = stanza; + for _, name in ipairs(path) do + if type(tag) ~= 'table' then return; end + tag = tag:child_with_name(name); + end + if tag and getText then tag = table.concat(tag); end + return tag; +end local function getText(stanza, path) return getUsingPath(stanza, path, true); end -- COMPAT: iq condensed function