From bf7e7b2c57d9b1d7d00f76bbae41093eaf267921 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Wed, 16 Apr 2008 03:55:21 +0000 Subject: Thank you very much, Kmeisthax for: This patch makes the "Show in Search" checkbox on the viewer work. Additionally, I also discovered that show-in-search objects use the JointWheel flag, so this patch currently uses that flag. LibSL needs to add a flag to enum LLObject.ObjectFlags, "IncludeSearch = 32768" so we aren't using a legacy flag. Additionally this patch also contains a small fix to BaseHTTPServer that lets the response content-type to be something other than text/html. For some reason this didn't get submitted with the DataSnapshot merge. --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 44 +++++++++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 2 ++ 2 files changed, 46 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 0838387..ea4283f 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -1236,6 +1236,50 @@ namespace OpenSim.Region.Environment.Scenes } } + public void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) + { + LLUUID user = remoteClient.AgentId; + LLUUID objid = null; + SceneObjectPart obj = null; + + List EntityList = GetEntities(); + foreach (EntityBase ent in EntityList) + { + if (ent is SceneObjectGroup) + { + foreach (KeyValuePair subent in ((SceneObjectGroup)ent).Children) + { + if (subent.Value.LocalId == localID) + { + objid = subent.Key; + obj = subent.Value; + } + } + } + } + + //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints + //aka ObjectFlags.JointWheel = IncludeInSearch + + //Permissions model: Object can be REMOVED from search IFF: + // * User owns object + //use CanEditObject + + //Object can be ADDED to search IFF: + // * User owns object + // * Asset/DRM permission bit "modify" is enabled + //use CanEditObjectPosition + + if (IncludeInSearch && PermissionsMngr.CanEditObject(user, objid)) + { + obj.AddFlag(LLObject.ObjectFlags.JointWheel); + } + else if (!IncludeInSearch && PermissionsMngr.CanEditObjectPosition(user, objid)) + { + obj.RemFlag(LLObject.ObjectFlags.JointWheel); + } + } + /// /// Duplicate the given object. /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 957c75c..464926d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1578,6 +1578,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; client.OnPacketStats += AddPacketStats; + client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable; + EventManager.TriggerOnNewClient(client); } -- cgit v1.1