diff options
author | Florian Zeitz <florob@babelmonkeys.de> | 2012-04-13 00:39:00 +0200 |
---|---|---|
committer | Florian Zeitz <florob@babelmonkeys.de> | 2012-04-13 00:39:00 +0200 |
commit | cc13a475a6010a301fb92f14e3120d41dfc45214 (patch) | |
tree | b1d4285c83eebde41ac827ac66be054c6a1d5b73 /plugins/adhoc | |
parent | 06f2b0f3a44b915c20105405ddf3e550bdf25233 (diff) | |
download | prosody-cc13a475a6010a301fb92f14e3120d41dfc45214.tar.gz prosody-cc13a475a6010a301fb92f14e3120d41dfc45214.zip |
mod_adhoc: Always allow at least the "complete" action
Diffstat (limited to 'plugins/adhoc')
-rw-r--r-- | plugins/adhoc/adhoc.lib.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/adhoc/adhoc.lib.lua b/plugins/adhoc/adhoc.lib.lua index 0cb4efe1..57059b3f 100644 --- a/plugins/adhoc/adhoc.lib.lua +++ b/plugins/adhoc/adhoc.lib.lua @@ -25,6 +25,7 @@ function _M.new(name, node, handler, permission) end function _M.handle_cmd(command, origin, stanza) + local cmdtag, actions; local sessionid = stanza.tags[1].attr.sessionid or uuid.generate(); local dataIn = {}; dataIn.to = stanza.attr.to; @@ -58,7 +59,7 @@ function _M.handle_cmd(command, origin, stanza) elseif name == "error" then cmdtag:tag("note", {type="error"}):text(content.message):up(); elseif name =="actions" then - local actions = st.stanza("actions"); + actions = st.stanza("actions"); for _, action in ipairs(content) do if (action == "prev") or (action == "next") or (action == "complete") then actions:tag(action):up(); @@ -67,7 +68,6 @@ function _M.handle_cmd(command, origin, stanza) '" at node "'..command.node..'" provided an invalid action "'..action..'"'); end end - cmdtag:add_child(actions); elseif name == "form" then cmdtag:add_child((content.layout or content):form(content.values)); elseif name == "result" then @@ -76,6 +76,13 @@ function _M.handle_cmd(command, origin, stanza) cmdtag:add_child(content); end end + + if not actions then + actions = st.stanza("actions"); + actions:tag("complete"):up(); + end + cmdtag:add_child(actions); + stanza:add_child(cmdtag); origin.send(stanza); |