aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-01-31 12:25:00 +0000
committerMatthew Wild <mwild1@gmail.com>2015-01-31 12:25:00 +0000
commitb51dfa3ecff22733dac5eb72b6d4bafa582e324e (patch)
treeb6e23cf3da28e7d08ebc6ed95bf0fb5b553ae374 /core
parentf3a7b63d84ca567c716a4426ec77c620a0aed98c (diff)
parent4b5e25cc4199d4a7fda82d7e2fedd4f5f2cc346a (diff)
downloadprosody-b51dfa3ecff22733dac5eb72b6d4bafa582e324e.tar.gz
prosody-b51dfa3ecff22733dac5eb72b6d4bafa582e324e.zip
Merge with 0.10
Diffstat (limited to 'core')
-rw-r--r--core/sessionmanager.lua10
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