Diff

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
parent 121:a9898f13c89e
child 123:c04443ea114c
line wrap: on
line diff
--- a/mod_adhoc/adhoc/adhoc.lib.lua	Fri Jan 22 04:25:58 2010 +0100
+++ b/mod_adhoc/adhoc/adhoc.lib.lua	Fri Jan 22 14:45:36 2010 +0100
@@ -39,13 +39,26 @@
 
 	for name, content in pairs(data) do
 		if name == "info" then
-			cmdtag:tag("note", {type="info"}):text(content);
+			cmdtag:tag("note", {type="info"}):text(content):up();
+		elseif name == "warn" then
+			cmdtag:tag("note", {type="warn"}):text(content):up();
 		elseif name == "error" then
-			cmdtag:tag("note", {type="error"}):text(content.message);
+			cmdtag:tag("note", {type="error"}):text(content.message):up();
+		elseif name =="actions" then
+			local actions = st.stanza("actions");
+			for _, action in ipairs(content) do
+				if (action == "prev") or (action == "next") or (action == "complete") then
+					actions:tag(action):up();
+				else
+					module:log("error", 'Command "'..command.name..
+						'" at node "'..command.node..'" provided an invalid action "'..action..'"');
+				end
+			end
+			cmdtag:add_child(actions):up();
 		elseif name == "form" then
-			cmdtag:add_child(data.form:form());
+			cmdtag:add_child(data.form:form()):up();
 		elseif name == "other" then
-			cmdtag:add_child(content);
+			cmdtag:add_child(content):up();
 		end
 	end
 	stanza:add_child(cmdtag);