aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-12-29 16:25:00 +0000
committerMatthew Wild <mwild1@gmail.com>2022-12-29 16:25:00 +0000
commit45978d6be230d723065644a5a81b626d333d5100 (patch)
treeb44376e193798e0ad6cd72552470fa1d79f2a0bf /core
parent51bf5f2d3414f92b73d54213680c7baac920e04a (diff)
downloadprosody-45978d6be230d723065644a5a81b626d333d5100.tar.gz
prosody-45978d6be230d723065644a5a81b626d333d5100.zip
sessionmanager: Fire event before retiring old session
This allows for modules to update fields, which is generally better than maintaining this hard-coded list of transferable properties here.
Diffstat (limited to 'core')
-rw-r--r--core/sessionmanager.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 138d4e74..14c85425 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -126,14 +126,15 @@ local function update_session(to_session, from_session)
-- Inform xmppstream of the new session (passed to its callbacks)
to_session.stream:set_session(to_session);
- -- Retire the session we've pulled from, to avoid two sessions on the same connection
- retire_session(from_session);
-
+ -- Notify modules, allowing them to copy further fields or update state
prosody.events.fire_event("c2s-session-updated", {
session = to_session;
from_session = from_session;
replaced_conn = replaced_conn;
});
+
+ -- Retire the session we've pulled from, to avoid two sessions on the same connection
+ retire_session(from_session);
end
local function destroy_session(session, err)