Comparison

plugins/adhoc/adhoc.lib.lua @ 7951:2b91da49285a

mod_adhoc/adhoc.lib: instantiate table with all fields
author Kim Alvefur <zash@zash.se>
date Mon, 06 Mar 2017 15:09:22 +0100
parent 6302:76699a0ae4c4
child 8459:84c117cdd048
comparison
equal deleted inserted replaced
7949:8acc35b5355a 7951:2b91da49285a
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 cmdtag = stanza.tags[1]
29 local sessionid = cmdtag.attr.sessionid or uuid.generate(); 29 local sessionid = cmdtag.attr.sessionid or uuid.generate();
30 local dataIn = {}; 30 local dataIn = {
31 dataIn.to = stanza.attr.to; 31 to = stanza.attr.to;
32 dataIn.from = stanza.attr.from; 32 from = stanza.attr.from;
33 dataIn.action = cmdtag.attr.action or "execute"; 33 action = cmdtag.attr.action or "execute";
34 dataIn.form = cmdtag:get_child("x", "jabber:x:data"); 34 form = cmdtag:get_child("x", "jabber:x:data");
35 };
35 36
36 local data, state = command:handler(dataIn, states[sessionid]); 37 local data, state = command:handler(dataIn, states[sessionid]);
37 states[sessionid] = state; 38 states[sessionid] = state;
38 local cmdtag; 39 local cmdtag;
39 if data.status == "completed" then 40 if data.status == "completed" then