Software /
code /
prosody
Diff
plugins/mod_admin_telnet.lua @ 10845:785fa0112411
mod_admin_telnet: Update existing sessions on reload
This removes the need to disconnect and reconnect to the telnet console
for changes to take effect.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 16 May 2020 20:46:12 +0200 |
parent | 10798:b81f4fd7f21a |
child | 10857:826023c3322b |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Fri May 15 21:26:54 2020 +0200 +++ b/plugins/mod_admin_telnet.lua Sat May 16 20:46:12 2020 +0200 @@ -161,6 +161,20 @@ local sessions = {}; +function module.save() + return { sessions = sessions } +end + +function module.restore(data) + if data.sessions then + for conn in pairs(data.sessions) do + conn:setlistener(console_listener); + local session = console:new_session(conn); + sessions[conn] = session; + end + end +end + function console_listener.onconnect(conn) -- Handle new connection local session = console:new_session(conn);