Software /
code /
prosody
Comparison
plugins/adhoc/adhoc.lib.lua @ 8471:a6f58305411e
Backed out changeset 84c117cdd048, broke things
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Dec 2017 17:49:30 +0100 |
parent | 8459:84c117cdd048 |
child | 8472:d88dc6827675 |
comparison
equal
deleted
inserted
replaced
8470:81f894d08b17 | 8471:a6f58305411e |
---|---|
23 function _M.new(name, node, handler, permission) | 23 function _M.new(name, node, handler, permission) |
24 return { name = name, node = node, handler = handler, cmdtag = _cmdtag, permission = (permission or "user") }; | 24 return { name = name, node = node, handler = handler, cmdtag = _cmdtag, permission = (permission or "user") }; |
25 end | 25 end |
26 | 26 |
27 function _M.handle_cmd(command, origin, stanza) | 27 function _M.handle_cmd(command, origin, stanza) |
28 local command = stanza.tags[1]; | 28 local cmdtag = stanza.tags[1] |
29 local sessionid = command.attr.sessionid or uuid.generate(); | 29 local sessionid = cmdtag.attr.sessionid or uuid.generate(); |
30 local dataIn = { | 30 local dataIn = { |
31 to = stanza.attr.to; | 31 to = stanza.attr.to; |
32 from = stanza.attr.from; | 32 from = stanza.attr.from; |
33 action = command.attr.action or "execute"; | 33 action = cmdtag.attr.action or "execute"; |
34 form = command:get_child("x", "jabber:x:data"); | 34 form = cmdtag:get_child("x", "jabber:x:data"); |
35 }; | 35 }; |
36 | 36 |
37 local data, state = command:handler(dataIn, states[sessionid]); | 37 local data, state = command:handler(dataIn, states[sessionid]); |
38 states[sessionid] = state; | 38 states[sessionid] = state; |
39 local cmdtag; | 39 local cmdtag; |