Software /
code /
prosody
Comparison
plugins/mod_admin_telnet.lua @ 4540:ddce5b1bdfca
mod_admin_telnet: Use module:shared() to expose commands table and default console environment
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 22 Jan 2012 19:50:08 +0000 |
parent | 4328:c71777a8b9c7 |
child | 4550:1c41e4a846a2 |
comparison
equal
deleted
inserted
replaced
4539:3cbfa768eb06 | 4540:ddce5b1bdfca |
---|---|
19 require "util.iterators"; | 19 require "util.iterators"; |
20 local jid_bare = require "util.jid".bare; | 20 local jid_bare = require "util.jid".bare; |
21 local set, array = require "util.set", require "util.array"; | 21 local set, array = require "util.set", require "util.array"; |
22 local cert_verify_identity = require "util.x509".verify_identity; | 22 local cert_verify_identity = require "util.x509".verify_identity; |
23 | 23 |
24 local commands = {}; | 24 local commands = module:shared("commands") |
25 local def_env = {}; | 25 local def_env = module:shared("env"); |
26 local default_env_mt = { __index = def_env }; | 26 local default_env_mt = { __index = def_env }; |
27 | |
28 prosody.console = { commands = commands, env = def_env }; | |
29 | 27 |
30 local function redirect_output(_G, session) | 28 local function redirect_output(_G, session) |
31 local env = setmetatable({ print = session.print }, { __index = function (t, k) return rawget(_G, k); end }); | 29 local env = setmetatable({ print = session.print }, { __index = function (t, k) return rawget(_G, k); end }); |
32 env.dofile = function(name) | 30 env.dofile = function(name) |
33 local f, err = loadfile(name); | 31 local f, err = loadfile(name); |