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 | 29f51d7e6dd71d1a702410cf24ea59edd7e5afcd (patch) | |
tree | 019ff34d10a19d52645bfe4497a1075500b10de2 /plugins/mod_admin_telnet.lua | |
parent | e32f71d3d4ee4a69f57bf6891f8a255fa884f4ba (diff) | |
download | prosody-29f51d7e6dd71d1a702410cf24ea59edd7e5afcd.tar.gz prosody-29f51d7e6dd71d1a702410cf24ea59edd7e5afcd.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); |