Software /
code /
prosody
Comparison
plugins/adhoc/adhoc.lib.lua @ 8459:84c117cdd048
mod_adhoc/adhoc.lib: Rename variable to avoid name clash [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 05 Dec 2017 12:32:25 +0100 |
parent | 7951:2b91da49285a |
child | 8471:a6f58305411e |
comparison
equal
deleted
inserted
replaced
8458:e9c7ac97cb52 | 8459:84c117cdd048 |
---|---|
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 cmdtag = stanza.tags[1] | 28 local command = stanza.tags[1]; |
29 local sessionid = cmdtag.attr.sessionid or uuid.generate(); | 29 local sessionid = command.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 = cmdtag.attr.action or "execute"; | 33 action = command.attr.action or "execute"; |
34 form = cmdtag:get_child("x", "jabber:x:data"); | 34 form = command: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; |