diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-04-05 13:26:43 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-04-05 13:26:43 +0100 |
commit | 8c9d841c3d81694d063bd931dbfee0634f53e8f7 (patch) | |
tree | 35cdd4996c2ba4c67a4805bd01e3830d1dc171f5 /core | |
parent | 54a5982b5d000a98726601dada57050ac5cb21b4 (diff) | |
parent | ca74173a8221e9cd93db30c7bb89c8b181f8b60b (diff) | |
download | prosody-8c9d841c3d81694d063bd931dbfee0634f53e8f7.tar.gz prosody-8c9d841c3d81694d063bd931dbfee0634f53e8f7.zip |
Merge 0.8->trunk
Diffstat (limited to 'core')
-rw-r--r-- | core/sessionmanager.lua | 15 | ||||
-rw-r--r-- | core/usermanager.lua | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index d36591bf..426763f5 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -108,16 +108,23 @@ function destroy_session(session, err) -- Remove session/resource from user's session list if session.full_jid then - hosts[session.host].sessions[session.username].sessions[session.resource] = nil; + local host_session = hosts[session.host]; + + -- Allow plugins to prevent session destruction + if host_session.events.fire_event("pre-resource-unbind", {session=session, error=err}) then + return; + end + + host_session.sessions[session.username].sessions[session.resource] = nil; full_sessions[session.full_jid] = nil; - if not next(hosts[session.host].sessions[session.username].sessions) then + if not next(host_session.sessions[session.username].sessions) then log("debug", "All resources of %s are now offline", session.username); - hosts[session.host].sessions[session.username] = nil; + host_session.sessions[session.username] = nil; bare_sessions[session.username..'@'..session.host] = nil; end - hosts[session.host].events.fire_event("resource-unbind", {session=session, error=err}); + host_session.events.fire_event("resource-unbind", {session=session, error=err}); end retire_session(session); diff --git a/core/usermanager.lua b/core/usermanager.lua index 5e2e41fc..0152afd7 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -96,6 +96,8 @@ function get_provider(host) end function is_admin(jid, host) + if host and not hosts[host] then return false; end + local is_admin; jid = jid_bare(jid); host = host or "*"; |