Software /
code /
prosody
Changeset
12821:a4ac16e5b655
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 29 Dec 2022 16:25:00 +0000 |
parents | 12820:b95771171439 |
children | 12822:6b43bf85032b |
files | core/sessionmanager.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/core/sessionmanager.lua Thu Dec 29 16:23:08 2022 +0000 +++ b/core/sessionmanager.lua Thu Dec 29 16:25:00 2022 +0000 @@ -126,14 +126,15 @@ -- 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)