Software /
code /
prosody-modules
Comparison
mod_adhoc_cmd_modules/mod_adhoc_cmd_modules.lua @ 250:67f03b7786af
mod_adhoc: Fix dataform creation
mod_adhoc_cmd_admin, mod_adhoc_cmd_modules: adapt to work with fixed mod_adhoc
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Wed, 01 Sep 2010 22:42:58 +0200 |
parent | 241:665552d75ee2 |
comparison
equal
deleted
inserted
replaced
249:50c4348c2494 | 250:67f03b7786af |
---|---|
23 { name = "modules", type = "text-multi", label = "The following modules are loaded:" }; | 23 { name = "modules", type = "text-multi", label = "The following modules are loaded:" }; |
24 }; | 24 }; |
25 | 25 |
26 local modules = array.collect(keys(hosts[data.to].modules)):sort():concat("\n"); | 26 local modules = array.collect(keys(hosts[data.to].modules)):sort():concat("\n"); |
27 | 27 |
28 return { status = "completed", result = { layout = result; data = { modules = modules } } }; | 28 return { status = "completed", result = { layout = result; values = { modules = modules } } }; |
29 end | 29 end |
30 | 30 |
31 function load_module_handler(self, data, state) | 31 function load_module_handler(self, data, state) |
32 local layout = dataforms_new { | 32 local layout = dataforms_new { |
33 title = "Load module"; | 33 title = "Load module"; |
88 return { status = "completed", error = { message = 'Failed to reload module "'..fields.module..'" on host "'..data.to.. | 88 return { status = "completed", error = { message = 'Failed to reload module "'..fields.module..'" on host "'..data.to.. |
89 '". Error was: "'..tostring(err)..'"' } }; | 89 '". Error was: "'..tostring(err)..'"' } }; |
90 end | 90 end |
91 else | 91 else |
92 local modules = array.collect(keys(hosts[data.to].modules)):sort(); | 92 local modules = array.collect(keys(hosts[data.to].modules)):sort(); |
93 return { status = "executing", form = { layout = layout; data = { module = modules } } }, "executing"; | 93 return { status = "executing", form = { layout = layout; values = { module = modules } } }, "executing"; |
94 end | 94 end |
95 end | 95 end |
96 | 96 |
97 -- TODO: Allow unloading multiple modules (depends on list-multi) | 97 -- TODO: Allow unloading multiple modules (depends on list-multi) |
98 function unload_modules_handler(self, data, state) | 98 function unload_modules_handler(self, data, state) |
120 return { status = "completed", error = { message = 'Failed to unload module "'..fields.module..'" on host "'..data.to.. | 120 return { status = "completed", error = { message = 'Failed to unload module "'..fields.module..'" on host "'..data.to.. |
121 '". Error was: "'..tostring(err)..'"' } }; | 121 '". Error was: "'..tostring(err)..'"' } }; |
122 end | 122 end |
123 else | 123 else |
124 local modules = array.collect(keys(hosts[data.to].modules)):sort(); | 124 local modules = array.collect(keys(hosts[data.to].modules)):sort(); |
125 return { status = "executing", form = { layout = layout; data = { module = modules } } }, "executing"; | 125 return { status = "executing", form = { layout = layout; values = { module = modules } } }, "executing"; |
126 end | 126 end |
127 end | 127 end |
128 | 128 |
129 local list_modules_desc = adhoc_new("List loaded modules", "http://prosody.im/protocol/modules#list", list_modules_handler, "admin"); | 129 local list_modules_desc = adhoc_new("List loaded modules", "http://prosody.im/protocol/modules#list", list_modules_handler, "admin"); |
130 local load_module_desc = adhoc_new("Load module", "http://prosody.im/protocol/modules#load", load_module_handler, "admin"); | 130 local load_module_desc = adhoc_new("Load module", "http://prosody.im/protocol/modules#load", load_module_handler, "admin"); |