diff options
author | Kim Alvefur <zash@zash.se> | 2015-02-09 00:48:08 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-02-09 00:48:08 +0100 |
commit | 8dda0484865684469a2708ded7c1c1ab9542d766 (patch) | |
tree | 49e5401cc7a67229f027c050c934149317ef2146 /core/sessionmanager.lua | |
parent | a5b88cba341e0f99461b12d6dd42f54352c4b76a (diff) | |
parent | b7a38c8c93f8e6bee2579de6b9468fbb68c14589 (diff) | |
download | prosody-8dda0484865684469a2708ded7c1c1ab9542d766.tar.gz prosody-8dda0484865684469a2708ded7c1c1ab9542d766.zip |
Merge 0.10->trunk
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r-- | core/sessionmanager.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 09920b7d..476de931 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -117,6 +117,16 @@ function bind_resource(session, resource) if session.resource then return nil, "cancel", "already-bound", "Cannot bind multiple resources on a single connection"; end -- We don't support binding multiple resources + local event_payload = { session = session, resource = resource }; + if hosts[session.host].events.fire_event("pre-resource-bind", event_payload) == false then + local err = event_payload.error; + if err then return nil, err.type, err.condition, err.text; end + return nil, "cancel", "not-allowed"; + else + -- In case a plugin wants to poke at it + resource = event_payload.resource; + end + resource = resourceprep(resource); resource = resource ~= "" and resource or uuid_generate(); --FIXME: Randomly-generated resources must be unique per-user, and never conflict with existing |