aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs53
1 files changed, 36 insertions, 17 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 826a1b0..0608f66 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -588,6 +588,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
588 /// <item><term>estate_name</term> 588 /// <item><term>estate_name</term>
589 /// <description>the name of the estate to join (or to create if it doesn't 589 /// <description>the name of the estate to join (or to create if it doesn't
590 /// already exist)</description></item> 590 /// already exist)</description></item>
591 /// <item><term>region_file</term>
592 /// <description>The name of the file to persist the region specifications to.
593 /// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional)</description></item>
591 /// </list> 594 /// </list>
592 /// 595 ///
593 /// XmlRpcCreateRegionMethod returns 596 /// XmlRpcCreateRegionMethod returns
@@ -701,7 +704,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
701 bool persist = Convert.ToBoolean((string) requestData["persist"]); 704 bool persist = Convert.ToBoolean((string) requestData["persist"]);
702 if (persist) 705 if (persist)
703 { 706 {
704 // default place for region XML files is in the 707 // default place for region configuration files is in the
705 // Regions directory of the config dir (aka /bin) 708 // Regions directory of the config dir (aka /bin)
706 string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); 709 string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
707 try 710 try
@@ -714,19 +717,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController
714 { 717 {
715 // No INI setting recorded. 718 // No INI setting recorded.
716 } 719 }
717 string regionXmlPath = Path.Combine(regionConfigPath, 720
721 string regionIniPath;
722
723 if (requestData.Contains("region_file"))
724 {
725 // Make sure that the file to be created is in a subdirectory of the region storage directory.
726 string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]);
727 string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath));
728 if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath)))
729 regionIniPath = requestedFilePath;
730 else
731 throw new Exception("Invalid location for region file.");
732 }
733 else
734 {
735 regionIniPath = Path.Combine(regionConfigPath,
718 String.Format( 736 String.Format(
719 m_config.GetString("region_file_template", 737 m_config.GetString("region_file_template",
720 "{0}x{1}-{2}.xml"), 738 "{0}x{1}-{2}.ini"),
721 region.RegionLocX.ToString(), 739 region.RegionLocX.ToString(),
722 region.RegionLocY.ToString(), 740 region.RegionLocY.ToString(),
723 regionID.ToString(), 741 regionID.ToString(),
724 region.InternalEndPoint.Port.ToString(), 742 region.InternalEndPoint.Port.ToString(),
725 region.RegionName.Replace(" ", "_").Replace(":", "_"). 743 region.RegionName.Replace(" ", "_").Replace(":", "_").
726 Replace("/", "_"))); 744 Replace("/", "_")));
745 }
746
727 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", 747 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
728 region.RegionID, regionXmlPath); 748 region.RegionID, regionIniPath);
729 region.SaveRegionToFile("dynamic region", regionXmlPath); 749 region.SaveRegionToFile("dynamic region", regionIniPath);
730 } 750 }
731 else 751 else
732 { 752 {
@@ -1700,8 +1720,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1700 destinationItem.CreationDate = item.CreationDate; 1720 destinationItem.CreationDate = item.CreationDate;
1701 destinationItem.Folder = destinationFolder.ID; 1721 destinationItem.Folder = destinationFolder.ID;
1702 1722
1703 inventoryService.AddItem(destinationItem); 1723 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1704 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1724 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1705 1725
1706 // Wear item 1726 // Wear item
1707 AvatarWearable newWearable = new AvatarWearable(); 1727 AvatarWearable newWearable = new AvatarWearable();
@@ -1711,7 +1731,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1711 } 1731 }
1712 else 1732 else
1713 { 1733 {
1714 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); 1734 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
1715 } 1735 }
1716 } 1736 }
1717 } 1737 }
@@ -1753,16 +1773,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1753 destinationItem.CreationDate = item.CreationDate; 1773 destinationItem.CreationDate = item.CreationDate;
1754 destinationItem.Folder = destinationFolder.ID; 1774 destinationItem.Folder = destinationFolder.ID;
1755 1775
1756 inventoryService.AddItem(destinationItem); 1776 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1757 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1777 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1758 1778
1759 // Attach item 1779 // Attach item
1760 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); 1780 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1761 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); 1781 m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
1762 } 1782 }
1763 else 1783 else
1764 { 1784 {
1765 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); 1785 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
1766 } 1786 }
1767 } 1787 }
1768 } 1788 }
@@ -1860,16 +1880,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1860 destinationItem.CreationDate = item.CreationDate; 1880 destinationItem.CreationDate = item.CreationDate;
1861 destinationItem.Folder = extraFolder.ID; 1881 destinationItem.Folder = extraFolder.ID;
1862 1882
1863 inventoryService.AddItem(destinationItem); 1883 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1864 inventoryMap.Add(item.ID, destinationItem.ID); 1884 inventoryMap.Add(item.ID, destinationItem.ID);
1865 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); 1885 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
1866 1886
1867 // Attach item, if original is attached 1887 // Attach item, if original is attached
1868 int attachpoint = avatarAppearance.GetAttachpoint(item.ID); 1888 int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
1869 if (attachpoint != 0) 1889 if (attachpoint != 0)
1870 { 1890 {
1871 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); 1891 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1872 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); 1892 m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
1873 } 1893 }
1874 } 1894 }
1875 } 1895 }
@@ -1888,7 +1908,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1888 private bool CreateDefaultAvatars() 1908 private bool CreateDefaultAvatars()
1889 { 1909 {
1890 // Only load once 1910 // Only load once
1891
1892 if (m_defaultAvatarsLoaded) 1911 if (m_defaultAvatarsLoaded)
1893 { 1912 {
1894 return false; 1913 return false;
@@ -2146,7 +2165,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2146 inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); 2165 inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch());
2147 inventoryItem.Folder = extraFolder.ID; // Parent folder 2166 inventoryItem.Folder = extraFolder.ID; // Parent folder
2148 2167
2149 inventoryService.AddItem(inventoryItem); 2168 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
2150 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); 2169 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
2151 } 2170 }
2152 2171