316 end |
316 end |
317 end |
317 end |
318 return ok, (ok and "Module reloaded on "..count.." host"..(count ~= 1 and "s" or "")) or ("Last error: "..tostring(err)); |
318 return ok, (ok and "Module reloaded on "..count.." host"..(count ~= 1 and "s" or "")) or ("Last error: "..tostring(err)); |
319 end |
319 end |
320 |
320 |
|
321 function def_env.module:list(hosts) |
|
322 if hosts == nil then |
|
323 hosts = array.collect(keys(prosody.hosts)); |
|
324 end |
|
325 if type(hosts) == "string" then |
|
326 hosts = { hosts }; |
|
327 end |
|
328 if type(hosts) ~= "table" then |
|
329 return false, "Please supply a host or a list of hosts you would like to see"; |
|
330 end |
|
331 |
|
332 local print = self.session.print; |
|
333 for _, host in ipairs(hosts) do |
|
334 print(host..":"); |
|
335 local modules = array.collect(keys(prosody.hosts[host].modules or {})):sort(); |
|
336 if #modules == 0 then |
|
337 print(" No modules loaded"); |
|
338 else |
|
339 for _, name in ipairs(modules) do |
|
340 print(" "..name); |
|
341 end |
|
342 end |
|
343 end |
|
344 end |
|
345 |
321 def_env.config = {}; |
346 def_env.config = {}; |
322 function def_env.config:load(filename, format) |
347 function def_env.config:load(filename, format) |
323 local config_load = require "core.configmanager".load; |
348 local config_load = require "core.configmanager".load; |
324 local ok, err = config_load(filename, format); |
349 local ok, err = config_load(filename, format); |
325 if not ok then |
350 if not ok then |