From 9356dc880f3f1062d5b3ac6320d2b70bb0634246 Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 17 Dec 2010 15:42:29 -0800 Subject: [PATCH] * backport master commit 5968d343bb21af4c73f1d925837560f953e5ef61 Overload Scene.NewUserConnection() to facilitate NPCs and other region specific applications --- OpenSim/Region/Framework/Scenes/Scene.cs | 34 +++++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f1828dafeb..7f95a484b6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3434,6 +3434,23 @@ namespace OpenSim.Region.Framework.Scenes /// True if the region accepts this agent. False if it does not. False will /// also return a reason. public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) + { + return NewUserConnection(agent, teleportFlags, out reason, true); + } + + /// + /// Do the work necessary to initiate a new user connection for a particular scene. + /// At the moment, this consists of setting up the caps infrastructure + /// The return bool should allow for connections to be refused, but as not all calling paths + /// take proper notice of it let, we allowed banned users in still. + /// + /// CircuitData of the agent who is connecting + /// Outputs the reason for the false response on this string + /// True for normal presence. False for NPC + /// or other applications where a full grid/Hypergrid presence may not be required. + /// True if the region accepts this agent. False if it does not. False will + /// also return a reason. + public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) { TeleportFlags tp = (TeleportFlags)teleportFlags; reason = String.Empty; @@ -3483,15 +3500,18 @@ namespace OpenSim.Region.Framework.Scenes if (sp == null) // We don't have an [child] agent here already { - try + if (requirePresenceLookup) { - if (!VerifyUserPresence(agent, out reason)) + try + { + if (!VerifyUserPresence(agent, out reason)) + return false; + } + catch (Exception e) + { + m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString()); return false; - } - catch (Exception e) - { - m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); - return false; + } } try