comparison mod_adhoc/adhoc/adhoc.lib.lua @ 36:58d326d86a9a

mod_adhoc: add adhoc.lib.lua to ease implementing new commands (as a consequence mod_adhoc is a directory now) mod_adhoc_cmd_*: Convert to use adhoc.lib.lua
author Florian Zeitz <florob@babelmonkeys.de>
date Sun, 11 Oct 2009 01:20:16 +0200
parents
children adc9eff8adb2
comparison
equal deleted inserted replaced
35:3c49411d4aa3 36:58d326d86a9a
1 local st = require "util.stanza";
2
3 local xmlns_cmd = "http://jabber.org/protocol/commands";
4
5 local _M = {};
6
7 function _cmdtag(desc, status, sessionid, action)
8 local cmd = st.stanza("command", { xmlns = xmlns_cmd, node = desc.node, status = status });
9 if sessionid then cmd.attr.sessionid = sessionid; end
10 if action then cmd.attr.action = action; end
11
12 return cmd;
13 end
14
15 function _M.new(name, node, handler)
16 return { name = name, node = node, handler = handler, cmdtag = _cmdtag };
17 end
18
19 return _M;