From b8da15c10448993a0bb81e8d1b1a31250515c1eb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Sep 2010 22:38:40 +0100 Subject: In RemoveAdminPlugin, use a .ini file template in XmlRpcCreateRegionMethod rather than an older XML one This is a patch from http://opensimulator.org/mantis/view.php?id=4973. Thanks randomhuman --- .../RemoteController/RemoteAdminPlugin.cs | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index da3d3c2..c713e19 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -470,6 +470,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController /// estate_name /// the name of the estate to join (or to create if it doesn't /// already exist) + /// region_file + /// The name of the file to persist the region specifications to. + /// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional) /// /// /// XmlRpcCreateRegionMethod returns @@ -583,7 +586,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController bool persist = Convert.ToBoolean((string) requestData["persist"]); if (persist) { - // default place for region XML files is in the + // default place for region configuration files is in the // Regions directory of the config dir (aka /bin) string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); try @@ -596,19 +599,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController { // No INI setting recorded. } - string regionXmlPath = Path.Combine(regionConfigPath, + + string regionIniPath; + + if (requestData.Contains("region_file")) + { + // Make sure that the file to be created is in a subdirectory of the region storage directory. + string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]); + string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath)); + if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath))) + regionIniPath = requestedFilePath; + else + throw new Exception("Invalid location for region file."); + } + else + { + regionIniPath = Path.Combine(regionConfigPath, String.Format( m_config.GetString("region_file_template", - "{0}x{1}-{2}.xml"), + "{0}x{1}-{2}.ini"), region.RegionLocX.ToString(), region.RegionLocY.ToString(), regionID.ToString(), region.InternalEndPoint.Port.ToString(), region.RegionName.Replace(" ", "_").Replace(":", "_"). Replace("/", "_"))); + } + m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", - region.RegionID, regionXmlPath); - region.SaveRegionToFile("dynamic region", regionXmlPath); + region.RegionID, regionIniPath); + region.SaveRegionToFile("dynamic region", regionIniPath); } else { -- cgit v1.1 From 1e8e98a07fdad6cff4be780083b3d9ad2360b8e7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Sep 2010 01:36:26 +0100 Subject: Move code that allows llGiveInvetory() to move item into appropriate system folder up from connectors into Scene.Inventory.cs This fixes the problem for all architectures (hg as well as local and grid) and means we don't have to dupe code between connectors. Not ideal in that it becomes non-modular, but methods in Scene.Inventory.cs should eventually be modularized anyway. --- .../RemoteController/RemoteAdminPlugin.cs | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index c713e19..4b5710a 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -1602,8 +1602,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; - inventoryService.AddItem(destinationItem); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); // Wear item AvatarWearable newWearable = new AvatarWearable(); @@ -1613,7 +1613,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } else { - m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); + m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); } } } @@ -1655,16 +1655,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; - inventoryService.AddItem(destinationItem); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); // Attach item avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); - m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); + m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID); } else { - m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); + m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID); } } } @@ -1762,16 +1762,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = extraFolder.ID; - inventoryService.AddItem(destinationItem); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); inventoryMap.Add(item.ID, destinationItem.ID); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); // Attach item, if original is attached int attachpoint = avatarAppearance.GetAttachpoint(item.ID); if (attachpoint != 0) { avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); - m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); + m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID); } } } @@ -1790,7 +1790,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController private bool CreateDefaultAvatars() { // Only load once - if (m_defaultAvatarsLoaded) { return false; @@ -2048,7 +2047,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); inventoryItem.Folder = extraFolder.ID; // Parent folder - inventoryService.AddItem(inventoryItem); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem); m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); } -- cgit v1.1