mirror of
https://github.com/bjc/prosody.git
synced 2025-04-06 22:57:38 +03:00
mod_c2s: Add event just before closing as session
To allow modules to do things just before the session is closed. The '(pre-)resource-unbind' events are fired after the stream is closed, leaving no way to send something.
This commit is contained in:
parent
bdea7033a7
commit
d02e79c6a9
1 changed files with 3 additions and 0 deletions
|
@ -190,6 +190,9 @@ local function session_close(session, reason)
|
||||||
if session.notopen then
|
if session.notopen then
|
||||||
session:open_stream();
|
session:open_stream();
|
||||||
end
|
end
|
||||||
|
local close_event_payload = { session = session, reason = reason };
|
||||||
|
module:context(session.host):fire_event("pre-session-close", close_event_payload);
|
||||||
|
reason = close_event_payload.reason;
|
||||||
if reason then -- nil == no err, initiated by us, false == initiated by client
|
if reason then -- nil == no err, initiated by us, false == initiated by client
|
||||||
local stream_error = st.stanza("stream:error");
|
local stream_error = st.stanza("stream:error");
|
||||||
if type(reason) == "string" then -- assume stream error
|
if type(reason) == "string" then -- assume stream error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue