From 2b88d8f93f13bcaa88db13c7c12065c729eed4d1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 9 May 2011 00:59:32 +0200 Subject: Add commands to delete objects by name, UUID, creator or owner --- OpenSim/Region/Framework/Scenes/Scene.cs | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 49fbe33..76ab299 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -587,6 +587,19 @@ namespace OpenSim.Region.Framework.Scenes "reload estate", "Reload the estate data", HandleReloadEstate); + MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner", + "delete object owner ", + "Delete object by owner", HandleDeleteObject); + MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator", + "delete object creator ", + "Delete object by creator", HandleDeleteObject); + MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid", + "delete object uuid ", + "Delete object by uuid", HandleDeleteObject); + MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", + "delete object name ", + "Delete object by name", HandleDeleteObject); + //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); @@ -4852,6 +4865,60 @@ namespace OpenSim.Region.Framework.Scenes } } + private void HandleDeleteObject(string module, string[] cmd) + { + if (cmd.Length < 4) + return; + + string mode = cmd[2]; + string o = cmd[3]; + + List deletes = new List(); + + UUID match; + + switch (mode) + { + case "owner": + if (!UUID.TryParse(o, out match)) + return; + ForEachSOG(delegate (SceneObjectGroup g) + { + if (g.OwnerID == match && !g.IsAttachment) + deletes.Add(g); + }); + break; + case "creator": + if (!UUID.TryParse(o, out match)) + return; + ForEachSOG(delegate (SceneObjectGroup g) + { + if (g.RootPart.CreatorID == match && !g.IsAttachment) + deletes.Add(g); + }); + break; + case "uuid": + if (!UUID.TryParse(o, out match)) + return; + ForEachSOG(delegate (SceneObjectGroup g) + { + if (g.UUID == match && !g.IsAttachment) + deletes.Add(g); + }); + break; + case "name": + ForEachSOG(delegate (SceneObjectGroup g) + { + if (g.RootPart.Name == o && !g.IsAttachment) + deletes.Add(g); + }); + break; + } + + foreach (SceneObjectGroup g in deletes) + DeleteSceneObject(g, false); + } + private void HandleReloadEstate(string module, string[] cmd) { if (MainConsole.Instance.ConsoleScene == null || -- cgit v1.1