comparison mod_adhoc/adhoc/adhoc.lib.lua @ 122:c3a874eec712

mod_adhoc: Add more features described in XEP-0050
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 22 Jan 2010 14:45:36 +0100
parents a9898f13c89e
children c04443ea114c
comparison
equal deleted inserted replaced
121:a9898f13c89e 122:c3a874eec712
37 cmdtag = command:cmdtag("executing", sessid); 37 cmdtag = command:cmdtag("executing", sessid);
38 end 38 end
39 39
40 for name, content in pairs(data) do 40 for name, content in pairs(data) do
41 if name == "info" then 41 if name == "info" then
42 cmdtag:tag("note", {type="info"}):text(content); 42 cmdtag:tag("note", {type="info"}):text(content):up();
43 elseif name == "warn" then
44 cmdtag:tag("note", {type="warn"}):text(content):up();
43 elseif name == "error" then 45 elseif name == "error" then
44 cmdtag:tag("note", {type="error"}):text(content.message); 46 cmdtag:tag("note", {type="error"}):text(content.message):up();
47 elseif name =="actions" then
48 local actions = st.stanza("actions");
49 for _, action in ipairs(content) do
50 if (action == "prev") or (action == "next") or (action == "complete") then
51 actions:tag(action):up();
52 else
53 module:log("error", 'Command "'..command.name..
54 '" at node "'..command.node..'" provided an invalid action "'..action..'"');
55 end
56 end
57 cmdtag:add_child(actions):up();
45 elseif name == "form" then 58 elseif name == "form" then
46 cmdtag:add_child(data.form:form()); 59 cmdtag:add_child(data.form:form()):up();
47 elseif name == "other" then 60 elseif name == "other" then
48 cmdtag:add_child(content); 61 cmdtag:add_child(content):up();
49 end 62 end
50 end 63 end
51 stanza:add_child(cmdtag); 64 stanza:add_child(cmdtag);
52 origin.send(stanza); 65 origin.send(stanza);
53 66