Software /
code /
prosody
Comparison
plugins/adhoc/adhoc.lib.lua @ 4975:6f689c155186
adhoc.lib: Make some globals local
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 18 Jul 2012 21:18:17 +0200 |
parent | 4860:b66e73793cb7 |
child | 4993:5243b74a4cbb |
comparison
equal
deleted
inserted
replaced
4974:1574f18b0ca4 | 4975:6f689c155186 |
---|---|
10 | 10 |
11 local states = {} | 11 local states = {} |
12 | 12 |
13 local _M = {}; | 13 local _M = {}; |
14 | 14 |
15 function _cmdtag(desc, status, sessionid, action) | 15 local function _cmdtag(desc, status, sessionid, action) |
16 local cmd = st.stanza("command", { xmlns = xmlns_cmd, node = desc.node, status = status }); | 16 local cmd = st.stanza("command", { xmlns = xmlns_cmd, node = desc.node, status = status }); |
17 if sessionid then cmd.attr.sessionid = sessionid; end | 17 if sessionid then cmd.attr.sessionid = sessionid; end |
18 if action then cmd.attr.action = action; end | 18 if action then cmd.attr.action = action; end |
19 | 19 |
20 return cmd; | 20 return cmd; |
33 dataIn.form = stanza.tags[1]:child_with_ns("jabber:x:data"); | 33 dataIn.form = stanza.tags[1]:child_with_ns("jabber:x:data"); |
34 | 34 |
35 local data, state = command:handler(dataIn, states[sessionid]); | 35 local data, state = command:handler(dataIn, states[sessionid]); |
36 states[sessionid] = state; | 36 states[sessionid] = state; |
37 local stanza = st.reply(stanza); | 37 local stanza = st.reply(stanza); |
38 local cmdtag; | |
38 if data.status == "completed" then | 39 if data.status == "completed" then |
39 states[sessionid] = nil; | 40 states[sessionid] = nil; |
40 cmdtag = command:cmdtag("completed", sessionid); | 41 cmdtag = command:cmdtag("completed", sessionid); |
41 elseif data.status == "canceled" then | 42 elseif data.status == "canceled" then |
42 states[sessionid] = nil; | 43 states[sessionid] = nil; |