Changeset

5076:88fb94df9b18

mod_admin_adhoc, mod_announce: Explicitly specify possible actions for ad-hoc commands
author Florian Zeitz <florob@babelmonkeys.de>
date Thu, 02 Aug 2012 21:42:00 +0200
parents 5075:4d939d2b1574
children 5077:6c2c8bf36d22
files plugins/mod_admin_adhoc.lua plugins/mod_announce.lua
diffstat 2 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_adhoc.lua	Thu Aug 02 21:28:14 2012 +0200
+++ b/plugins/mod_admin_adhoc.lua	Thu Aug 02 21:42:00 2012 +0200
@@ -75,7 +75,7 @@
 			return { status = "completed", error = { message = "Invalid data.\nPassword mismatch, or empty username" } };
 		end
 	else
-		return { status = "executing", form = add_user_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = add_user_layout }, "executing";
 	end
 end
 
@@ -107,7 +107,7 @@
 			return { status = "completed", error = { message = "User does not exist" } };
 		end
 	else
-		return { status = "executing", form = change_user_password_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = change_user_password_layout }, "executing";
 	end
 end
 
@@ -155,7 +155,7 @@
 				(#failed ~= 0 and
 				"The following accounts could not be deleted:\n"..t_concat(failed, "\n") or "") };
 	else
-		return { status = "executing", form = delete_user_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = delete_user_layout }, "executing";
 	end
 end
 
@@ -205,7 +205,7 @@
 				(#failed ~= 0 and
 				"The following accounts could not be disconnected:\n"..t_concat(failed, "\n") or "") };
 	else
-		return { status = "executing", form = end_user_session_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = end_user_session_layout }, "executing";
 	end
 end
 
@@ -254,7 +254,7 @@
 		end
 		return { status = "completed", result = { layout = get_user_password_result_layout, values = {accountjid = accountjid, password = password} } };
 	else
-		return { status = "executing", form = get_user_password_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = get_user_password_layout }, "executing";
 	end
 end
 
@@ -312,7 +312,7 @@
 		result:add_child(query);
 		return { status = "completed", other = result };
 	else
-		return { status = "executing", form = get_user_roster_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = get_user_roster_layout }, "executing";
 	end
 end
 
@@ -365,7 +365,7 @@
 		return { status = "completed", result = {layout = get_user_stats_result_layout, values = {ipaddresses = IPs, rostersize = tostring(rostersize),
 			onlineresources = resources}} };
 	else
-		return { status = "executing", form = get_user_stats_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = get_user_stats_layout }, "executing";
 	end
 end
 
@@ -425,7 +425,7 @@
 		end
 		return { status = "completed", result = {layout = get_online_users_result_layout, values = {onlineuserjids=t_concat(users, "\n")}} };
 	else
-		return { status = "executing", form = get_online_users_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = get_online_users_layout }, "executing";
 	end
 end
 
@@ -469,7 +469,7 @@
 			'". Error was: "'..tostring(err or "<unspecified>")..'"' } };
 		end
 	else
-		return { status = "executing", form = layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = layout }, "executing";
 	end
 end
 
@@ -503,7 +503,7 @@
 		return { status = "completed", info = info };
 	else
 		local modules = array.collect(keys(hosts[data.to].modules)):sort();
-		return { status = "executing", form = { layout = layout; values = { modules = modules } } }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = { layout = layout; values = { modules = modules } } }, "executing";
 	end
 end
 
@@ -567,7 +567,7 @@
 
 		return { status = "completed", info = "Server is about to shut down" };
 	else
-		return { status = "executing", form = shut_down_service_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = shut_down_service_layout }, "executing";
 	end
 end
 
@@ -601,7 +601,7 @@
 		return { status = "completed", info = info };
 	else
 		local modules = array.collect(keys(hosts[data.to].modules)):sort();
-		return { status = "executing", form = { layout = layout; values = { modules = modules } } }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = { layout = layout; values = { modules = modules } } }, "executing";
 	end
 end
 
--- a/plugins/mod_announce.lua	Thu Aug 02 21:28:14 2012 +0200
+++ b/plugins/mod_announce.lua	Thu Aug 02 21:42:00 2012 +0200
@@ -88,7 +88,7 @@
 		module:log("info", "Announcement sent to %d online users", count);
 		return { status = "completed", info = ("Announcement sent to %d online users"):format(count) };
 	else
-		return { status = "executing", form = announce_layout }, "executing";
+		return { status = "executing", actions = {"next", "complete", default = "complete"}, form = announce_layout }, "executing";
 	end
 
 	return true;