diff options
Diffstat (limited to 'plugins/adhoc/adhoc.lib.lua')
-rw-r--r-- | plugins/adhoc/adhoc.lib.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/adhoc/adhoc.lib.lua b/plugins/adhoc/adhoc.lib.lua index b544ddc8..87415636 100644 --- a/plugins/adhoc/adhoc.lib.lua +++ b/plugins/adhoc/adhoc.lib.lua @@ -25,12 +25,14 @@ function _M.new(name, node, handler, permission) end function _M.handle_cmd(command, origin, stanza) - local sessionid = stanza.tags[1].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"); + local cmdtag = stanza.tags[1] + local sessionid = cmdtag.attr.sessionid or uuid.generate(); + local dataIn = { + to = stanza.attr.to; + from = stanza.attr.from; + action = cmdtag.attr.action or "execute"; + form = cmdtag:get_child("x", "jabber:x:data"); + }; local data, state = command:handler(dataIn, states[sessionid]); states[sessionid] = state; |