comparison mod_adhoc/adhoc/mod_adhoc.lua @ 207:1ae653712e37

mod_adhoc: Add capability to pass data to forms mod_adhoc_cmd_modules: Update to use afforementioned functionality
author Florian Zeitz <florob@babelmonkeys.de>
date Sat, 10 Jul 2010 01:26:41 +0200
parents 0d438a7ac4fc
children e0802b2716c3
comparison
equal deleted inserted replaced
206:d3498f115fcd 207:1ae653712e37
14 14
15 module:add_feature(xmlns_cmd); 15 module:add_feature(xmlns_cmd);
16 16
17 module:hook("iq/host/"..xmlns_disco.."#items:query", function (event) 17 module:hook("iq/host/"..xmlns_disco.."#items:query", function (event)
18 local origin, stanza = event.origin, event.stanza; 18 local origin, stanza = event.origin, event.stanza;
19 -- TODO: Is this correct, or should is_admin be changed? 19 -- Required for Prosody <= 0.7
20 local privileged = is_admin(stanza.attr.from) 20 local privileged = is_admin(stanza.attr.from)
21 or is_admin(stanza.attr.from, stanza.attr.to); 21 or is_admin(stanza.attr.from, stanza.attr.to);
22 if stanza.attr.type == "get" and stanza.tags[1].attr.node 22 if stanza.attr.type == "get" and stanza.tags[1].attr.node
23 and stanza.tags[1].attr.node == xmlns_cmd then 23 and stanza.tags[1].attr.node == xmlns_cmd then
24 reply = st.reply(stanza); 24 reply = st.reply(stanza);
40 module:hook("iq/host", function (event) 40 module:hook("iq/host", function (event)
41 local origin, stanza = event.origin, event.stanza; 41 local origin, stanza = event.origin, event.stanza;
42 if stanza.attr.type == "set" and stanza.tags[1] 42 if stanza.attr.type == "set" and stanza.tags[1]
43 and stanza.tags[1].name == "command" then 43 and stanza.tags[1].name == "command" then
44 local node = stanza.tags[1].attr.node 44 local node = stanza.tags[1].attr.node
45 -- TODO: Is this correct, or should is_admin be changed? 45 -- Required for Prosody <= 0.7
46 local privileged = is_admin(event.stanza.attr.from) 46 local privileged = is_admin(event.stanza.attr.from)
47 or is_admin(stanza.attr.from, stanza.attr.to); 47 or is_admin(stanza.attr.from, stanza.attr.to);
48 if commands[node] then 48 if commands[node] then
49 if commands[node].permission == "admin" 49 if commands[node].permission == "admin"
50 and not privileged then 50 and not privileged then