annotate mod_adhoc_cmd_modules/mod_adhoc_cmd_modules.lua @ 233:4ff8068b4d94

mod_archive: fixed some serious bugs.
author shinysky<shinysky1986(AT)gmail.com>
date Wed, 04 Aug 2010 12:36:27 +0800
parents 214cb85cdfbf
children 10a3cca32797
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
203
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
1 -- Copyright (C) 2009-2010 Florian Zeitz
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
2 --
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
3 -- This file is MIT/X11 licensed. Please see the
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
4 -- COPYING file in the source package for more information.
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
5 --
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
6
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
7 local _G = _G;
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
8
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
9 local prosody = _G.prosody;
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
10 local hosts = prosody.hosts;
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
11
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
12 require "util.iterators";
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
13 local dataforms_new = require "util.dataforms".new;
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
14 local array = require "util.array";
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
15 local modulemanager = require "modulemanager";
203
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
16 local adhoc_new = module:require "adhoc".new;
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
17
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
18 function list_modules_handler(self, data, state)
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
19 local result = dataforms_new {
203
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
20 title = "List of loaded modules";
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
21
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
22 { name = "FORM_TYPE", type = "hidden", value = "http://prosody.im/protocol/modules#list" };
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
23 { name = "modules", type = "text-multi", label = "The following modules are loaded:" };
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
24 };
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
25
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
26 local modules = array.collect(keys(hosts[data.to].modules)):sort():concat("\n");
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
27
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
28 return { status = "completed", result = { layout = result; data = { modules = modules } } };
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
29 end
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
30
208
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
31 function load_module_handler(self, data, state)
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
32 local layout = dataforms_new {
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
33 title = "Load module";
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
34 instructions = "Specify the module to be loaded";
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
35
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
36 { name = "FORM_TYPE", type = "hidden", value = "http://prosody.im/protocol/modules#load" };
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
37 { name = "module", type = "text-single", label = "Module to be loaded:"};
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
38 };
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
39 if state then
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
40 if data.action == "cancel" then
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
41 return { status = "canceled" };
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
42 end
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
43 local fields = layout:data(data.form);
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
44 if modulemanager.is_loaded(data.to, fields.module) then
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
45 return { status = "completed", info = "Module already loaded" };
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
46 end
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
47 local ok, err = modulemanager.load(data.to, fields.module);
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
48 if ok then
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
49 return { status = "completed", info = 'Module "'..fields.module..'" successfully loaded on host "'..data.to..'".' };
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
50 else
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
51 return { status = "completed", error = { message = 'Failed to load module "'..fields.module..'" on host "'..data.to..
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
52 '". Error was: "'..tostring(err or "<unspecified>")..'"' } };
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
53 end
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
54 else
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
55 local modules = array.collect(keys(hosts[data.to].modules)):sort();
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
56 return { status = "executing", form = layout }, "executing";
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
57 end
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
58 end
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
59
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
60 -- TODO: Allow reloading multiple modules (depends on list-multi)
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
61 function reload_modules_handler(self, data, state)
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
62 local layout = dataforms_new {
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
63 title = "Reload module";
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
64 instructions = "Select the module to be reloaded";
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
65
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
66 { name = "FORM_TYPE", type = "hidden", value = "http://prosody.im/protocol/modules#reload" };
207
1ae653712e37 mod_adhoc: Add capability to pass data to forms
Florian Zeitz <florob@babelmonkeys.de>
parents: 206
diff changeset
67 { name = "module", type = "list-single", label = "Module to be reloaded:"};
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
68 };
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
69 if state then
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
70 if data.action == "cancel" then
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
71 return { status = "canceled" };
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
72 end
208
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
73 local fields = layout:data(data.form);
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
74 local ok, err = modulemanager.reload(data.to, fields.module);
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
75 if ok then
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
76 return { status = "completed", info = 'Module "'..fields.module..'" successfully reloaded on host "'..data.to..'".' };
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
77 else
208
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
78 return { status = "completed", error = { message = 'Failed to reload module "'..fields.module..'" on host "'..data.to..
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
79 '". Error was: "'..tostring(err)..'"' } };
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
80 end
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
81 else
207
1ae653712e37 mod_adhoc: Add capability to pass data to forms
Florian Zeitz <florob@babelmonkeys.de>
parents: 206
diff changeset
82 local modules = array.collect(keys(hosts[data.to].modules)):sort();
1ae653712e37 mod_adhoc: Add capability to pass data to forms
Florian Zeitz <florob@babelmonkeys.de>
parents: 206
diff changeset
83 return { status = "executing", form = { layout = layout; data = { module = modules } } }, "executing";
203
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
84 end
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
85 end
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
86
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
87 -- TODO: Allow unloading multiple modules (depends on list-multi)
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
88 function unload_modules_handler(self, data, state)
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
89 local layout = dataforms_new {
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
90 title = "Unload module";
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
91 instructions = "Select the module to be unloaded";
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
92
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
93 { name = "FORM_TYPE", type = "hidden", value = "http://prosody.im/protocol/modules#unload" };
207
1ae653712e37 mod_adhoc: Add capability to pass data to forms
Florian Zeitz <florob@babelmonkeys.de>
parents: 206
diff changeset
94 { name = "module", type = "list-single", label = "Module to be unloaded:"};
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
95 };
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
96 if state then
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
97 if data.action == "cancel" then
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
98 return { status = "canceled" };
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
99 end
208
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
100 local fields = layout:data(data.form);
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
101 local ok, err = modulemanager.unload(data.to, fields.module);
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
102 if ok then
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
103 return { status = "completed", info = 'Module "'..fields.module..'" successfully unloaded on host "'..data.to..'".' };
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
104 else
208
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
105 return { status = "completed", error = { message = 'Failed to unload module "'..fields.module..'" on host "'..data.to..
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
106 '". Error was: "'..tostring(err)..'"' } };
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
107 end
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
108 else
207
1ae653712e37 mod_adhoc: Add capability to pass data to forms
Florian Zeitz <florob@babelmonkeys.de>
parents: 206
diff changeset
109 local modules = array.collect(keys(hosts[data.to].modules)):sort();
1ae653712e37 mod_adhoc: Add capability to pass data to forms
Florian Zeitz <florob@babelmonkeys.de>
parents: 206
diff changeset
110 return { status = "executing", form = { layout = layout; data = { module = modules } } }, "executing";
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
111 end
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
112 end
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
113
203
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
114 local list_modules_desc = adhoc_new("List loaded modules", "http://prosody.im/protocol/modules#list", list_modules_handler, "admin");
208
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
115 local load_module_desc = adhoc_new("Load module", "http://prosody.im/protocol/modules#load", load_module_handler, "admin");
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
116 local reload_modules_desc = adhoc_new("Reload module", "http://prosody.im/protocol/modules#reload", reload_modules_handler, "admin");
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
117 local unload_modules_desc = adhoc_new("Unload module", "http://prosody.im/protocol/modules#unload", unload_modules_handler, "admin");
203
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
118
4927b9737bb7 mod_adhoc_cmd_modules: Initial version. Provides a "List loaded modules" cmd for now
Florian Zeitz <florob@babelmonkeys.de>
parents:
diff changeset
119 module:add_item("adhoc", list_modules_desc);
208
214cb85cdfbf mod_adhoc_cmd_modules: Add "Load module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 207
diff changeset
120 module:add_item("adhoc", load_module_desc);
205
a6361a1fda5e mod_adhoc_cmd_modules: Add "Reload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 203
diff changeset
121 module:add_item("adhoc", reload_modules_desc);
206
d3498f115fcd mod_adhoc_cmd_modules: Add "Unload module" command
Florian Zeitz <florob@babelmonkeys.de>
parents: 205
diff changeset
122 module:add_item("adhoc", unload_modules_desc);