Software /
code /
prosody
Diff
core/sessionmanager.lua @ 331:830fd67f9378
Quite some changes, to:
- Small logging fix for s2smanager
- Send a stream error if an incoming s2s connection is to an unrecognised hostname (fixes #11)
- init_xmlhandlers now takes a table of callbacks (includes changes to net/xmpp*_listener for this)
- Move sending of unavailable presence to where it should be, sessionmanager.destroy_session
- Fix sending of stream errors to wrong connection
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 18 Nov 2008 17:52:33 +0000 |
parent | 329:3be63719428e |
child | 332:51e130b5c8de |
line wrap: on
line diff
--- a/core/sessionmanager.lua Tue Nov 18 14:42:45 2008 +0000 +++ b/core/sessionmanager.lua Tue Nov 18 17:52:33 2008 +0000 @@ -35,6 +35,16 @@ function destroy_session(session) (session.log or log)("info", "Destroying session"); + + -- Send unavailable presence + if session.presence and session.presence.attr.type ~= "unavailable" then + local pres = st.presence{ type = "unavailable" }; + if err == "closed" then err = "connection closed"; end + pres:tag("status"):text("Disconnected: "..err); + session.stanza_dispatch(pres); + end + + -- Remove session/resource from user's session list if session.host and session.username then if session.resource then hosts[session.host].sessions[session.username].sessions[session.resource] = nil; @@ -46,8 +56,7 @@ end end end - session.conn = nil; - session.disconnect = nil; + for k in pairs(session) do if k ~= "trace" then session[k] = nil;