diff options
author | Matthew Wild <mwild1@gmail.com> | 2015-01-31 12:25:24 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2015-01-31 12:25:24 +0000 |
commit | 0817b4dc7ac69021ac709895016266b37ee745be (patch) | |
tree | dc4f4861f9ff4c39fb0c037e14ec6db025ef0c39 /core | |
parent | 887c81f09119032163fda9826df0e20d067c03e0 (diff) | |
parent | b242f3c94876f76ee7ccc5719bc1fc02c4bd0787 (diff) | |
download | prosody-0817b4dc7ac69021ac709895016266b37ee745be.tar.gz prosody-0817b4dc7ac69021ac709895016266b37ee745be.zip |
Merge 0.10->trunk
Diffstat (limited to 'core')
-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 |