Software /
code /
prosody
Diff
plugins/adhoc/adhoc.lib.lua @ 6302:76699a0ae4c4
mod_lastactivity, mod_legacyauth, mod_presence, mod_saslauth, mod_tls: Use the newer stanza:get_child APIs and optimize away some table lookups
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 04 Jul 2014 22:52:34 +0200 |
parent | 5758:ebc074918173 |
child | 7951:2b91da49285a |
line wrap: on
line diff
--- a/plugins/adhoc/adhoc.lib.lua Fri Jul 04 21:48:25 2014 +0200 +++ b/plugins/adhoc/adhoc.lib.lua Fri Jul 04 22:52:34 2014 +0200 @@ -25,12 +25,13 @@ end function _M.handle_cmd(command, origin, stanza) - local sessionid = stanza.tags[1].attr.sessionid or uuid.generate(); + local cmdtag = stanza.tags[1] + local sessionid = cmdtag.attr.sessionid or uuid.generate(); local dataIn = {}; dataIn.to = stanza.attr.to; dataIn.from = stanza.attr.from; - dataIn.action = stanza.tags[1].attr.action or "execute"; - dataIn.form = stanza.tags[1]:child_with_ns("jabber:x:data"); + dataIn.action = cmdtag.attr.action or "execute"; + dataIn.form = cmdtag:get_child("x", "jabber:x:data"); local data, state = command:handler(dataIn, states[sessionid]); states[sessionid] = state;