Software /
code /
prosody
Comparison
plugins/mod_console.lua @ 1908:27c1c6e6c583
Merge with 0.5
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 05 Oct 2009 14:42:56 +0100 |
parent | 1823:7c3ec7ac6316 |
parent | 1907:1dd4443e7d93 |
child | 1914:e7f6baf39b56 |
comparison
equal
deleted
inserted
replaced
1903:b7552b1e267d | 1908:27c1c6e6c583 |
---|---|
181 print [[s2s:close(from, to) - Close a connection from one domain to another]] | 181 print [[s2s:close(from, to) - Close a connection from one domain to another]] |
182 elseif section == "module" then | 182 elseif section == "module" then |
183 print [[module:load(module, host) - Load the specified module on the specified host (or all hosts if none given)]] | 183 print [[module:load(module, host) - Load the specified module on the specified host (or all hosts if none given)]] |
184 print [[module:reload(module, host) - The same, but unloads and loads the module (saving state if the module supports it)]] | 184 print [[module:reload(module, host) - The same, but unloads and loads the module (saving state if the module supports it)]] |
185 print [[module:unload(module, host) - The same, but just unloads the module from memory]] | 185 print [[module:unload(module, host) - The same, but just unloads the module from memory]] |
186 print [[module:list(host) - List the modules loaded on the specified host]] | |
186 elseif section == "server" then | 187 elseif section == "server" then |
187 print [[server:version() - Show the server's version number]] | 188 print [[server:version() - Show the server's version number]] |
188 print [[server:uptime() - Show how long the server has been running]] | 189 print [[server:uptime() - Show how long the server has been running]] |
189 --print [[server:shutdown(reason) - Shut down the server, with an optional reason to be broadcast to all connections]] | 190 --print [[server:shutdown(reason) - Shut down the server, with an optional reason to be broadcast to all connections]] |
190 elseif section == "console" then | 191 elseif section == "console" then |
323 self.session.print("Reloaded on "..host); | 324 self.session.print("Reloaded on "..host); |
324 end | 325 end |
325 end | 326 end |
326 end | 327 end |
327 return ok, (ok and "Module reloaded on "..count.." host"..(count ~= 1 and "s" or "")) or ("Last error: "..tostring(err)); | 328 return ok, (ok and "Module reloaded on "..count.." host"..(count ~= 1 and "s" or "")) or ("Last error: "..tostring(err)); |
329 end | |
330 | |
331 function def_env.module:list(hosts) | |
332 if hosts == nil then | |
333 hosts = array.collect(keys(prosody.hosts)); | |
334 end | |
335 if type(hosts) == "string" then | |
336 hosts = { hosts }; | |
337 end | |
338 if type(hosts) ~= "table" then | |
339 return false, "Please supply a host or a list of hosts you would like to see"; | |
340 end | |
341 | |
342 local print = self.session.print; | |
343 for _, host in ipairs(hosts) do | |
344 print(host..":"); | |
345 local modules = array.collect(keys(prosody.hosts[host].modules or {})):sort(); | |
346 if #modules == 0 then | |
347 print(" No modules loaded"); | |
348 else | |
349 for _, name in ipairs(modules) do | |
350 print(" "..name); | |
351 end | |
352 end | |
353 end | |
328 end | 354 end |
329 | 355 |
330 def_env.config = {}; | 356 def_env.config = {}; |
331 function def_env.config:load(filename, format) | 357 function def_env.config:load(filename, format) |
332 local config_load = require "core.configmanager".load; | 358 local config_load = require "core.configmanager".load; |