From 859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 19 Mar 2010 05:51:16 -0700 Subject: Cleaned up access to scenepresences in scenegraph. GetScenePresences and GetAvatars have been removed to consolidate locking and iteration within SceneGraph. All callers which used these to then iterate over presences have been refactored to instead pass their delegates to Scene.ForEachScenePresence(Action). --- .../World/Estate/EstateManagementModule.cs | 31 ++-- .../CoreModules/World/Land/LandManagementModule.cs | 39 ++--- .../Region/CoreModules/World/Land/LandObject.cs | 26 +-- .../Region/CoreModules/World/Sound/SoundModule.cs | 34 ++-- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 9 +- .../Region/CoreModules/World/Wind/WindModule.cs | 12 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 87 +++------- .../Region/Examples/SimpleModule/RegionModule.cs | 10 +- OpenSim/Region/Framework/Scenes/Scene.cs | 81 +++------ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 186 +++++++++------------ OpenSim/Region/Framework/Scenes/SceneManager.cs | 6 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 19 ++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 58 +++---- .../Avatar/Concierge/ConciergeModule.cs | 39 ++--- .../RegionCombinerModule/RegionCombinerModule.cs | 25 +-- .../Shared/Api/Implementation/LSL_Api.cs | 38 +++-- .../Shared/Api/Implementation/OSSL_Api.cs | 20 ++- .../Api/Implementation/Plugins/SensorRepeat.cs | 93 ++++------- .../Region/UserStatistics/ActiveConnectionsAJAX.cs | 14 +- 19 files changed, 348 insertions(+), 479 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 464d922..91d40ab 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -468,26 +468,20 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) { - // Get a fresh list that will not change as people get teleported away - List presences = m_scene.GetScenePresences(); - - foreach(ScenePresence p in presences) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (p.UUID != senderID) + if (sp.UUID != senderID) { + ScenePresence p = m_scene.GetScenePresence(sp.UUID); // make sure they are still there, we could be working down a long list - ScenePresence s = m_scene.GetScenePresence(p.UUID); - if (s != null) + // Also make sure they are actually in the region + if (p != null && !p.IsChildAgent) { - // Also make sure they are actually in the region - if (!s.IsChildAgent) - { - s.ControllingClient.SendTeleportLocationStart(); - m_scene.TeleportClientHome(s.UUID, s.ControllingClient); - } + p.ControllingClient.SendTeleportLocationStart(); + m_scene.TeleportClientHome(p.UUID, p.ControllingClient); } } - } + }); } private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) { @@ -765,12 +759,11 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionInfoPacketToAll() { - List avatars = m_scene.GetAvatars(); - - for (int i = 0; i < avatars.Count; i++) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - HandleRegionInfoRequest(avatars[i].ControllingClient); - } + if (!sp.IsChildAgent) + HandleRegionInfoRequest(sp.ControllingClient); + }); } public void sendRegionHandshake(IClientAPI remoteClient) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1279ac1..5750aa4 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -191,9 +191,9 @@ namespace OpenSim.Region.CoreModules.World.Land forcedPosition = null; } //if we are far away, teleport - else if (Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3) + else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) { - Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); + Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); clientAvatar.Teleport(forcedPosition.Value); forcedPosition = null; } @@ -374,30 +374,27 @@ namespace OpenSim.Region.CoreModules.World.Land } } - public void SendOutNearestBanLine(IClientAPI avatar) + public void SendOutNearestBanLine(IClientAPI client) { - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence presence in avatars) + ScenePresence sp = m_scene.GetScenePresence(client.AgentId); + if (sp == null || sp.IsChildAgent) + return; + + List checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); + foreach (ILandObject checkBan in checkLandParcels) { - if (presence.UUID == avatar.AgentId) + if (checkBan.IsBannedFromLand(client.AgentId)) { - List checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); - foreach (ILandObject checkBan in checkLandParcels) - { - if (checkBan.IsBannedFromLand(avatar.AgentId)) - { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); - return; //Only send one - } - if (checkBan.IsRestrictedFromLand(avatar.AgentId)) - { - checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); - return; //Only send one - } - } - return; + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, client); + return; //Only send one + } + if (checkBan.IsRestrictedFromLand(client.AgentId)) + { + checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, client); + return; //Only send one } } + return; } public void SendLandUpdate(ScenePresence avatar, bool force) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index e85136a..b2d9b66 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -332,36 +332,38 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendLandUpdateToAvatarsOverMe(bool snap_selection) { - List avatars = m_scene.GetAvatars(); - ILandObject over = null; - for (int i = 0; i < avatars.Count; i++) + m_scene.ForEachScenePresence(delegate(ScenePresence avatar) { + if (avatar.IsChildAgent) + return; + + ILandObject over = null; try { over = - m_scene.LandChannel.GetLandObject(Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), - Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); + m_scene.LandChannel.GetLandObject(Util.Clamp((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), + Util.Clamp((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); } catch (Exception) { - m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + - Math.Round(avatars[i].AbsolutePosition.Y)); + m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + + Math.Round(avatar.AbsolutePosition.Y)); } if (over != null) { if (over.LandData.LocalID == LandData.LocalID) { - if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && + if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && m_scene.RegionInfo.RegionSettings.AllowDamage) - avatars[i].Invulnerable = false; + avatar.Invulnerable = false; else - avatars[i].Invulnerable = true; + avatar.Invulnerable = true; - SendLandUpdateToClient(snap_selection, avatars[i].ControllingClient); + SendLandUpdateToClient(snap_selection, avatar.ControllingClient); } } - } + }); } #endregion diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 1f5a4ff..a52fea4 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -62,40 +62,46 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void PlayAttachedSound( UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) { - foreach (ScenePresence p in m_scene.GetAvatars()) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - double dis = Util.GetDistanceTo(p.AbsolutePosition, position); + if (sp.IsChildAgent) + return; + + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); if (dis > 100.0) // Max audio distance - continue; - + return; + // Scale by distance if (radius == 0) gain = (float)((double)gain * ((100.0 - dis) / 100.0)); else gain = (float)((double)gain * ((radius - dis) / radius)); - - p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); - } + + sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); + }); } public virtual void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) { - foreach (ScenePresence p in m_scene.GetAvatars()) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - double dis = Util.GetDistanceTo(p.AbsolutePosition, position); + if (sp.IsChildAgent) + return; + + double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); if (dis > 100.0) // Max audio distance - continue; - + return; + // Scale by distance if (radius == 0) gain = (float)((double)gain * ((100.0 - dis) / 100.0)); else gain = (float)((double)gain * ((radius - dis) / radius)); - - p.ControllingClient.SendTriggeredSound( + + sp.ControllingClient.SendTriggeredSound( soundId, ownerID, objectID, parentID, handle, position, (float)gain); - } + }); } } } diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 0712a7f..a6dc2ec 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -509,14 +509,13 @@ namespace OpenSim.Region.CoreModules private void SunUpdateToAllClients() { - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence avatar in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (!avatar.IsChildAgent) + if (!sp.IsChildAgent) { - SunToClient(avatar.ControllingClient); + SunToClient(sp.ControllingClient); } - } + }); } #region ISunModule Members diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 3283c1f..9736b73 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -425,9 +425,7 @@ namespace OpenSim.Region.CoreModules { if (m_ready) { - List avatars = m_scene.GetAvatars(); - - if (avatars.Count > 0) + if(m_scene.GetRootAgentCount() > 0) { // Ask wind plugin to generate a LL wind array to be cached locally // Try not to update this too often, as it may involve array copies @@ -437,11 +435,11 @@ namespace OpenSim.Region.CoreModules m_frameLastUpdateClientArray = m_frame; } - foreach (ScenePresence avatar in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (!avatar.IsChildAgent) - avatar.ControllingClient.SendWindData(windSpeeds); - } + if (!sp.IsChildAgent) + sp.ControllingClient.SendWindData(windSpeeds); + }); } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b63d014..f1cc0dd 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -304,25 +304,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// AgentID that logged out private void ClientLoggedOut(UUID AgentId, Scene scene) { - List presences = m_scene.GetAvatars(); - int rootcount = 0; - for (int i=0;i avatars = m_scene.GetAvatars(); int tc = Environment.TickCount; List mapitems = new List(); mapItemReply mapitem = new mapItemReply(); - if (avatars.Count == 0 || avatars.Count == 1) + if (m_scene.GetRootAgentCount() <= 1) { mapitem = new mapItemReply(); mapitem.x = (uint)(xstart + 1); @@ -392,21 +377,21 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } else { - foreach (ScenePresence av in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { // Don't send a green dot for yourself - if (av.UUID != remoteClient.AgentId) + if (!sp.IsChildAgent && sp.UUID != remoteClient.AgentId) { mapitem = new mapItemReply(); - mapitem.x = (uint)(xstart + av.AbsolutePosition.X); - mapitem.y = (uint)(ystart + av.AbsolutePosition.Y); + mapitem.x = (uint)(xstart + sp.AbsolutePosition.X); + mapitem.y = (uint)(ystart + sp.AbsolutePosition.Y); mapitem.id = UUID.Zero; mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); mapitem.Extra = 1; mapitem.Extra2 = 0; mapitems.Add(mapitem); } - } + }); } remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); } @@ -981,51 +966,35 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); OSDMap responsemap = new OSDMap(); - List avatars = m_scene.GetAvatars(); - OSDArray responsearr = new OSDArray(avatars.Count); - OSDMap responsemapdata = new OSDMap(); int tc = Environment.TickCount; - /* - foreach (ScenePresence av in avatars) - { - responsemapdata = new OSDMap(); - responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X)); - responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y)); - responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); - responsemapdata["Name"] = OSD.FromString("TH"); - responsemapdata["Extra"] = OSD.FromInteger(0); - responsemapdata["Extra2"] = OSD.FromInteger(0); - responsearr.Add(responsemapdata); - } - responsemap["1"] = responsearr; - */ - if (avatars.Count == 0) + if (m_scene.GetRootAgentCount() == 0) { - responsemapdata = new OSDMap(); + OSDMap responsemapdata = new OSDMap(); responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1)); responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1)); responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); responsemapdata["Extra"] = OSD.FromInteger(0); responsemapdata["Extra2"] = OSD.FromInteger(0); + OSDArray responsearr = new OSDArray(); responsearr.Add(responsemapdata); responsemap["6"] = responsearr; } else { - responsearr = new OSDArray(avatars.Count); - foreach (ScenePresence av in avatars) + OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - responsemapdata = new OSDMap(); - responsemapdata["X"] = OSD.FromInteger((int)(xstart + av.AbsolutePosition.X)); - responsemapdata["Y"] = OSD.FromInteger((int)(ystart + av.AbsolutePosition.Y)); + OSDMap responsemapdata = new OSDMap(); + responsemapdata["X"] = OSD.FromInteger((int)(xstart + sp.AbsolutePosition.X)); + responsemapdata["Y"] = OSD.FromInteger((int)(ystart + sp.AbsolutePosition.Y)); responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString())); responsemapdata["Extra"] = OSD.FromInteger(1); responsemapdata["Extra2"] = OSD.FromInteger(0); responsearr.Add(responsemapdata); - } + }); responsemap["6"] = responsearr; } return responsemap; @@ -1107,25 +1076,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private void MakeChildAgent(ScenePresence avatar) { - List presences = m_scene.GetAvatars(); - int rootcount = 0; - for (int i = 0; i < presences.Count; i++) - { - if (presences[i] != null) - { - if (!presences[i].IsChildAgent) - rootcount++; - } - } - if (rootcount <= 1) - StopThread(); - lock (m_rootAgents) { - if (m_rootAgents.Contains(avatar.UUID)) - { - m_rootAgents.Remove(avatar.UUID); - } + m_rootAgents.Remove(avatar.UUID); + if (m_rootAgents.Count == 0) + StopThread(); } } diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index e1d5bdc..6da41db 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs @@ -88,12 +88,12 @@ namespace OpenSim.Region.Examples.SimpleModule m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); } - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence avatar in avatars) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - avatar.AbsolutePosition = - new Vector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); - } + if (!sp.IsChildAgent) + sp.AbsolutePosition = + new Vector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); + }); } // private void AddComplexObjects(RegionInfo regionInfo, Vector3 pos) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a86a33c..4b97e39 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3269,7 +3269,7 @@ namespace OpenSim.Region.Framework.Scenes } } - ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); + ScenePresence sp = GetScenePresence(agent.AgentID); if (sp != null) { m_log.DebugFormat( @@ -3561,8 +3561,7 @@ namespace OpenSim.Region.Framework.Scenes /// message to display to the user. Reason for being logged off public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) { - ScenePresence loggingOffUser = null; - loggingOffUser = GetScenePresence(AvatarID); + ScenePresence loggingOffUser = GetScenePresence(AvatarID); if (loggingOffUser != null) { UUID localRegionSecret = UUID.Zero; @@ -3598,8 +3597,8 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { - ScenePresence presence; - if(m_sceneGraph.TryGetAvatar(agentID, out presence)) + ScenePresence presence = GetScenePresence(agentID); + if(presence != null) { try { @@ -3773,8 +3772,8 @@ namespace OpenSim.Region.Framework.Scenes public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) { - ScenePresence sp; - if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp)) + ScenePresence sp = GetScenePresence(remoteClient.AgentId); + if (sp != null) { uint regionX = m_regInfo.RegionLocX; uint regionY = m_regInfo.RegionLocY; @@ -3952,17 +3951,17 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World"); - foreach (ScenePresence scenePresence in GetAvatars()) + ForEachScenePresence(delegate(ScenePresence sp) { m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", - scenePresence.Firstname, - scenePresence.Lastname, - scenePresence.UUID, - scenePresence.ControllingClient.AgentId, + sp.Firstname, + sp.Lastname, + sp.UUID, + sp.ControllingClient.AgentId, "Unknown", "Unknown", RegionInfo.RegionName); - } + }); break; } @@ -4128,72 +4127,42 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGraph.RemovePhysicalPrim(num); } - //The idea is to have a group of method that return a list of avatars meeting some requirement - // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. - // - // GetAvatars returns a new list of all root agent presences in the scene - // GetScenePresences returns a new list of all presences in the scene or a filter may be passed. - // GetScenePresence returns the presence with matching UUID or first/last name. - // ForEachScenePresence requests the Scene to run a delegate function against all presences. - - /// - /// Return a list of all avatars in this region. - /// This list is a new object, so it can be iterated over without locking. - /// - /// - public List GetAvatars() - { - return m_sceneGraph.GetAvatars(); - } - - /// - /// Return a list of all ScenePresences in this region. This returns child agents as well as root agents. - /// This list is a new object, so it can be iterated over without locking. - /// - /// - public List GetScenePresences() + public int GetRootAgentCount() { - return m_sceneGraph.GetScenePresences(); + return m_sceneGraph.GetRootAgentCount(); } - /// - /// Request a filtered list of ScenePresences in this region. - /// This list is a new object, so it can be iterated over without locking. - /// - /// - /// - public List GetScenePresences(FilterAvatarList filter) + public int GetChildAgentCount() { - return m_sceneGraph.GetScenePresences(filter); + return m_sceneGraph.GetChildAgentCount(); } /// - /// Request a scene presence by UUID + /// Request a scene presence by UUID. Fast, indexed lookup. /// - /// - /// - public ScenePresence GetScenePresence(UUID avatarID) + /// + /// null if the presence was not found + public ScenePresence GetScenePresence(UUID agentID) { - return m_sceneGraph.GetScenePresence(avatarID); + return m_sceneGraph.GetScenePresence(agentID); } /// - /// Request the ScenePresence in this region by first/last name. - /// Should normally only be a single match, but first is always returned + /// Request the scene presence by name. /// /// /// - /// + /// null if the presence was not found public ScenePresence GetScenePresence(string firstName, string lastName) { return m_sceneGraph.GetScenePresence(firstName, lastName); } /// - /// Request the ScenePresence in this region by localID. + /// Request the scene presence by localID. /// /// - /// + /// null if the presence was not found public ScenePresence GetScenePresence(uint localID) { return m_sceneGraph.GetScenePresence(localID); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index d259c42..b6e5995 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -699,116 +699,84 @@ namespace OpenSim.Region.Framework.Scenes return null; } - // The idea is to have a group of method that return a list of avatars meeting some requirement - // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. - // - // GetAvatars returns a new list of all root agent presences in the scene - // GetScenePresences returns a new list of all presences in the scene or a filter may be passed. - // GetScenePresence returns the presence with matching UUID or the first presence matching the passed filter. - // ForEachScenePresence requests the Scene to run a delegate function against all presences. - /// - /// Request a list of all avatars in this region (no child agents) - /// This list is a new object, so it can be iterated over without locking. + /// Request a copy of m_scenePresences in this World + /// There is no guarantee that presences will remain in the scene after the list is returned. + /// This list should remain private to SceneGraph. Callers wishing to iterate should instead + /// pass a delegate to ForEachScenePresence. /// /// - public List GetAvatars() + private List GetScenePresences() { - return GetScenePresences(delegate(ScenePresence scenePresence) - { - return !scenePresence.IsChildAgent; - }); + lock (m_scenePresences) + return new List(m_scenePresenceArray); } /// - /// Request a list of m_scenePresences in this World - /// Returns a copy so it can be iterated without a lock. - /// There is no guarantee that presences will remain in the scene after the list is returned. + /// Request a scene presence by UUID. Fast, indexed lookup. /// - /// - protected internal List GetScenePresences() + /// + /// null if the presence was not found + protected internal ScenePresence GetScenePresence(UUID agentID) { - List result; + ScenePresence sp; lock (m_scenePresences) { - result = new List(m_scenePresenceArray.Length); - result.AddRange(m_scenePresenceArray); + m_scenePresences.TryGetValue(agentID, out sp); } - return result; + return sp; } /// - /// Request a filtered list of m_scenePresences in this World - /// Returns a copy so it can be iterated without a lock. - /// There is no guarantee that presences will remain in the scene after the list is returned. + /// Request the scene presence by name. /// - /// - protected internal List GetScenePresences(FilterAvatarList filter) + /// + /// + /// null if the presence was not found + protected internal ScenePresence GetScenePresence(string firstName, string lastName) { - List result = new List(); - // Check each ScenePresence against the filter - ForEachScenePresence(delegate(ScenePresence presence) + foreach (ScenePresence presence in GetScenePresences()) { - if (filter(presence)) - result.Add(presence); - }); - return result; + if (presence.Firstname == firstName && presence.Lastname == lastName) + return presence; + } + return null; } /// - /// Request the ScenePresence in this region matching filter. - /// Only the first match is returned. - /// + /// Request the scene presence by localID. /// - /// - /// - protected internal ScenePresence GetScenePresence(FilterAvatarList filter) + /// + /// null if the presence was not found + protected internal ScenePresence GetScenePresence(uint localID) { - ScenePresence result = null; - // Get all of the ScenePresences - List presences = GetScenePresences(); - foreach (ScenePresence presence in presences) - { - if (filter(presence)) - { - result = presence; - break; - } - } - return result; + foreach (ScenePresence presence in GetScenePresences()) + if (presence.LocalId == localID) + return presence; + return null; } - protected internal ScenePresence GetScenePresence(string firstName, string lastName) + protected internal bool TryGetAvatar(UUID agentID, out ScenePresence avatar) { - return GetScenePresence(delegate(ScenePresence presence) + lock (m_scenePresences) { - return(presence.Firstname == firstName && presence.Lastname == lastName); - }); - } - - /// - /// Request a scene presence by UUID - /// - /// - /// null if the agent was not found - protected internal ScenePresence GetScenePresence(UUID agentID) - { - ScenePresence sp; - TryGetAvatar(agentID, out sp); - return sp; + m_scenePresences.TryGetValue(agentID, out avatar); + } + return (avatar != null); } - /// - /// Request the ScenePresence in this region by localID. - /// - /// - /// - protected internal ScenePresence GetScenePresence(uint localID) + protected internal bool TryGetAvatarByName(string name, out ScenePresence avatar) { - return GetScenePresence(delegate(ScenePresence presence) + avatar = null; + foreach (ScenePresence presence in GetScenePresences()) { - return (presence.LocalId == localID); - }); + if (String.Compare(name, presence.ControllingClient.Name, true) == 0) + { + avatar = presence; + break; + } + } + return (avatar != null); } /// @@ -962,24 +930,6 @@ namespace OpenSim.Region.Framework.Scenes return group.GetChildPart(fullID); } - protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) - { - lock (m_scenePresences) - { - m_scenePresences.TryGetValue(avatarId, out avatar); - } - return (avatar != null); - } - - protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) - { - avatar = GetScenePresence(delegate(ScenePresence presence) - { - return (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0); - }); - return (avatar != null); - } - /// /// Returns a list of the entities in the scene. This is a new list so no locking is required to iterate over /// it @@ -1042,6 +992,10 @@ namespace OpenSim.Region.Framework.Scenes return UUID.Zero; } + /// + /// Performs action on all scene object groups. + /// + /// protected internal void ForEachSOG(Action action) { List objlist = new List(SceneObjectGroupsByFullID.Values); @@ -1061,23 +1015,41 @@ namespace OpenSim.Region.Framework.Scenes /// - /// Performs action on all scene presences. + /// Performs action on all scene presences. This can ultimately run the actions in parallel but + /// any delegates passed in will need to implement their own locking on data they reference and + /// modify outside of the scope of the delegate. /// /// public void ForEachScenePresence(Action action) { - List presences = GetScenePresences(); - try + // Once all callers have their delegates configured for parallelism, we can unleash this + /* + Action protectedAction = new Action(delegate(ScenePresence sp) + { + try + { + action(sp); + } + catch (Exception e) + { + m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Info("[BUG] Stack Trace: " + e.StackTrace); + } + }); + Parallel.ForEach(GetScenePresences(), protectedAction); + */ + // For now, perform actiona serially + foreach (ScenePresence sp in GetScenePresences()) { - foreach(ScenePresence presence in presences) + try { - action(presence); + action(sp); + } + catch (Exception e) + { + m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Info("[BUG] Stack Trace: " + e.StackTrace); } - } - catch (Exception e) - { - m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); - m_log.Info("[BUG] Stack Trace: " + e.StackTrace); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index a955532..1168341 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -454,8 +454,10 @@ namespace OpenSim.Region.Framework.Scenes ForEachCurrentScene(delegate(Scene scene) { - List scenePresences = scene.GetScenePresences(); - presences.AddRange(scenePresences); + scene.ForEachScenePresence(delegate(ScenePresence sp) + { + presences.Add(sp); + }); }); return presences; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0e21487..88bdf31 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1321,11 +1321,11 @@ namespace OpenSim.Region.Framework.Scenes if (volume < 0) volume = 0; - List avatarts = m_parentGroup.Scene.GetAvatars(); - foreach (ScenePresence p in avatarts) + m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - p.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); - } + if(!sp.IsChildAgent) + sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); + }); } /// @@ -2609,12 +2609,13 @@ namespace OpenSim.Region.Framework.Scenes } } - List avatarts = m_parentGroup.Scene.GetAvatars(); - foreach (ScenePresence p in avatarts) + m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100)) - p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); - } + if (sp.IsChildAgent) + return; + if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) + sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); + }); } public void RemFlag(PrimFlags flag) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 766f6d3..b5f6217 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2396,35 +2396,33 @@ namespace OpenSim.Region.Framework.Scenes List CoarseLocations = new List(); List AvatarUUIDs = new List(); - List avatars = m_scene.GetAvatars(); - for (int i = 0; i < avatars.Count; i++) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - // Requested by LibOMV. Send Course Location on self. - //if (avatars[i] != this) - //{ - if (avatars[i].ParentID != 0) + if (sp.IsChildAgent) + return; + + if (sp.ParentID != 0) + { + // sitting avatar + SceneObjectPart sop = m_scene.GetSceneObjectPart(sp.ParentID); + if (sop != null) { - // sitting avatar - SceneObjectPart sop = m_scene.GetSceneObjectPart(avatars[i].ParentID); - if (sop != null) - { - CoarseLocations.Add(sop.AbsolutePosition + avatars[i].m_pos); - AvatarUUIDs.Add(avatars[i].UUID); - } - else - { - // we can't find the parent.. ! arg! - CoarseLocations.Add(avatars[i].m_pos); - AvatarUUIDs.Add(avatars[i].UUID); - } + CoarseLocations.Add(sop.AbsolutePosition + sp.m_pos); + AvatarUUIDs.Add(sp.UUID); } else { - CoarseLocations.Add(avatars[i].m_pos); - AvatarUUIDs.Add(avatars[i].UUID); + // we can't find the parent.. ! arg! + CoarseLocations.Add(sp.m_pos); + AvatarUUIDs.Add(sp.UUID); } - //} - } + } + else + { + CoarseLocations.Add(sp.m_pos); + AvatarUUIDs.Add(sp.UUID); + } + }); m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); @@ -2498,13 +2496,15 @@ namespace OpenSim.Region.Framework.Scenes m_perfMonMS = Util.EnvironmentTickCount(); // only send update from root agents to other clients; children are only "listening posts" - List avatars = m_scene.GetAvatars(); - foreach (ScenePresence avatar in avatars) + int count = 0; + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - SendFullUpdateToOtherClient(avatar); - - } - m_scene.StatsReporter.AddAgentUpdates(avatars.Count); + if (sp.IsChildAgent) + return; + SendFullUpdateToOtherClient(sp); + ++count; + }); + m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); Animator.SendAnimPack(); diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index c864993..b85bac6 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -318,9 +318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { Scene scene = client.Scene as Scene; m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, scene.RegionInfo.RegionName); - List avs = scene.GetAvatars(); - AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, avs.Count)); - UpdateBroker(scene, avs); + AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, client.Name, scene.RegionInfo.RegionName, scene.GetRootAgentCount())); + UpdateBroker(scene); } } @@ -331,11 +330,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { Scene scene = agent.Scene; m_log.DebugFormat("[Concierge]: {0} enters {1}", agent.Name, scene.RegionInfo.RegionName); - List avs = scene.GetAvatars(); WelcomeAvatar(agent, scene); AnnounceToAgentsRegion(scene, String.Format(m_announceEntering, agent.Name, - scene.RegionInfo.RegionName, avs.Count)); - UpdateBroker(scene, avs); + scene.RegionInfo.RegionName, scene.GetRootAgentCount())); + UpdateBroker(scene); } } @@ -346,10 +344,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { Scene scene = agent.Scene; m_log.DebugFormat("[Concierge]: {0} leaves {1}", agent.Name, scene.RegionInfo.RegionName); - List avs = scene.GetAvatars(); AnnounceToAgentsRegion(scene, String.Format(m_announceLeaving, agent.Name, - scene.RegionInfo.RegionName, avs.Count)); - UpdateBroker(scene, avs); + scene.RegionInfo.RegionName, scene.GetRootAgentCount())); + UpdateBroker(scene); } } @@ -368,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge } } - protected void UpdateBroker(IScene scene, List avatars) + protected void UpdateBroker(Scene scene) { if (String.IsNullOrEmpty(m_brokerURI)) return; @@ -377,24 +374,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge // create XML sniplet StringBuilder list = new StringBuilder(); - if (0 == avatars.Count) - { - list.Append(String.Format("", - scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, + list.Append(String.Format("\n", + scene.GetRootAgentCount(), scene.RegionInfo.RegionName, + scene.RegionInfo.RegionID, DateTime.UtcNow.ToString("s"))); - } - else + scene.ForEachScenePresence(delegate(ScenePresence sp) { - list.Append(String.Format("\n", - avatars.Count, scene.RegionInfo.RegionName, - scene.RegionInfo.RegionID, - DateTime.UtcNow.ToString("s"))); - foreach (ScenePresence av in avatars) + if (!sp.IsChildAgent) { - list.Append(String.Format(" \n", av.Name, av.UUID)); + list.Append(String.Format(" \n", sp.Name, sp.UUID)); + list.Append(""); } - list.Append(""); - } + }); string payload = list.ToString(); // post via REST to broker diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 1a99c83..7a43537 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -707,36 +707,37 @@ namespace OpenSim.Region.RegionCombinerModule return; } - List avatars = connectiondata.RegionScene.GetAvatars(); List CoarseLocations = new List(); List AvatarUUIDs = new List(); - for (int i = 0; i < avatars.Count; i++) + connectiondata.RegionScene.ForEachScenePresence(delegate(ScenePresence sp) { - if (avatars[i].UUID != presence.UUID) + if (sp.IsChildAgent) + return; + if (sp.UUID != presence.UUID) { - if (avatars[i].ParentID != 0) + if (sp.ParentID != 0) { // sitting avatar - SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID); + SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID); if (sop != null) { - CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition); - AvatarUUIDs.Add(avatars[i].UUID); + CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition); + AvatarUUIDs.Add(sp.UUID); } else { // we can't find the parent.. ! arg! - CoarseLocations.Add(avatars[i].AbsolutePosition); - AvatarUUIDs.Add(avatars[i].UUID); + CoarseLocations.Add(sp.AbsolutePosition); + AvatarUUIDs.Add(sp.UUID); } } else { - CoarseLocations.Add(avatars[i].AbsolutePosition); - AvatarUUIDs.Add(avatars[i].UUID); + CoarseLocations.Add(sp.AbsolutePosition); + AvatarUUIDs.Add(sp.UUID); } } - } + }); DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b040ca77..3ccbb3a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5092,7 +5092,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetRegionAgentCount() { m_host.AddScriptLPS(1); - return new LSL_Integer(World.GetAvatars().Count); + return new LSL_Integer(World.GetRootAgentCount()); } public LSL_Vector llGetRegionCorner() @@ -8771,17 +8771,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api landObject.SetMediaUrl(url); // now send to all (non-child) agents - List agents = World.GetAvatars(); - foreach (ScenePresence agent in agents) + World.ForEachScenePresence(delegate(ScenePresence sp) { - agent.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, - landData.MediaID, - landData.MediaAutoScale, - mediaType, - description, - width, height, - loop); - } + if (!sp.IsChildAgent) + { + sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, + landData.MediaID, + landData.MediaAutoScale, + mediaType, + description, + width, height, + loop); + } + }); } else if (!presence.IsChildAgent) { @@ -8802,13 +8804,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence == null) { // send to all (non-child) agents - List agents = World.GetAvatars(); - foreach (ScenePresence agent in agents) + World.ForEachScenePresence(delegate(ScenePresence sp) { - agent.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? - (ParcelMediaCommandEnum)commandToSend, - time); - } + if (!sp.IsChildAgent) + { + sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? + (ParcelMediaCommandEnum)commandToSend, + time); + } + }); } else if (!presence.IsChildAgent) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 85ee29d..7e68cc7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -697,10 +697,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetAgents"); LSL_List result = new LSL_List(); - foreach (ScenePresence avatar in World.GetAvatars()) + World.ForEachScenePresence(delegate(ScenePresence sp) { - result.Add(avatar.Name); - } + if (!sp.IsChildAgent) + result.Add(sp.Name); + }); return result; } @@ -1985,19 +1986,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) { - foreach (ScenePresence presence in World.GetAvatars()) + World.ForEachScenePresence(delegate(ScenePresence sp) { - if ((presence.Firstname == FirstName) && - presence.Lastname == SurName) + if (!sp.IsChildAgent && + sp.Firstname == FirstName && + sp.Lastname == SurName) { // kick client... if (alert != null) - presence.ControllingClient.Kick(alert); + sp.ControllingClient.Kick(alert); // ...and close on our side - presence.Scene.IncomingCloseAgent(presence.UUID); + sp.Scene.IncomingCloseAgent(sp.UUID); } - } + }); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 829fbb7..6cbf260 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -404,70 +404,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins private List doAgentSensor(SenseRepeatClass ts) { - List presences; List sensedEntities = new List(); - // If this is an avatar sense by key try to get them directly - // rather than getting a list to scan through - if (ts.keyID != UUID.Zero) - { - ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID); - if (p == null) - return sensedEntities; - presences = new List(); - presences.Add(p); - } - else - { - presences = new List(m_CmdManager.m_ScriptEngine.World.GetScenePresences()); - } - // If nobody about quit fast - if (presences.Count == 0) + if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0) return sensedEntities; SceneObjectPart SensePoint = ts.host; - Vector3 fromRegionPos = SensePoint.AbsolutePosition; - Quaternion q = SensePoint.RotationOffset; LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); - bool attached = (SensePoint.AttachmentPoint != 0); - bool nameSearch = (ts.name != null && ts.name != ""); Vector3 toRegionPos; double dis; - for (int i = 0; i < presences.Count; i++) + Action senseEntity = new Action(delegate(ScenePresence presence) { - ScenePresence presence = presences[i]; - bool keep = true; + if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) + return; + + // if the object the script is in is attached and the avatar is the owner + // then this one is not wanted + if (attached && presence.UUID == SensePoint.OwnerID) + return; - if (presence.IsDeleted) - continue; - - if (presence.IsChildAgent) - keep = false; toRegionPos = presence.AbsolutePosition; - dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos)); // are they in range - if (keep && dis <= ts.range) + if (dis <= ts.range) { - // if the object the script is in is attached and the avatar is the owner - // then this one is not wanted - if (attached && presence.UUID == SensePoint.OwnerID) - keep = false; - - // check the name if needed - if (keep && nameSearch && ts.name != presence.Name) - keep = false; - // Are they in the required angle of view - if (keep && ts.arc < Math.PI) + if (ts.arc < Math.PI) { // not omni-directional. Can you see it ? // vec forward_dir = llRot2Fwd(llGetRot()) @@ -488,26 +458,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins catch { } - if (ang_obj > ts.arc) keep = false; + if (ang_obj <= ts.arc) + { + sensedEntities.Add(new SensedEntity(dis, presence.UUID)); + } } } - else - { - keep = false; - } + }); - // Do not report gods, not even minor ones - if (keep && presence.GodLevel > 0.0) - keep = false; - - if (keep) // add to list with distance - { - sensedEntities.Add(new SensedEntity(dis, presence.UUID)); - } - - // If this is a search by name and we have just found it then no more to do - if (nameSearch && ts.name == presence.Name) + // If this is an avatar sense by key try to get them directly + // rather than getting a list to scan through + if (ts.keyID != UUID.Zero) + { + ScenePresence sp; + // Try direct lookup by UUID + if(!m_CmdManager.m_ScriptEngine.World.TryGetAvatar(ts.keyID, out sp)) return sensedEntities; + senseEntity(sp); + } + else if (ts.name != null && ts.name != "") + { + ScenePresence sp; + // Try lookup by name will return if/when found + if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) + return sensedEntities; + senseEntity(sp); + } + else + { + m_CmdManager.m_ScriptEngine.World.ForEachScenePresence(senseEntity); } return sensedEntities; } diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs index a567413..dcbd717 100644 --- a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs +++ b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs @@ -68,17 +68,15 @@ namespace OpenSim.Region.UserStatistics HTMLUtil.OL_O(ref output, ""); foreach (Scene scene in all_scenes) { - List avatarInScene = scene.GetScenePresences(); - HTMLUtil.LI_O(ref output, String.Empty); output.Append(scene.RegionInfo.RegionName); HTMLUtil.OL_O(ref output, String.Empty); - foreach (ScenePresence av in avatarInScene) + scene.ForEachScenePresence(delegate(ScenePresence av) { - Dictionary queues = new Dictionary(); + Dictionary queues = new Dictionary(); if (av.ControllingClient is IStatsCollector) { - IStatsCollector isClient = (IStatsCollector) av.ControllingClient; + IStatsCollector isClient = (IStatsCollector)av.ControllingClient; queues = decodeQueueReport(isClient.Report()); } HTMLUtil.LI_O(ref output, String.Empty); @@ -92,8 +90,8 @@ namespace OpenSim.Region.UserStatistics else { output.Append(string.Format("
Position: <{0},{1},{2}>", (int)av.AbsolutePosition.X, - (int) av.AbsolutePosition.Y, - (int) av.AbsolutePosition.Z)); + (int)av.AbsolutePosition.Y, + (int)av.AbsolutePosition.Z)); } Dictionary throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1)); @@ -124,7 +122,7 @@ namespace OpenSim.Region.UserStatistics HTMLUtil.UL_C(ref output); HTMLUtil.LI_C(ref output); - } + }); HTMLUtil.OL_C(ref output); } HTMLUtil.OL_C(ref output); -- cgit v1.1 From 62e0b53ca4697a852ee1e36e86da6a32e93bd55e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 19 Mar 2010 05:58:34 -0700 Subject: Renamed TryGetAvatar to TryGetScenePresence on SceneManager, SceneBase, Scene and SceneGraph. This was the only change in this patch to keep it isolated from other recent changes to the same set of files. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++++---- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 2 +- .../Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs | 2 +- .../Framework/InventoryAccess/HGInventoryAccessModule.cs | 2 +- .../CoreModules/InterGrid/OpenGridProtocolModule.cs | 2 +- .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 4 ++-- .../ServiceConnectorsOut/Inventory/InventoryCache.cs | 2 +- .../ServiceConnectorsOut/Presence/PresenceDetector.cs | 2 +- .../Region/CoreModules/World/WorldMap/WorldMapModule.cs | 4 ++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 16 ++++++++-------- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- OpenSim/Region/Framework/Scenes/SceneBase.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneManager.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs | 2 +- .../OptionalModules/Avatar/Concierge/ConciergeModule.cs | 2 +- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 4 ++-- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 2 +- 20 files changed, 38 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a9b5c2b..18d3889 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5978,7 +5978,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP || avSetStartLocationRequestPacket.StartLocationData.LocationPos.Y == 255.5f) { ScenePresence avatar = null; - if (((Scene)m_scene).TryGetAvatar(AgentId, out avatar)) + if (((Scene)m_scene).TryGetScenePresence(AgentId, out avatar)) { if (avSetStartLocationRequestPacket.StartLocationData.LocationPos.X == 255.5f) { diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f54e41a..23828ef 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Save avatar attachment information ScenePresence presence; - if (m_scene.AvatarFactory != null && m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { m_log.Info( "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId @@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments AttachmentPt = att.RootPart.AttachmentPoint; ScenePresence presence; - if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = m_scene.InventoryService.GetItem(item); @@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } ScenePresence presence; - if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { // XXYY!! InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); @@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) { ScenePresence presence; - if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { presence.Appearance.DetachAttachment(itemID); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 4f03b0e..be89740 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -358,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { ScenePresence presence; - if (s.TryGetAvatar(agentID, out presence)) + if (s.TryGetScenePresence(agentID, out presence)) { // If the agent is in this scene, then we // are being called twice in a single diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs index 63a93aa..c011776 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps responsedata["str_response_string"] = "Request wasn't what was expected"; ScenePresence avatar; - if (!m_scene.TryGetAvatar(AgentId, out avatar)) + if (!m_scene.TryGetScenePresence(AgentId, out avatar)) return responsedata; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 25f5154..93aeb94 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (account == null) // foreign { ScenePresence sp = null; - if (m_Scene.TryGetAvatar(userID, out sp)) + if (m_Scene.TryGetScenePresence(userID, out sp)) { AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 8cf4619..e95d2f8 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -1206,7 +1206,7 @@ namespace OpenSim.Region.CoreModules.InterGrid { Scene homeScene = GetRootScene(); ScenePresence avatar = null; - if (homeScene.TryGetAvatar(avatarId,out avatar)) + if (homeScene.TryGetScenePresence(avatarId,out avatar)) { KillAUser ku = new KillAUser(avatar,mod); Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index c6312e0..54508cc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -502,7 +502,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private UUID GetSessionID(UUID userID) { ScenePresence sp = null; - if (m_Scene.TryGetAvatar(userID, out sp)) + if (m_Scene.TryGetScenePresence(userID, out sp)) { return sp.ControllingClient.SessionId; } @@ -521,7 +521,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory if (account == null) // foreign user { ScenePresence sp = null; - m_Scene.TryGetAvatar(userID, out sp); + m_Scene.TryGetScenePresence(userID, out sp); if (sp != null) { AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 3c3534f..5e06580 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory ScenePresence sp = null; foreach (Scene s in m_Scenes) { - s.TryGetAvatar(clientID, out sp); + s.TryGetScenePresence(clientID, out sp); if ((sp != null) && !sp.IsChildAgent && (s != scene)) { m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index e98df28..7a75a89 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs @@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence Vector3 position = new Vector3(128, 128, 0); Vector3 lookat = new Vector3(0, 1, 0); - if (client.Scene.TryGetAvatar(client.AgentId, out sp)) + if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) { if (sp is ScenePresence) { diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index f1cc0dd..2b0e83f 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // this is here because CAPS map requests work even beyond the 10,000 limit. ScenePresence avatarPresence = null; - m_scene.TryGetAvatar(agentID, out avatarPresence); + m_scene.TryGetScenePresence(agentID, out avatarPresence); if (avatarPresence != null) { @@ -489,7 +489,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (mrs.agentID != UUID.Zero) { ScenePresence av = null; - m_scene.TryGetAvatar(mrs.agentID, out av); + m_scene.TryGetScenePresence(mrs.agentID, out av); if (av != null) { if (response.ContainsKey(mrs.itemtype.ToString())) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 41533a1..32311d8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar; - if (TryGetAvatar(avatarId, out avatar)) + if (TryGetScenePresence(avatarId, out avatar)) { IInventoryAccessModule invAccess = RequestModuleInterface(); if (invAccess != null) @@ -230,7 +230,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar; - if (TryGetAvatar(avatarId, out avatar)) + if (TryGetScenePresence(avatarId, out avatar)) { return CapsUpdateTaskInventoryScriptAsset( avatar.ControllingClient, itemId, primId, isScriptRunning, data); @@ -683,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes if (transactionID == UUID.Zero) { ScenePresence presence; - if (TryGetAvatar(remoteClient.AgentId, out presence)) + if (TryGetScenePresence(remoteClient.AgentId, out presence)) { byte[] data = null; @@ -941,7 +941,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar; - if (TryGetAvatar(avatarId, out avatar)) + if (TryGetScenePresence(avatarId, out avatar)) { return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); } @@ -1055,7 +1055,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar; - if (TryGetAvatar(srcTaskItem.OwnerID, out avatar)) + if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar)) { destPart.GetProperties(avatar.ControllingClient); } @@ -1083,7 +1083,7 @@ namespace OpenSim.Region.Framework.Scenes } ScenePresence avatar = null; - if (TryGetAvatar(destID, out avatar)) + if (TryGetScenePresence(destID, out avatar)) { //profile.SendInventoryDecendents(avatar.ControllingClient, // profile.RootFolder.ID, true, false); @@ -1420,7 +1420,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar; - if (TryGetAvatar(srcTaskItem.OwnerID, out avatar)) + if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar)) { destPart.GetProperties(avatar.ControllingClient); } @@ -1860,7 +1860,7 @@ namespace OpenSim.Region.Framework.Scenes UUID inventoryID = part.ParentGroup.GetFromItemID(); ScenePresence presence; - if (TryGetAvatar(remoteClient.AgentId, out presence)) + if (TryGetScenePresence(remoteClient.AgentId, out presence)) { if (!Permissions.CanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) return; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4b97e39..2080687 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4254,9 +4254,9 @@ namespace OpenSim.Region.Framework.Scenes return m_sceneGraph.GetGroupByPrim(localID); } - public override bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) + public override bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) { - return m_sceneGraph.TryGetAvatar(avatarId, out avatar); + return m_sceneGraph.TryGetScenePresence(avatarId, out avatar); } public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 74476ed..3218dad 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -190,11 +190,11 @@ namespace OpenSim.Region.Framework.Scenes /// public abstract void RemoveClient(UUID agentID); - public bool TryGetAvatar(UUID agentID, out object scenePresence) + public bool TryGetScenePresence(UUID agentID, out object scenePresence) { scenePresence = null; ScenePresence sp = null; - if (TryGetAvatar(agentID, out sp)) + if (TryGetScenePresence(agentID, out sp)) { scenePresence = sp; return true; @@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes return false; } - public abstract bool TryGetAvatar(UUID agentID, out ScenePresence scenePresence); + public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); #endregion diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b6e5995..23a4ee9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -756,7 +756,7 @@ namespace OpenSim.Region.Framework.Scenes return null; } - protected internal bool TryGetAvatar(UUID agentID, out ScenePresence avatar) + protected internal bool TryGetScenePresence(UUID agentID, out ScenePresence avatar) { lock (m_scenePresences) { diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 1168341..3b84734 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -486,11 +486,11 @@ namespace OpenSim.Region.Framework.Scenes ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); } - public bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) + public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) { foreach (Scene scene in m_localScenes) { - if (scene.TryGetAvatar(avatarId, out avatar)) + if (scene.TryGetScenePresence(avatarId, out avatar)) { return true; } @@ -505,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar = null; foreach (Scene mScene in m_localScenes) { - if (mScene.TryGetAvatar(avatarId, out avatar)) + if (mScene.TryGetScenePresence(avatarId, out avatar)) { scene = mScene; return true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 88bdf31..46eadee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -680,7 +680,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) // TODO can there be a SOP without a SOG? { ScenePresence avatar; - if (m_parentGroup.Scene.TryGetAvatar(m_sitTargetAvatar, out avatar)) + if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) { avatar.ParentPosition = GetWorldPosition(); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs index 840039c..dd9f8f6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests throw new NotImplementedException(); } - public override bool TryGetAvatar(UUID agentID, out ScenePresence scenePresence) + public override bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence) { throw new NotImplementedException(); } diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index b85bac6..2fcc477 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -520,7 +520,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge // protected void AnnounceToAgentsRegion(Scene scene, string msg) // { // ScenePresence agent = null; - // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent)) + // if ((client.Scene is Scene) && (client.Scene as Scene).TryGetScenePresence(client.AgentId, out agent)) // AnnounceToAgentsRegion(agent, msg); // else // m_log.DebugFormat("[Concierge]: could not find an agent for client {0}", client.Name); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 6e742f1..ab0be77 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -110,7 +110,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (m_avatars.ContainsKey(agentID)) { ScenePresence sp; - scene.TryGetAvatar(agentID, out sp); + scene.TryGetScenePresence(agentID, out sp); sp.DoAutoPilot(0, pos, m_avatars[agentID]); } } @@ -165,7 +165,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC p_scene.AddNewClient(npcAvatar); ScenePresence sp; - if (p_scene.TryGetAvatar(npcAvatar.AgentId, out sp)) + if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) { AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 6cbf260..2296379 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -472,7 +472,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { ScenePresence sp; // Try direct lookup by UUID - if(!m_CmdManager.m_ScriptEngine.World.TryGetAvatar(ts.keyID, out sp)) + if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp)) return sensedEntities; senseEntity(sp); } -- cgit v1.1 From f020bd3206c653d7b03f5fbc66ca5ef864fc95e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 20 Mar 2010 15:49:39 +0000 Subject: Fix a nullref in permissions when returning objects via right-click --- OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 4dbdb01..0f830e1 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -1324,9 +1324,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions // Group voodoo // - if (land.LandData.IsGroupOwned) + if (l.LandData.IsGroupOwned) { - powers = (GroupPowers)client.GetGroupPowers(land.LandData.GroupID); + powers = (GroupPowers)client.GetGroupPowers(l.LandData.GroupID); // Not a group member, or no rights at all // if (powers == (GroupPowers)0) -- cgit v1.1 From 70b0e07d1ea99f8bd88f2be12bf9b53a39187f60 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Mar 2010 18:49:56 +0000 Subject: Remove the reading of estate_settings.xml and the associated processing of defaults. Adding code to facilitate estate creation / managemment as part of first time start up --- OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 668ff98..6861544 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -34,7 +34,7 @@ namespace OpenSim.Region.Framework.Interfaces { void Initialise(string connectstring); - EstateSettings LoadEstateSettings(UUID regionID); + EstateSettings LoadEstateSettings(UUID regionID, bool create); void StoreEstateSettings(EstateSettings es); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2080687..078cf03 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -604,7 +604,7 @@ namespace OpenSim.Region.Framework.Scenes m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); if (m_storageManager.EstateDataStore != null) { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID); + m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true); } //Bind Storage Manager functions to some land manager functions for this scene -- cgit v1.1 From dcf18689b9ab29d4ceb2348bb56fc1f77a7a8912 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 23 Mar 2010 02:05:56 +0000 Subject: First stage of the new interactive region creation. This will allow creation of a region and joining it to an existing estate or creating a new estate, as well as creating an estate owner if in standalone, and assigning estate owners. In Grid mode, existing users must be used. MySQL ONLY!!!! so far, as I can't develop or test for either SQLite or MSSQL. --- .../Framework/Interfaces/IEstateDataStore.cs | 6 ++ OpenSim/Region/Framework/Scenes/Scene.cs | 115 ++++++++++++++++++++- 2 files changed, 120 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 6861544..87c7a05 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; @@ -35,6 +36,11 @@ namespace OpenSim.Region.Framework.Interfaces void Initialise(string connectstring); EstateSettings LoadEstateSettings(UUID regionID, bool create); + EstateSettings LoadEstateSettings(int estateID); void StoreEstateSettings(EstateSettings es); + List GetEstates(string search); + bool LinkRegion(UUID regionID, int estateID); + List GetRegions(int estateID); + bool DeleteEstate(int estateID); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 078cf03..da81c03 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -604,7 +604,44 @@ namespace OpenSim.Region.Framework.Scenes m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); if (m_storageManager.EstateDataStore != null) { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true); + m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); + if (m_regInfo.EstateSettings.EstateID == 0) // No record at all + { + MainConsole.Instance.Output("Your region is not part of an estate."); + while (true) + { + string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() {"yes", "no"}); + if (response == "no") + { + // Create a new estate + m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true); + + m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName); + m_regInfo.EstateSettings.Save(); + break; + } + else + { + response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); + if (response == "None") + continue; + + List estateIDs = m_storageManager.EstateDataStore.GetEstates(response); + if (estateIDs.Count < 1) + { + MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); + continue; + } + + int estateID = estateIDs[0]; + + if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID)) + break; + + MainConsole.Instance.Output("Joining the estate failed. Please try again."); + } + } + } } //Bind Storage Manager functions to some land manager functions for this scene @@ -1215,6 +1252,82 @@ namespace OpenSim.Region.Framework.Scenes m_dialogModule = RequestModuleInterface(); m_capsModule = RequestModuleInterface(); m_teleportModule = RequestModuleInterface(); + + // Shoving this in here for now, because we have the needed + // interfaces at this point + // + // TODO: Find a better place for this + // + while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero) + { + MainConsole.Instance.Output("The current estate has no owner set."); + string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); + string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); + + UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); + + if (account == null) + { + account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); + if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) + { + account.ServiceURLs = new Dictionary(); + account.ServiceURLs["HomeURI"] = string.Empty; + account.ServiceURLs["GatekeeperURI"] = string.Empty; + account.ServiceURLs["InventoryServerURI"] = string.Empty; + account.ServiceURLs["AssetServerURI"] = string.Empty; + } + + if (UserAccountService.StoreUserAccount(account)) + { + string password = MainConsole.Instance.PasswdPrompt("Password"); + string email = MainConsole.Instance.CmdPrompt("Email", ""); + + account.Email = email; + UserAccountService.StoreUserAccount(account); + + bool success = false; + success = AuthenticationService.SetPassword(account.PrincipalID, password); + if (!success) + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.", + first, last); + + GridRegion home = null; + if (GridService != null) + { + List defaultRegions = GridService.GetDefaultRegions(UUID.Zero); + if (defaultRegions != null && defaultRegions.Count >= 1) + home = defaultRegions[0]; + + if (PresenceService != null && home != null) + PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); + else + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", + first, last); + + } + else + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", + first, last); + + if (InventoryService != null) + success = InventoryService.CreateUserInventory(account.PrincipalID); + if (!success) + m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", + first, last); + + + m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last); + + m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; + m_regInfo.EstateSettings.Save(); + } + } + else + { + MainConsole.Instance.Output("You appear to be connected to a grid and can't create users from here. Please enter the name of an existing user"); + } + } } #endregion -- cgit v1.1 From bfbf25c542ac13b3056261064e14c15844bf94fe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Mar 2010 21:36:57 +0000 Subject: minor: Print out port that http servers are using do this in callers so that we know who is setting up these things --- OpenSim/Region/ClientStack/RegionApplicationBase.cs | 6 +++--- OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 0ec87e5..e683821 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -98,10 +98,10 @@ namespace OpenSim.Region.ClientStack if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) { - m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); + m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); } - m_log.Info("[REGION]: Starting HTTP server"); + m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); m_httpServer.Start(); MainServer.Instance = m_httpServer; @@ -129,4 +129,4 @@ namespace OpenSim.Region.ClientStack return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index 27b64bf..40ffcb4 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs @@ -131,8 +131,8 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC { // Start http server // Attach xmlrpc handlers - m_log.Info("[REMOTE_DATA]: " + - "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); + m_log.Info("[XML RPC MODULE]: " + + "Starting up XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort); httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); httpServer.Start(); @@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC // This should no longer happen, but the check is reasonable anyway if (null == m_openChannels) { - m_log.Warn("[RemoteDataReply] Attempt to open channel before initialization is complete"); + m_log.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete"); return newChannel; } @@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC } else { - m_log.Warn("[RemoteDataReply]: Channel or message_id not found"); + m_log.Warn("[XML RPC MODULE]: Channel or message_id not found"); } } @@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC } else { - m_log.Error("UNABLE TO REMOVE COMPLETED REQUEST"); + m_log.Error("[XML RPC MODULE]: UNABLE TO REMOVE COMPLETED REQUEST"); } } } @@ -728,4 +728,4 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC return ReqID; } } -} +} \ No newline at end of file -- cgit v1.1 From 19c659ca99349a974564d87fcdf42a2c66d2a875 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Mar 2010 21:46:23 +0000 Subject: fix unit tests broken by commit dcf18689b9ab29d4ceb2348bb56fc1f77a7a8912 can't prompt for estate owner in unit tests --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index da81c03..6495899 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1258,7 +1258,7 @@ namespace OpenSim.Region.Framework.Scenes // // TODO: Find a better place for this // - while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero) + while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) { MainConsole.Instance.Output("The current estate has no owner set."); string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); -- cgit v1.1 From f0703cad2ce6894ef2ccbf6a9c3cc93fe3c960b6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Mar 2010 22:47:52 +0000 Subject: add get group by name method to IGroupsModule --- .../Region/Framework/Interfaces/IGroupsModule.cs | 29 +++++++++++++++-- .../Avatar/XmlRpcGroups/GroupsModule.cs | 36 ++++++++++++++++------ .../XmlRpcGroupsServicesConnectorModule.cs | 1 - 3 files changed, 53 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 8980b2d..368f2cd 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs @@ -37,6 +37,30 @@ namespace OpenSim.Region.Framework.Interfaces { event NewGroupNotice OnNewGroupNotice; + /// + /// Create a group + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The UUID of the created group + UUID CreateGroup( + IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, + bool openEnrollment, bool allowPublish, bool maturePublish); + + /// + /// Get a group given its name + /// + /// + /// The group's data. Null if there is no such group. + DirGroupsReplyData? GetGroup(string name); + void ActivateGroup(IClientAPI remoteClient, UUID groupID); List GroupTitlesRequest(IClientAPI remoteClient, UUID groupID); List GroupMembersRequest(IClientAPI remoteClient, UUID groupID); @@ -50,8 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); - void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); - UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); + void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); string GetGroupTitle(UUID avatarID); @@ -67,4 +90,4 @@ namespace OpenSim.Region.Framework.Interfaces GroupRecord GetGroupRecord(UUID GroupID); void NotifyChange(UUID GroupID); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 68e6497..93c2d09 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -328,17 +328,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } */ - void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) { if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); + if (m_debugEnabled) + m_log.DebugFormat( + "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", + System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); // TODO: This currently ignores pretty much all the query flags including Mature and sort order - remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray()); - } - + remoteClient.SendDirGroupsReply( + queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray()); + } } private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) @@ -652,7 +654,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); return data; - } public List GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) @@ -662,8 +663,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); return data; - - } public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) @@ -746,7 +745,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return UUID.Zero; } // is there is a money module present ? - IMoneyModule money=remoteClient.Scene.RequestModuleInterface(); + IMoneyModule money = remoteClient.Scene.RequestModuleInterface(); if (money != null) { // do the transaction, that is if the agent has got sufficient funds @@ -766,6 +765,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return groupID; } + public DirGroupsReplyData? GetGroup(string name) + { + if (m_debugEnabled) + m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + List groups = m_groupData.FindGroups(null, name); + + DirGroupsReplyData? foundGroup = null; + + foreach (DirGroupsReplyData group in groups) + { + // We must have an exact match - I believe FindGroups will return partial matches + if (group.groupName == name) + foundGroup = group; + } + + return foundGroup; + } + public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID groupID) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 964d0bb..2115376 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -470,7 +470,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); } - public List FindGroups(GroupRequestID requestID, string search) { Hashtable param = new Hashtable(); -- cgit v1.1 From 857918d3b032df27e7ee1fe26cebc7421ec4ee0e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Mar 2010 23:53:05 +0000 Subject: minor: some debugging information and spacing changes to group module --- OpenSim/Region/Framework/Interfaces/IGroupsModule.cs | 2 +- .../Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 5 ++++- .../Avatar/XmlRpcGroups/IGroupsServicesConnector.cs | 1 - .../Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 8 +++----- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 368f2cd..e357969 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Interfaces List GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); List GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); - GroupMembershipData[] GetMembershipData(UUID UserID); + GroupMembershipData[] GetMembershipData(UUID UserID); GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 93c2d09..8ea4b93 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -711,7 +711,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + if (m_debugEnabled) + m_log.DebugFormat( + "[GROUPS]: {0} called with groupID={1}, agentID={2}", + System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); return m_groupData.GetAgentGroupMembership(null, agentID, groupID); } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 9e0fa2d..621ab28 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs @@ -55,7 +55,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); - void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); List GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 2115376..af1018f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -47,9 +47,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | GroupPowers.Accountable | @@ -530,7 +528,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return HashTableToGroupMembershipData(respData); } - public List GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) { Hashtable param = new Hashtable(); @@ -777,7 +774,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) { - GroupRecord group = new GroupRecord(); group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); group.GroupName = groupProfile["Name"].ToString(); @@ -796,6 +792,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return group; } + private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) { GroupMembershipData data = new GroupMembershipData(); @@ -828,6 +825,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups data.MembershipFee = int.Parse((string)respData["MembershipFee"]); data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); data.ShowInList = ((string)respData["ShowInList"] == "1"); + return data; } -- cgit v1.1 From 87fe96ae2c48216d006a02ef22392f0838fba17f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Mar 2010 00:10:29 +0000 Subject: replace recent IModule.GetGroup() with better GetGroupRecord(string name) --- .../Region/Framework/Interfaces/IGroupsModule.cs | 14 +++++-- .../Avatar/XmlRpcGroups/GroupsModule.cs | 46 ++++++++++++---------- .../XmlRpcGroupsServicesConnectorModule.cs | 3 -- 3 files changed, 36 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index e357969..2c091e7 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs @@ -55,11 +55,18 @@ namespace OpenSim.Region.Framework.Interfaces bool openEnrollment, bool allowPublish, bool maturePublish); /// - /// Get a group given its name + /// Get a group /// - /// + /// Name of the group /// The group's data. Null if there is no such group. - DirGroupsReplyData? GetGroup(string name); + GroupRecord GetGroupRecord(string name); + + /// + /// Get a group + /// + /// ID of the group + /// The group's data. Null if there is no such group. + GroupRecord GetGroupRecord(UUID GroupID); void ActivateGroup(IClientAPI remoteClient, UUID groupID); List GroupTitlesRequest(IClientAPI remoteClient, UUID groupID); @@ -87,7 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID); - GroupRecord GetGroupRecord(UUID GroupID); void NotifyChange(UUID GroupID); } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 8ea4b93..b011295 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -365,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); } - private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remoteClient) + private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); @@ -595,6 +595,31 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return m_groupData.GetGroupRecord(null, GroupID, null); } + public GroupRecord GetGroupRecord(string name) + { + if (m_debugEnabled) + m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + // XXX: Two call implementation. This could be done in a single call if the server itself were to + // implement the code below. + + List groups = m_groupData.FindGroups(null, name); + + DirGroupsReplyData? foundGroup = null; + + foreach (DirGroupsReplyData group in groups) + { + // We must have an exact match - I believe FindGroups will return partial matches + if (group.groupName == name) + foundGroup = group; + } + + if (null == foundGroup) + return null; + + return GetGroupRecord(((DirGroupsReplyData)foundGroup).groupID); + } + public void ActivateGroup(IClientAPI remoteClient, UUID groupID) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); @@ -768,25 +793,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return groupID; } - public DirGroupsReplyData? GetGroup(string name) - { - if (m_debugEnabled) - m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - - List groups = m_groupData.FindGroups(null, name); - - DirGroupsReplyData? foundGroup = null; - - foreach (DirGroupsReplyData group in groups) - { - // We must have an exact match - I believe FindGroups will return partial matches - if (group.groupName == name) - foundGroup = group; - } - - return foundGroup; - } - public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID groupID) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index af1018f..24ae4f7 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -352,11 +352,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; return MemberGroupProfile; - } - - public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) { Hashtable param = new Hashtable(); -- cgit v1.1 From dd1c1b3bcd89daf2cd47b79d8f46d70a9970f773 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 26 Mar 2010 11:08:14 -0700 Subject: Fixed a backwards null check that was preventing estate owner from being set and a misleading error message (in grid mode it tries to get a user, not create one) --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6495899..7fed1ea 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1266,7 +1266,7 @@ namespace OpenSim.Region.Framework.Scenes UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); - if (account == null) + if (account != null) { account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) @@ -1325,7 +1325,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - MainConsole.Instance.Output("You appear to be connected to a grid and can't create users from here. Please enter the name of an existing user"); + MainConsole.Instance.Output("User account not found. Please enter the name of an existing user"); } } } -- cgit v1.1 From 5a2315c68c7ccac2fafeb7e2cd51ecda863a9fa7 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 26 Mar 2010 12:21:05 -0700 Subject: * Fixed a bug with null value handling in WebUtil.BuildQueryString() * Changed the null check back in estate manager setup but fixed the case for an existing account being found * Implemented SetPassword() in the SimianGrid auth connector --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7fed1ea..8a583c1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1266,8 +1266,9 @@ namespace OpenSim.Region.Framework.Scenes UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); - if (account != null) + if (account == null) { + // Create a new account account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) { @@ -1325,7 +1326,8 @@ namespace OpenSim.Region.Framework.Scenes } else { - MainConsole.Instance.Output("User account not found. Please enter the name of an existing user"); + m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; + m_regInfo.EstateSettings.Save(); } } } -- cgit v1.1 From 05123c6bd5442a7711660fcfb2eedd12c0b82efa Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 26 Mar 2010 12:39:22 -0700 Subject: * Fixed a dictionary value retrieval in GroupsModule --- OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index b011295..eb630de 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -1193,8 +1193,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups else { string domain = string.Empty; //m_sceneList[0].CommsManager.NetworkServersInfo.UserURL; - if (account.ServiceURLs["HomeURI"] != null) - domain = account.ServiceURLs["HomeURI"].ToString(); + object homeUriObj; + if (account.ServiceURLs.TryGetValue("HomeURI", out homeUriObj) && homeUriObj != null) + domain = homeUriObj.ToString(); // They're a local user, use this: info.RequestID.UserServiceURL = domain; } -- cgit v1.1 From efc0916a017b0b1ddbbf226e4b3d3f3e2a1df908 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 27 Mar 2010 22:48:15 -0700 Subject: May fix mantis #4613 --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 71b3062..f570999 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -388,7 +388,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver try { - if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, pass, 1) != string.Empty) + string encpass = Util.Md5Hash(pass); + if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, encpass, 1) != string.Empty) { return account; } -- cgit v1.1 From 607ed61ec2f7b5c3428522ab1b50de640b510dfd Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 28 Mar 2010 23:18:25 +0100 Subject: Stab one bug. When joining an estate with a new region, make sure it's also used on first run and not only later. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8a583c1..0085df3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -635,6 +635,8 @@ namespace OpenSim.Region.Framework.Scenes int estateID = estateIDs[0]; + m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID); + if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID)) break; -- cgit v1.1 From e7e56e0143e8afce8a7aaa44cfe848b2017bd5e4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 29 Mar 2010 19:50:24 +0100 Subject: Remove a redundant method body --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index eb630de..6282272 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -597,27 +597,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public GroupRecord GetGroupRecord(string name) { - if (m_debugEnabled) - m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - - // XXX: Two call implementation. This could be done in a single call if the server itself were to - // implement the code below. - - List groups = m_groupData.FindGroups(null, name); - - DirGroupsReplyData? foundGroup = null; - - foreach (DirGroupsReplyData group in groups) - { - // We must have an exact match - I believe FindGroups will return partial matches - if (group.groupName == name) - foundGroup = group; - } - - if (null == foundGroup) - return null; - - return GetGroupRecord(((DirGroupsReplyData)foundGroup).groupID); + return m_groupData.GetGroupRecord(UUID.Zero, UUID.Zero, name); } public void ActivateGroup(IClientAPI remoteClient, UUID groupID) -- cgit v1.1 From 24fc4703d0b9885102bc59296eb334e7b6d89e0f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 29 Mar 2010 22:02:02 +0100 Subject: fix build break. First argument of GetGroupRecord is not a uuid --- OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 6282272..61c51e0 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -597,7 +597,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public GroupRecord GetGroupRecord(string name) { - return m_groupData.GetGroupRecord(UUID.Zero, UUID.Zero, name); + return m_groupData.GetGroupRecord(null, UUID.Zero, name); } public void ActivateGroup(IClientAPI remoteClient, UUID groupID) -- cgit v1.1 From 696d711d15ce078ad9e96af7c086748b4a860486 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Mar 2010 17:04:26 +0100 Subject: Completely prevent full update packets being sent after kill object packets If a full update is sent after the kill, the object remains as in the linden viewer but in an undeletable and unowned state until relog This patch prevents this by recording kills in LLClientView --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 49 +++++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 18d3889..3b26dde 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -40,7 +40,6 @@ using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Client; - using OpenSim.Framework.Statistics; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -353,6 +352,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected PriorityQueue m_avatarTerseUpdates; private PriorityQueue m_primTerseUpdates; private PriorityQueue m_primFullUpdates; + + /// + /// List used in construction of data blocks for an object update packet. This is to stop us having to + /// continually recreate it. + /// + protected List m_fullUpdateDataBlocksBuilder; + + /// + /// Maintain a record of all the objects killed. This allows us to stop an update being sent from the + /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an + /// ownerless phantom. + /// + /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock + /// + /// + protected HashSet m_killRecord; + private int m_moneyBalance; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; @@ -449,6 +465,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_avatarTerseUpdates = new PriorityQueue(); m_primTerseUpdates = new PriorityQueue(); m_primFullUpdates = new PriorityQueue(m_scene.Entities.Count); + m_fullUpdateDataBlocksBuilder = new List(); + m_killRecord = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); m_hyperAssets = m_scene.RequestModuleInterface(); @@ -1489,7 +1507,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP kill.ObjectData[0].ID = localID; kill.Header.Reliable = true; kill.Header.Zerocoded = true; - OutPacket(kill, ThrottleOutPacketType.State); + + lock (m_primFullUpdates.SyncRoot) + { + m_killRecord.Add(localID); + OutPacket(kill, ThrottleOutPacketType.State); + } } /// @@ -3538,21 +3561,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (count == 0) return; - outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; + m_fullUpdateDataBlocksBuilder.Clear(); + for (int i = 0; i < count; i++) { - outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); + ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); + //outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); + if (!m_killRecord.Contains(block.ID)) + { + m_fullUpdateDataBlocksBuilder.Add(block); + // string text = Util.FieldToString(outPacket.ObjectData[i].Text); // if (text.IndexOf("\n") >= 0) // text = text.Remove(text.IndexOf("\n")); // m_log.DebugFormat( // "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", // outPacket.ObjectData[i].ID, text, Name); + } +// else +// { +// m_log.WarnFormat( +// "[CLIENT]: Preventing full update for {0} after kill to {1}", block.ID, Name); +// } } - } - OutPacket(outPacket, ThrottleOutPacketType.State); + outPacket.ObjectData = m_fullUpdateDataBlocksBuilder.ToArray(); + + OutPacket(outPacket, ThrottleOutPacketType.State); + } } public void SendPrimTerseUpdate(SendPrimitiveTerseData data) -- cgit v1.1 From 8cb81bdc9b3595751cd4c86f963caaf7262d053f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Mar 2010 17:06:30 +0100 Subject: minor: commented out code removal --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3b26dde..9ba99d6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3566,7 +3566,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < count; i++) { ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); - //outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); if (!m_killRecord.Contains(block.ID)) { -- cgit v1.1