diff options
author | Kim Alvefur <zash@zash.se> | 2020-05-16 20:46:12 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-05-16 20:46:12 +0200 |
commit | 9c0f2a5d5a4a52c8e9cd7c84654243f87a9451ad (patch) | |
tree | 019ff34d10a19d52645bfe4497a1075500b10de2 /plugins/mod_admin_telnet.lua | |
parent | bc0850b210819e1adae5872a4ce7717b24fa6353 (diff) | |
download | prosody-9c0f2a5d5a4a52c8e9cd7c84654243f87a9451ad.tar.gz prosody-9c0f2a5d5a4a52c8e9cd7c84654243f87a9451ad.zip |
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.
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r-- | plugins/mod_admin_telnet.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 3014517c..a082a851 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -161,6 +161,20 @@ end 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); |