Changeset

6563:f0a2bdfd0cea

Merge with 0.10
author Matthew Wild <mwild1@gmail.com>
date Sat, 31 Jan 2015 12:25:00 +0000
parents 6562:2b5ced5ca31f (current diff) 6561:bae84401a02c (diff)
children 6564:bcf32653cab7 6572:c60c199cc7f0
files
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/sessionmanager.lua	Fri Jan 30 14:21:51 2015 +0000
+++ b/core/sessionmanager.lua	Sat Jan 31 12:25:00 2015 +0000
@@ -117,6 +117,16 @@
 	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