X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_admin_telnet.lua;h=9185ac1ba41586c19cdc3f077315cc5e96488824;hb=45d601d5ebffdd8f41319bddcbeffb901ca5e967;hp=66560d448bdbaadc252350ce4f166742b592283d;hpb=0b679b4bdfc08b26116956190f4c1fd741610700;p=prosody.git diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 66560d44..9185ac1b 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -27,6 +27,7 @@ local set, array = require "util.set", require "util.array"; local cert_verify_identity = require "util.x509".verify_identity; local envload = require "util.envload".envload; local envloadfile = require "util.envload".envloadfile; +local has_pposix, pposix = pcall(require, "util.pposix"); local commands = module:shared("commands") local def_env = module:shared("env"); @@ -170,6 +171,10 @@ function console_listener.ondisconnect(conn, err) end end +function console_listener.ondetach(conn) + sessions[conn] = nil; +end + -- Console commands -- -- These are simple commands, not valid standalone in Lua @@ -318,7 +323,7 @@ local function human(kb) end function def_env.server:memory() - if not pposix.meminfo then + if not has_pposix or not pposix.meminfo then return true, "Lua is using "..collectgarbage("count"); end local mem, lua_mem = pposix.meminfo(), collectgarbage("count"); @@ -957,7 +962,7 @@ function def_env.muc:room(room_jid) if not room_name then return room_name, host; end - local room_obj = hosts[host].modules.muc.rooms[room_jid]; + local room_obj = hosts[host].modules.muc.get_room_from_jid(room_jid); if not room_obj then return nil, "No such room: "..room_jid; end @@ -970,8 +975,8 @@ function def_env.muc:list(host) return nil, "Please supply the address of a local MUC component"; end local c = 0; - for name in keys(host_session.modules.muc.rooms) do - print(name); + for room in host_session.modules.muc.each_room() do + print(room.jid); c = c + 1; end return true, c.." rooms"; @@ -1073,12 +1078,12 @@ function def_env.dns:lookup(name, typ, class) end function def_env.dns:addnameserver(...) - dns.addnameserver(...) + dns._resolver:addnameserver(...) return true end function def_env.dns:setnameserver(...) - dns.setnameserver(...) + dns._resolver:setnameserver(...) return true end