From 8daea4d7c005d746989a5635c71bd11cdb034482 Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Sat, 28 Aug 2010 22:44:18 -0500 Subject: llRot2Euler Tests --- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 358ce22..dfc9aa3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -134,5 +134,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests #endregion + [Test] + // llRot2Euler test. + public void TestllRot2Euler() + { + // 180, 90 and zero degree rotations. + CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 0.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, 0.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 1.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, Math.PI)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 1.0f, 0.0f), new LSL_Types.Vector3(0.0f, 0.0f, Math.PI)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f), new LSL_Types.Vector3(0.0f, 0.0f, 0.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(-0.5f, -0.5f, 0.5f, 0.5f), new LSL_Types.Vector3(0, -Math.PI / 2.0f, Math.PI / 2.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(-0.707107f, 0.0f, 0.0f, -0.707107f), new LSL_Types.Vector3(Math.PI / 2.0f, 0.0f, 0.0f)); + // A couple of messy rotations. + CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 5.651f, -3.1f, 67.023f), new LSL_Types.Vector3(0.037818f, 0.166447f, -0.095595f)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.719188f, -0.408934f, -0.363998f, -0.427841f), new LSL_Types.Vector3(-1.954769f, -0.174533f, 1.151917f)); + } + + private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck) + { + // Call LSL function to convert quaternion rotaion to euler radians. + LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot); + // Check upper and lower bounds of x, y and z. + // This type of check is performed as opposed to comparing for equal numbers, in order to allow slight + // differences in accuracy. + Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail"); + Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail"); + Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail"); + Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail"); + Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); + Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); + } } } -- cgit v1.1 From 8d2e8b7d5c62cfd024ade222e27274e88c85d7d2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Sep 2010 21:28:57 +0100 Subject: minor: remove mono compiler warnings --- .../Avatar/Inventory/Archiver/InventoryArchiveUtils.cs | 2 +- .../CoreModules/Framework/EventQueue/EventQueueHelper.cs | 12 ++++++------ .../Framework/InventoryAccess/HGInventoryAccessModule.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs index 8343091..47e34dc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// public static class InventoryArchiveUtils { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings public static readonly char ESCAPE_CHARACTER = '\\'; diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index 6294935..b62df18 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -54,12 +54,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue }; } - private static byte[] uintToByteArray(uint uIntValue) - { - byte[] result = new byte[4]; - Utils.UIntToBytesBig(uIntValue, result, 0); - return result; - } +// private static byte[] uintToByteArray(uint uIntValue) +// { +// byte[] result = new byte[4]; +// Utils.UIntToBytesBig(uIntValue, result, 0); +// return result; +// } public static OSD buildEvent(string eventName, OSD eventBody) { diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index c673b31..125a397 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } // DO NOT OVERRIDE THE BASE METHOD - public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, + public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { UUID assetID = base.DeleteToInventory(action, folderID, new List() {objectGroup}, remoteClient); -- cgit v1.1 From d6deebdd63d16f04a643b1bc26c4ccc4e59f68b7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Sep 2010 21:34:31 +0100 Subject: Add another variant of password hash construction to SimianAuthenticationServiceConnector.CheckPassword() This might be unique to the inventory archiver password check, though at the time it was written, hash construction there should have been identical to other parts of opensim This is from patch http://opensimulator.org/mantis/view.php?id=4983. Thanks cmickeyb. --- .../Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 7a96a05..9c4718e 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -253,7 +253,8 @@ namespace OpenSim.Services.Connectors.SimianGrid if (password == simianGridCredential || "$1$" + password == simianGridCredential || "$1$" + Utils.MD5String(password) == simianGridCredential || - Utils.MD5String(password) == simianGridCredential) + Utils.MD5String(password) == simianGridCredential || + "$1$" + Utils.MD5String(password + ":") == simianGridCredential) { authorizeResult = Authorize(userID); return true; -- cgit v1.1 From 4f79143f3f058b0570c073b668f4ea088e541a43 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 3 Sep 2010 13:36:35 -0700 Subject: * Removed Simian.IsSimianEnabled() call, changed the SimianGrid connectors to handle initialization as graceful as possible with the current broken way region module initialization is done * Added config-include/HyperSimianGrid.ini option for connecting to SimianGrid with HyperGrid enabled (work in progress on the SimianGrid side) --- .../SimianGrid/SimianAssetServiceConnector.cs | 25 +++++------- .../SimianAuthenticationServiceConnector.cs | 24 +++++------- .../SimianGrid/SimianAvatarServiceConnector.cs | 25 +++++------- .../Services/Connectors/SimianGrid/SimianGrid.cs | 14 ------- .../SimianGrid/SimianGridServiceConnector.cs | 22 +++++------ .../SimianGrid/SimianInventoryServiceConnector.cs | 44 +++++++++------------- .../SimianGrid/SimianPresenceServiceConnector.cs | 22 +++++------ .../Connectors/SimianGrid/SimianProfiles.cs | 42 +++++---------------- .../SimianUserAccountServiceConnector.cs | 25 +++++------- 9 files changed, 83 insertions(+), 160 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 616b5a7..3a4f84f 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -85,27 +85,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AssetServices", this.Name)) + IConfig gridConfig = source.Configs["AssetService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["AssetService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); - throw new Exception("Asset connector init error"); - } - string serviceUrl = gridConfig.GetString("AssetServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService"); - throw new Exception("Asset connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); } #region IAssetService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 7a96a05..7f48bbd 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -73,24 +73,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name)) + IConfig gridConfig = source.Configs["AuthenticationService"]; + if (gridConfig != null) { - IConfig assetConfig = source.Configs["AuthenticationService"]; - if (assetConfig == null) + string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); - throw new Exception("Authentication connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - string serviceURI = assetConfig.GetString("AuthenticationServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService"); - throw new Exception("Authentication connector init error"); - } - - m_serverUrl = serviceURI; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); } public string Authenticate(UUID principalID, string password, int lifetime) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 734bdd2..c2e20a3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -78,27 +78,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name)) + IConfig gridConfig = source.Configs["AvatarService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["AvatarService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); - throw new Exception("Avatar connector init error"); - } - string serviceUrl = gridConfig.GetString("AvatarServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService"); - throw new Exception("Avatar connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - if (!serviceUrl.EndsWith("/")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); } #region IAvatarService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs index 7d97aaa..847319c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs @@ -31,17 +31,3 @@ using Nini.Config; [assembly: Addin("SimianGrid", "1.0")] [assembly: AddinDependency("OpenSim", "0.5")] - -public static class Simian -{ - public static bool IsSimianEnabled(IConfigSource config, string moduleName, string connectorName) - { - if (config.Configs["Modules"] != null) - { - string module = config.Configs["Modules"].GetString(moduleName); - return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName); - } - - return false; - } -} \ No newline at end of file diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index fefdad6..9d67ccb 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -98,24 +98,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "GridServices", this.Name)) + IConfig gridConfig = source.Configs["GridService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["GridService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini"); - throw new Exception("Grid connector init error"); - } - string serviceUrl = gridConfig.GetString("GridServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService"); - throw new Exception("Grid connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } #region IGridService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 89c1a5a..63aaad7 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -92,38 +92,30 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name)) + IConfig gridConfig = source.Configs["InventoryService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["InventoryService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); - throw new Exception("Inventory connector init error"); - } - string serviceUrl = gridConfig.GetString("InventoryServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); - throw new Exception("Inventory connector init error"); - } + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; - m_serverUrl = serviceUrl; - - gridConfig = source.Configs["UserAccountService"]; - if (gridConfig != null) - { - serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - m_userServerUrl = serviceUrl; - else - m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService"); - } - else - { - m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini"); + gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) + { + serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + m_userServerUrl = serviceUrl; + } } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector"); + else if (String.IsNullOrEmpty(m_userServerUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } /// diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index ca23e27..778f3f4 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -103,24 +103,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "PresenceServices", this.Name)) + IConfig gridConfig = source.Configs["PresenceService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["PresenceService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); - throw new Exception("Presence connector init error"); - } - string serviceUrl = gridConfig.GetString("PresenceServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService"); - throw new Exception("Presence connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - m_serverUrl = serviceUrl; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } #region IPresenceService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index d30d880..a817d7c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -88,44 +88,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector")) + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["UserAccountService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini"); - throw new Exception("Profiles init error"); - } - string serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) - { - m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService"); - throw new Exception("Profiles init error"); - } - - if (!serviceUrl.EndsWith("/")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; - IConfig profilesConfig = source.Configs["Profiles"]; - if (profilesConfig == null) + if (!String.IsNullOrEmpty(serviceUrl)) { - // Do not run this module by default. - return; - } - else - { - // if profiles aren't enabled, we're not needed. - // if we're not specified as the connector to use, then we're not wanted - if (profilesConfig.GetString("Module", String.Empty) != Name) - { - - return; - } - m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PROFILES]: No UserAccountServerURI specified, disabling connector"); } private void ClientConnectHandler(IClientCore clientCore) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 56c73ec..4c8662f 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -77,25 +77,20 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name)) + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) { - IConfig assetConfig = source.Configs["UserAccountService"]; - if (assetConfig == null) + string serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); - throw new Exception("User account connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - string serviceURI = assetConfig.GetString("UserAccountServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector"); - throw new Exception("User account connector init error"); - } - - m_accountCache = new ExpiringCache(); - m_serverUrl = serviceURI; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) -- cgit v1.1 From fe63fad394b89314777f2c2713c349b3a3017256 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Sep 2010 22:26:15 +0100 Subject: minor: remove mono compiler warning --- OpenSim/Services/InventoryService/HGInventoryService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs index 6e6b019..d62c008 100644 --- a/OpenSim/Services/InventoryService/HGInventoryService.cs +++ b/OpenSim/Services/InventoryService/HGInventoryService.cs @@ -44,7 +44,7 @@ namespace OpenSim.Services.InventoryService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - protected IXInventoryData m_Database; + protected new IXInventoryData m_Database; public HGInventoryService(IConfigSource config) : base(config) -- cgit v1.1 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 ++++++++++++++++++---- OpenSim/Framework/RegionInfo.cs | 15 +++++++---- 2 files changed, 35 insertions(+), 10 deletions(-) (limited to 'OpenSim') 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 { diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ea1a594..12c58c3 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -805,7 +805,7 @@ namespace OpenSim.Framework IConfig config = source.Configs[RegionName]; if (config != null) - source.Configs.Remove(RegionName); + source.Configs.Remove(config); config = source.AddConfig(RegionName); @@ -864,10 +864,15 @@ namespace OpenSim.Framework return; } - configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, - ignoreIncomingConfiguration, false); - configMember.performConfigurationRetrieve(); - RegionFile = filename; + else if (filename.ToLower().EndsWith(".xml")) + { + configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, + ignoreIncomingConfiguration, false); + configMember.performConfigurationRetrieve(); + RegionFile = filename; + } + else + throw new Exception("Invalid file type for region persistence."); } public void loadConfigurationOptionsFromMe() -- cgit v1.1 From fc062a23afab6d5391960240da3953a5865cc12d Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 3 Sep 2010 14:50:26 -0700 Subject: Make SimianFriendsServiceConnector initialize like the other connectors and gracefully handle the case where it is loaded but disabled #monoaddinslol --- .../SimianGrid/SimianFriendsServiceConnector.cs | 41 ++++++++++------------ 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 89f3594..1afb1e1 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -76,38 +76,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - bool isSimianEnabled = false; - - if (source.Configs["Friends"] != null) - { - string module = source.Configs["Friends"].GetString("Connector"); - isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name); - } - - if (isSimianEnabled) + IConfig gridConfig = source.Configs["FriendsService"]; + if (gridConfig != null) { - IConfig assetConfig = source.Configs["FriendsService"]; - if (assetConfig == null) - { - m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); - throw new Exception("Friends connector init error"); - } - - string serviceURI = assetConfig.GetString("FriendsServerURI"); - if (String.IsNullOrEmpty(serviceURI)) + string serviceUrl = gridConfig.GetString("FriendsServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService"); - throw new Exception("Friends connector init error"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } - - m_serverUrl = serviceURI; } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector"); } #region IFriendsService public FriendInfo[] GetFriends(UUID principalID) { + if (String.IsNullOrEmpty(m_serverUrl)) + return new FriendInfo[0]; + Dictionary friends = new Dictionary(); OSDArray friendsArray = GetFriended(principalID); @@ -156,6 +147,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool StoreFriend(UUID principalID, string friend, int flags) { + if (String.IsNullOrEmpty(m_serverUrl)) + return true; + NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "AddGeneric" }, @@ -176,6 +170,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool Delete(UUID principalID, string friend) { + if (String.IsNullOrEmpty(m_serverUrl)) + return true; + NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "RemoveGeneric" }, -- cgit v1.1 From 63617c79d8b37c4e3a93e8071236c9ba9754ded9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Sep 2010 23:29:39 +0100 Subject: minor: remove mono compiler warnings --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 176 ++++++++++----------- .../Client/MXP/PacketHandler/MXPPacketServer.cs | 5 +- .../Inventory/HGInventoryBroker.cs | 2 +- 3 files changed, 91 insertions(+), 92 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index b5b2508..af9478e 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -305,94 +305,94 @@ namespace OpenSim.Client.MXP.ClientStack #region MXP Outgoing Message Processing - private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) - { - String typeName = ToOmType(primShape.PCode); - m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); - - PerceptionEventMessage pe = new PerceptionEventMessage(); - pe.ObjectFragment.ObjectId = objectID.Guid; - - pe.ObjectFragment.ParentObjectId = Guid.Empty; - - // Resolving parent UUID. - OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; - if (scene.Entities.ContainsKey(parentID)) - { - pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; - } - - pe.ObjectFragment.ObjectIndex = localID; - pe.ObjectFragment.ObjectName = typeName + " Object"; - pe.ObjectFragment.OwnerId = ownerID.Guid; - pe.ObjectFragment.TypeId = Guid.Empty; - pe.ObjectFragment.TypeName = typeName; - pe.ObjectFragment.Acceleration = ToOmVector(acc); - pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); - pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); - pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); - - pe.ObjectFragment.Location = ToOmVector(pos); - - pe.ObjectFragment.Mass = 1.0f; - pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); - pe.ObjectFragment.Velocity =ToOmVector(vel); - - OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); - - if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) - { - - ext.PathBegin = primShape.PathBegin; - ext.PathEnd = primShape.PathEnd; - ext.PathScaleX = primShape.PathScaleX; - ext.PathScaleY = primShape.PathScaleY; - ext.PathShearX = primShape.PathShearX; - ext.PathShearY = primShape.PathShearY; - ext.PathSkew = primShape.PathSkew; - ext.ProfileBegin = primShape.ProfileBegin; - ext.ProfileEnd = primShape.ProfileEnd; - ext.PathCurve = primShape.PathCurve; - ext.ProfileCurve = primShape.ProfileCurve; - ext.ProfileHollow = primShape.ProfileHollow; - ext.PathRadiusOffset = primShape.PathRadiusOffset; - ext.PathRevolutions = primShape.PathRevolutions; - ext.PathTaperX = primShape.PathTaperX; - ext.PathTaperY = primShape.PathTaperY; - ext.PathTwist = primShape.PathTwist; - ext.PathTwistBegin = primShape.PathTwistBegin; - - - } - - ext.UpdateFlags = flags; - ext.ExtraParams = primShape.ExtraParams; - ext.State = primShape.State; - ext.TextureEntry = primShape.TextureEntry; - ext.TextureAnim = textureanim; - ext.Scale = ToOmVector(primShape.Scale); - ext.Text = text; - ext.TextColor = ToOmColor(textColor); - ext.PSBlock = particleSystem; - ext.ClickAction = clickAction; - ext.Material = material; - - pe.SetExtension(ext); - - Session.Send(pe); - - if (m_objectsSynchronized != -1) - { - m_objectsSynchronized++; - - if (m_objectsToSynchronize >= m_objectsSynchronized) - { - SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); - Session.Send(synchronizationEndEventMessage); - m_objectsSynchronized = -1; - } - } - } +// private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) +// { +// String typeName = ToOmType(primShape.PCode); +// m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); +// +// PerceptionEventMessage pe = new PerceptionEventMessage(); +// pe.ObjectFragment.ObjectId = objectID.Guid; +// +// pe.ObjectFragment.ParentObjectId = Guid.Empty; +// +// // Resolving parent UUID. +// OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; +// if (scene.Entities.ContainsKey(parentID)) +// { +// pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; +// } +// +// pe.ObjectFragment.ObjectIndex = localID; +// pe.ObjectFragment.ObjectName = typeName + " Object"; +// pe.ObjectFragment.OwnerId = ownerID.Guid; +// pe.ObjectFragment.TypeId = Guid.Empty; +// pe.ObjectFragment.TypeName = typeName; +// pe.ObjectFragment.Acceleration = ToOmVector(acc); +// pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); +// pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); +// pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); +// +// pe.ObjectFragment.Location = ToOmVector(pos); +// +// pe.ObjectFragment.Mass = 1.0f; +// pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); +// pe.ObjectFragment.Velocity =ToOmVector(vel); +// +// OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); +// +// if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) +// { +// +// ext.PathBegin = primShape.PathBegin; +// ext.PathEnd = primShape.PathEnd; +// ext.PathScaleX = primShape.PathScaleX; +// ext.PathScaleY = primShape.PathScaleY; +// ext.PathShearX = primShape.PathShearX; +// ext.PathShearY = primShape.PathShearY; +// ext.PathSkew = primShape.PathSkew; +// ext.ProfileBegin = primShape.ProfileBegin; +// ext.ProfileEnd = primShape.ProfileEnd; +// ext.PathCurve = primShape.PathCurve; +// ext.ProfileCurve = primShape.ProfileCurve; +// ext.ProfileHollow = primShape.ProfileHollow; +// ext.PathRadiusOffset = primShape.PathRadiusOffset; +// ext.PathRevolutions = primShape.PathRevolutions; +// ext.PathTaperX = primShape.PathTaperX; +// ext.PathTaperY = primShape.PathTaperY; +// ext.PathTwist = primShape.PathTwist; +// ext.PathTwistBegin = primShape.PathTwistBegin; +// +// +// } +// +// ext.UpdateFlags = flags; +// ext.ExtraParams = primShape.ExtraParams; +// ext.State = primShape.State; +// ext.TextureEntry = primShape.TextureEntry; +// ext.TextureAnim = textureanim; +// ext.Scale = ToOmVector(primShape.Scale); +// ext.Text = text; +// ext.TextColor = ToOmColor(textColor); +// ext.PSBlock = particleSystem; +// ext.ClickAction = clickAction; +// ext.Material = material; +// +// pe.SetExtension(ext); +// +// Session.Send(pe); +// +// if (m_objectsSynchronized != -1) +// { +// m_objectsSynchronized++; +// +// if (m_objectsToSynchronize >= m_objectsSynchronized) +// { +// SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); +// Session.Send(synchronizationEndEventMessage); +// m_objectsSynchronized = -1; +// } +// } +// } public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation) { diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 2098625..7056e01 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs @@ -63,7 +63,7 @@ namespace OpenSim.Client.MXP.PacketHandler private readonly IList m_sessionsToRemove = new List(); private readonly int m_port; - private readonly bool m_accountsAuthenticate; +// private readonly bool m_accountsAuthenticate; private readonly String m_programName; private readonly byte m_programMajorVersion; @@ -76,7 +76,7 @@ namespace OpenSim.Client.MXP.PacketHandler public MXPPacketServer(int port, Dictionary scenes, bool accountsAuthenticate) { m_port = port; - m_accountsAuthenticate = accountsAuthenticate; +// m_accountsAuthenticate = accountsAuthenticate; m_scenes = scenes; @@ -491,7 +491,6 @@ namespace OpenSim.Client.MXP.PacketHandler public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account) { - UUID userId = UUID.Zero; string firstName = ""; string lastName = ""; account = null; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 97161fc..5b4fecb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * -- cgit v1.1 From 107052b23db4d16c8d1d5f8c828da7d6f6afd6b4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Sep 2010 00:09:53 +0100 Subject: Create Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item) The agentID in AddInventoryItem(UUID agentID, InventoryItemBase item) is redundant since it's contained in item.Owner, and it doesn't make sense for agentID != item.Owner, hence the method is deprecated. --- .../Archiver/Tests/InventoryArchiverTests.cs | 6 ++-- .../Inventory/LocalInventoryServiceConnector.cs | 6 ++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 35 +++++++++++++++++----- 3 files changed, 33 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 0218f86..d66a1d0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; @@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; @@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 915b59e..06b40b3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -242,9 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } else { -// m_log.WarnFormat( -// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", -// item.Owner, item.Name); + m_log.WarnFormat( + "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", + item.Owner, item.Name); return false; } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 0674e62..7cedde0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -92,25 +92,44 @@ namespace OpenSim.Region.Framework.Scenes } } - public void AddInventoryItem(UUID AgentID, InventoryItemBase item) + /// + /// Add the given inventory item to a user's inventory. + /// + /// + public void AddInventoryItem(InventoryItemBase item) { if (InventoryService.AddItem(item)) { int userlevel = 0; - if (Permissions.IsGod(AgentID)) + if (Permissions.IsGod(item.Owner)) { userlevel = 1; } - EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); + EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); } else { m_log.WarnFormat( "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", - AgentID, item.Name, item.ID); + item.Owner, item.Name, item.ID); return; - } + } + } + + /// + /// Add the given inventory item to a user's inventory. + /// + /// + /// A + /// + /// + /// A + /// + [Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")] + public void AddInventoryItem(UUID AgentID, InventoryItemBase item) + { + AddInventoryItem(item); } /// @@ -121,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes /// in which the item is to be placed. public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) { - AddInventoryItem(remoteClient.AgentId, item); + AddInventoryItem(item); remoteClient.SendInventoryItemCreateUpdate(item, 0); } @@ -1108,7 +1127,7 @@ namespace OpenSim.Region.Framework.Scenes agentItem.Folder = folderId; - AddInventoryItem(avatarId, agentItem); + AddInventoryItem(agentItem); return agentItem; } @@ -1232,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes { agentItem.Folder = newFolderID; - AddInventoryItem(destID, agentItem); + AddInventoryItem(agentItem); } } -- cgit v1.1 From 8fc68c6d9810a0d229e94a0cefb35086c65dec36 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 3 Sep 2010 17:18:53 -0700 Subject: Added XFF header processing. Untested, for lack of proxy. --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 2 ++ OpenSim/Framework/Util.cs | 28 ++++++++++++++++++++++ OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 12 +++++++++- .../Handlers/Login/LLLoginServiceInConnector.cs | 5 +++- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 +- 5 files changed, 46 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 95c3e6c..d20f8c9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.Specialized; using System.IO; using System.Net; using System.Net.Sockets; @@ -737,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (methodWasFound) { xmlRprcRequest.Params.Add(request.Url); // Param[2] + xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] try { diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index b5d025f..2ac4eb1 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1495,5 +1495,33 @@ namespace OpenSim.Framework } } + /// + /// Gets the client IP address + /// + /// + /// + public static IPEndPoint GetClientIPFromXFF(string xff) + { + if (xff == string.Empty) + return null; + + string[] parts = xff.Split(new char[] { ',' }); + if (parts.Length > 0) + { + try + { + return new IPEndPoint(IPAddress.Parse(parts[0]), 0); + } + catch (Exception e) + { + m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message); + } + } + + return null; + } + + + } } diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 5bb529c..30dc65e 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -52,15 +52,24 @@ namespace OpenSim.Server.Handlers.Login private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private ILoginService m_LocalService; + private bool m_Proxy; - public LLLoginHandlers(ILoginService service) + public LLLoginHandlers(ILoginService service, bool hasProxy) { m_LocalService = service; + m_Proxy = hasProxy; } public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) { Hashtable requestData = (Hashtable)request.Params[0]; + if (m_Proxy && request.Params[3] != null) + { + IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); + if (ep != null) + // Bang! + remoteClient = ep; + } if (requestData != null) { @@ -189,6 +198,7 @@ namespace OpenSim.Server.Handlers.Login return map; } + } } diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 67e8392..16c93c8 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Login private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private ILoginService m_LoginService; + private bool m_Proxy; public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : base(config, server, String.Empty) @@ -81,12 +82,14 @@ namespace OpenSim.Server.Handlers.Login if (loginService == string.Empty) throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); + m_Proxy = serverConfig.GetBoolean("HasProxy", false); + return loginService; } private void InitializeHandlers(IHttpServer server) { - LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); + LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index b740297..3f9bc19 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -104,7 +104,7 @@ namespace OpenSim.Services.LLLoginService m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); - + // These are required; the others aren't if (accountService == string.Empty || authService == string.Empty) throw new Exception("LoginService is missing service specifications"); -- 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 +++++------ .../Agent/AssetTransaction/AssetXferUploader.cs | 4 +- .../Archiver/InventoryArchiveReadRequest.cs | 3 +- .../InventoryAccess/InventoryAccessModule.cs | 2 +- .../Inventory/LocalInventoryServiceConnector.cs | 28 ------------- .../Inventory/RemoteXInventoryServiceConnector.cs | 26 +----------- .../World/Objects/BuySell/BuySellModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 48 ++++++++++++++++++---- 8 files changed, 56 insertions(+), 80 deletions(-) (limited to 'OpenSim') 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); } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index c791cb4..4609738 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); - IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService; - InventoryItemBase item = new InventoryItemBase(); item.Owner = ourClient.AgentId; item.CreatorId = ourClient.AgentId.ToString(); @@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction item.Flags = (uint) wearableType; item.CreationDate = Util.UnixTimeSinceEpoch(); - if (invService.AddItem(item)) + if (m_userTransactions.Manager.MyScene.AddInventoryItem(item)) ourClient.SendInventoryItemCreateUpdate(item, callbackID); else ourClient.SendAlertMessage("Unable to create inventory item"); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 22c84e9..52342ec 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Reset folder ID to the one in which we want to load it item.Folder = loadFolder.ID; - //m_userInfo.AddItem(item); - m_scene.InventoryService.AddItem(item); + m_scene.AddInventoryItem(item); return item; } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 2ac2324..d87f7f1 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item.Name = asset.Name; item.AssetType = asset.Type; - m_Scene.InventoryService.AddItem(item); + m_Scene.AddInventoryItem(item); if (remoteClient != null && item.Owner == remoteClient.AgentId) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 06b40b3..cbd9e05 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -221,34 +221,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // m_log.DebugFormat( // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", // item.Name, item.Owner, item.Folder); - - if (UUID.Zero == item.Folder) - { - InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); - if (f != null) - { -// m_log.DebugFormat( -// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", -// f.Name, (AssetType)f.Type, item.Name); - - item.Folder = f.ID; - } - else - { - f = m_InventoryService.GetRootFolder(item.Owner); - if (f != null) - { - item.Folder = f.ID; - } - else - { - m_log.WarnFormat( - "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", - item.Owner, item.Name); - return false; - } - } - } return m_InventoryService.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 4211fa9..4ab6947 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -227,31 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public bool AddItem(InventoryItemBase item) { if (item == null) - return false; - - if (UUID.Zero == item.Folder) - { - InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType); - if (f != null) - { - item.Folder = f.ID; - } - else - { - f = m_RemoteConnector.GetRootFolder(item.Owner); - if (f != null) - { - item.Folder = f.ID; - } - else - { - m_log.WarnFormat( - "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", - item.Owner, item.Name); - return false; - } - } - } + return false; return m_RemoteConnector.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 8ce6daf..12750c5 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell item.CurrentPermissions |= 16; // Slam! item.CreationDate = Util.UnixTimeSinceEpoch(); - if (m_scene.InventoryService.AddItem(item)) + if (m_scene.AddInventoryItem(item)) { remoteClient.SendInventoryItemCreateUpdate(item, 0); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7cedde0..4e871d9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) { - IMoneyModule money=RequestModuleInterface(); + IMoneyModule money = RequestModuleInterface(); if (money != null) { money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); } - AddInventoryItem(agentID, item); + AddInventoryItem(item); } public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) { - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) return true; else { @@ -96,8 +96,36 @@ namespace OpenSim.Region.Framework.Scenes /// Add the given inventory item to a user's inventory. /// /// - public void AddInventoryItem(InventoryItemBase item) + public bool AddInventoryItem(InventoryItemBase item) { + if (UUID.Zero == item.Folder) + { + InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); + if (f != null) + { +// m_log.DebugFormat( +// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", +// f.Name, (AssetType)f.Type, item.Name); + + item.Folder = f.ID; + } + else + { + f = InventoryService.GetRootFolder(item.Owner); + if (f != null) + { + item.Folder = f.ID; + } + else + { + m_log.WarnFormat( + "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", + item.Owner, item.Name); + return false; + } + } + } + if (InventoryService.AddItem(item)) { int userlevel = 0; @@ -106,6 +134,8 @@ namespace OpenSim.Region.Framework.Scenes userlevel = 1; } EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); + + return true; } else { @@ -113,7 +143,7 @@ namespace OpenSim.Region.Framework.Scenes "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", item.Owner, item.Name, item.ID); - return; + return false; } } @@ -538,7 +568,7 @@ namespace OpenSim.Region.Framework.Scenes itemCopy.SalePrice = item.SalePrice; itemCopy.SaleType = item.SaleType; - if (InventoryService.AddItem(itemCopy)) + if (AddInventoryItem(itemCopy)) { IInventoryAccessModule invAccess = RequestModuleInterface(); if (invAccess != null) @@ -764,8 +794,10 @@ namespace OpenSim.Region.Framework.Scenes item.BasePermissions = baseMask; item.CreationDate = creationDate; - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) + { remoteClient.SendInventoryItemCreateUpdate(item, callbackID); + } else { m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); @@ -1886,7 +1918,7 @@ namespace OpenSim.Region.Framework.Scenes // sets itemID so client can show item as 'attached' in inventory grp.SetFromItemID(item.ID); - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) remoteClient.SendInventoryItemCreateUpdate(item, 0); else m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); -- cgit v1.1 From 9fd98368416ce9514e0926301a1fc20648d9ad59 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 4 Sep 2010 16:39:03 -0700 Subject: Make User Agent Service and Login Service separable. --- OpenSim/Framework/Util.cs | 18 +++++++++- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 26 ++++++++++++-- .../Handlers/Hypergrid/UserAgentServerConnector.cs | 4 ++- .../Server/Handlers/Simulation/AgentHandlers.cs | 19 +--------- .../Hypergrid/UserAgentServiceConnector.cs | 42 ++++++++++++++++------ 5 files changed, 77 insertions(+), 32 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 2ac4eb1..e7a7f49 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1521,7 +1521,23 @@ namespace OpenSim.Framework return null; } - + public static string GetCallerIP(Hashtable req) + { + if (req.ContainsKey("headers")) + { + try + { + Hashtable headers = (Hashtable)req["headers"]; + if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) + return headers["remote_addr"].ToString(); + } + catch (Exception e) + { + m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message); + } + } + return string.Empty; + } } } diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index e50481a..d10d6fc 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -54,9 +54,12 @@ namespace OpenSim.Server.Handlers.Hypergrid private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IUserAgentService m_UserAgentService; - public HomeAgentHandler(IUserAgentService userAgentService) + private string m_LoginServerIP; + + public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP) { m_UserAgentService = userAgentService; + m_LoginServerIP = loginServerIP; } public Hashtable Handler(Hashtable request) @@ -120,6 +123,7 @@ namespace OpenSim.Server.Handlers.Hypergrid string regionname = string.Empty; string gatekeeper_host = string.Empty; int gatekeeper_port = 0; + IPEndPoint client_ipaddress = null; if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) gatekeeper_host = args["gatekeeper_host"].AsString(); @@ -144,6 +148,24 @@ namespace OpenSim.Server.Handlers.Hypergrid if (args.ContainsKey("destination_name") && args["destination_name"] != null) regionname = args["destination_name"].ToString(); + if (args.ContainsKey("client_ip") && args["client_ip"] != null) + { + string ip_str = args["client_ip"].ToString(); + try + { + string callerIP = Util.GetCallerIP(request); + // Verify if this caller has authority to send the client IP + if (callerIP == m_LoginServerIP) + client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0); + else + m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str); + } + catch + { + m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str); + } + } + GridRegion destination = new GridRegion(); destination.RegionID = uuid; destination.RegionLocX = x; @@ -166,7 +188,7 @@ namespace OpenSim.Server.Handlers.Hypergrid OSDMap resp = new OSDMap(2); string reason = String.Empty; - bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); + bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 6b1152b..70157d5 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -66,13 +66,15 @@ namespace OpenSim.Server.Handlers.Hypergrid if (m_HomeUsersService == null) throw new Exception("UserAgent server connector cannot proceed because of missing service"); + string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); + server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); server.AddXmlRPCHandler("verify_client", VerifyClient, false); server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); - server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler); + server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler); } public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 392927a..2997430 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -179,7 +179,7 @@ namespace OpenSim.Server.Handlers.Simulation resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); // Let's also send out the IP address of the caller back to the caller (HG 1.5) - resp["your_ip"] = OSD.FromString(GetCallerIP(request)); + resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request)); // TODO: add reason if not String.Empty? responsedata["int_response_code"] = HttpStatusCode.OK; @@ -355,23 +355,6 @@ namespace OpenSim.Server.Handlers.Simulation m_SimulationService.ReleaseAgent(regionID, id, ""); } - private string GetCallerIP(Hashtable req) - { - if (req.ContainsKey("headers")) - { - try - { - Hashtable headers = (Hashtable)req["headers"]; - if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) - return headers["remote_addr"].ToString(); - } - catch (Exception e) - { - m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message); - } - } - return string.Empty; - } } } diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 7fa086a..5d29087 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -70,16 +70,29 @@ namespace OpenSim.Services.Connectors.Hypergrid public UserAgentServiceConnector(IConfigSource config) { - } + IConfig serviceConfig = config.Configs["UserAgentService"]; + if (serviceConfig == null) + { + m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini"); + throw new Exception("UserAgent connector init error"); + } - public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) - { - // not available over remote calls - reason = "Method not available over remote calls"; - return false; + string serviceURI = serviceConfig.GetString("UserAgentServerURI", + String.Empty); + + if (serviceURI == String.Empty) + { + m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); + throw new Exception("UserAgent connector init error"); + } + m_ServerURL = serviceURI; + + m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); } - public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) + + // The Login service calls this interface with a non-null [client] ipaddress + public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason) { reason = String.Empty; @@ -90,7 +103,7 @@ namespace OpenSim.Services.Connectors.Hypergrid return false; } - string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; + string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); @@ -102,7 +115,7 @@ namespace OpenSim.Services.Connectors.Hypergrid //AgentCreateRequest.Headers.Add("Authorization", authKey); // Fill it in - OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); + OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress); string strBuffer = ""; byte[] buffer = new byte[1]; @@ -199,7 +212,14 @@ namespace OpenSim.Services.Connectors.Hypergrid } - protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination) + + // The simulators call this interface + public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) + { + return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason); + } + + protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress) { OSDMap args = null; try @@ -217,6 +237,8 @@ namespace OpenSim.Services.Connectors.Hypergrid args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); + if (ipaddress != null) + args["client_ip"] = OSD.FromString(ipaddress.Address.ToString()); return args; } -- cgit v1.1 From 953a487f5e18a293acf59bfd590e1f03203494ec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 4 Sep 2010 18:09:17 -0700 Subject: One more debug message to track an issue on Danger grid. --- OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 5d29087..6d3c64a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -66,6 +66,7 @@ namespace OpenSim.Services.Connectors.Hypergrid { m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); } + m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); } public UserAgentServiceConnector(IConfigSource config) -- cgit v1.1 From 68f107b27e37df88618993b8234316288782d15e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 4 Sep 2010 18:46:27 -0700 Subject: Logout the presence if client IP verification fails. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 56ac2c2..49f29ad 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2643,6 +2643,8 @@ namespace OpenSim.Region.Framework.Scenes try { ScenePresence sp = GetScenePresence(agentID); + PresenceService.LogoutAgent(sp.ControllingClient.SessionId); + if (sp != null) sp.ControllingClient.Close(); -- cgit v1.1 From 6a0a878f7c268c6f248588895e232e3d14eb6eb3 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 5 Sep 2010 14:16:42 +0200 Subject: Remove "Dwell" support from core and replace it with calls to methods on IDwellModule --- OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 6 +- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 6 +- OpenSim/Data/SQLite/SQLiteRegionData.cs | 3 - OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | 3 - OpenSim/Framework/LandData.cs | 14 --- .../Serialization/External/LandDataSerializer.cs | 5 +- .../HttpServer/SynchronousRestFormsRequester.cs | 111 ++++++++++----------- .../Region/ClientStack/LindenUDP/LLClientView.cs | 6 +- .../CoreModules/World/Land/LandManagementModule.cs | 13 --- OpenSim/Region/DataSnapshot/LandSnapshot.cs | 7 +- 10 files changed, 72 insertions(+), 102 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index 7ff8737..77b8a10 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs @@ -638,9 +638,9 @@ ELSE //Insert new values string sql = @"INSERT INTO [land] -([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) +([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime]) VALUES -(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; +(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)"; using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlCommand cmd = new SqlCommand(sql, conn)) @@ -954,7 +954,6 @@ VALUES newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); try { @@ -1357,7 +1356,6 @@ VALUES parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); - parameters.Add(_Database.CreateParameter("Dwell", land.Dwell)); return parameters.ToArray(); } diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 04446ce..30253c3 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL "MusicURL, PassHours, PassPrice, SnapshotUUID, " + "UserLocationX, UserLocationY, UserLocationZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " + - "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "?UUID, ?RegionUUID, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " + @@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + - "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ + "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); @@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); newData.AuthBuyerID = authedbuyer; newData.SnapshotID = snapshotID; @@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); - cmd.Parameters.AddWithValue("Dwell", land.Dwell); cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); cmd.Parameters.AddWithValue("MediaType", land.MediaType); cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 8432e74..88699a7 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; row["MediaType"] = land.MediaType; row["MediaDescription"] = land.MediaDescription; row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs index 289fd94..b5ce4c0 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs @@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; } /// diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index f263e67..8d3266b 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -88,7 +88,6 @@ namespace OpenSim.Framework private UUID _snapshotID = UUID.Zero; private Vector3 _userLocation = new Vector3(); private Vector3 _userLookAt = new Vector3(); - private int _dwell = 0; private int _otherCleanTime = 0; private string _mediaType = "none/none"; private string _mediaDescription = ""; @@ -620,18 +619,6 @@ namespace OpenSim.Framework } /// - /// Deprecated idea. Number of visitors ~= free money - /// - public int Dwell { - get { - return _dwell; - } - set { - _dwell = value; - } - } - - /// /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// the parcel and isn't set to the same 'group' as the parcel. /// @@ -703,7 +690,6 @@ namespace OpenSim.Framework landData._userLocation = _userLocation; landData._userLookAt = _userLookAt; landData._otherCleanTime = _otherCleanTime; - landData._dwell = _dwell; landData._mediaType = _mediaType; landData._mediaDescription = _mediaDescription; landData._mediaWidth = _mediaWidth; diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index ff0afc8..fc0387b 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); - landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); + // No longer used here + xtr.ReadElementString("Dwell"); landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); xtr.ReadEndElement(); @@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); - xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); + xtw.WriteElementString("Dwell", "0"); xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); xtw.WriteEndElement(); diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index b2c1c54..0135a6c 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -57,80 +57,77 @@ namespace OpenSim.Framework.Servers.HttpServer { WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + string respstring = String.Empty; - if ((verb == "POST") || (verb == "PUT")) + using (MemoryStream buffer = new MemoryStream()) { - request.ContentType = "text/www-form-urlencoded"; - - MemoryStream buffer = new MemoryStream(); - int length = 0; - using (StreamWriter writer = new StreamWriter(buffer)) + if ((verb == "POST") || (verb == "PUT")) { - writer.Write(obj); - writer.Flush(); - } + request.ContentType = "text/www-form-urlencoded"; - length = (int)obj.Length; - request.ContentLength = length; + int length = 0; + using (StreamWriter writer = new StreamWriter(buffer)) + { + writer.Write(obj); + writer.Flush(); + } - Stream requestStream = null; - try - { - requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); - } - finally - { - // If this is closed, it will be disposed internally, - // but the above write is asynchronous and may hit after - // we're through here. So the thread handling that will - // throw and put us back into the catch above. Isn't - // .NET great? - //if (requestStream != null) - // requestStream.Close(); - // Let's not close this - //buffer.Close(); + length = (int)obj.Length; + request.ContentLength = length; + Stream requestStream = null; + try + { + requestStream = request.GetRequestStream(); + requestStream.Write(buffer.ToArray(), 0, length); + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); + } + finally + { + if (requestStream != null) + requestStream.Close(); + } } - } - - string respstring = String.Empty; - try - { - using (WebResponse resp = request.GetResponse()) + try { +<<<<<<< HEAD:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs if (resp.ContentLength > 0) +======= + using (WebResponse resp = request.GetResponse()) +>>>>>>> e593607... Remove "Dwell" support from core and replace it with calls to methods:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs { - Stream respStream = null; - try + if (resp.ContentLength != 0) { - respStream = resp.GetResponseStream(); - using (StreamReader reader = new StreamReader(respStream)) + Stream respStream = null; + try { - respstring = reader.ReadToEnd(); + respStream = resp.GetResponseStream(); + using (StreamReader reader = new StreamReader(respStream)) + { + respstring = reader.ReadToEnd(); + } + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); + } + finally + { + if (respStream != null) + respStream.Close(); } - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); - } - finally - { - if (respStream != null) - respStream.Close(); } } } - } - catch (System.InvalidOperationException) - { - // This is what happens when there is invalid XML - m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + catch (System.InvalidOperationException) + { + // This is what happens when there is invalid XML + m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + } } return respstring; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3d4269f..9cdc80b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2668,6 +2668,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) { + float dwell = 0.0f; + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + if (dwellModule != null) + dwell = dwellModule.GetDwell(land.GlobalID); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); reply.AgentData.AgentID = m_agentId; reply.Data.ParcelID = parcelID; @@ -2692,7 +2696,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.GlobalZ = pos.Z; reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SnapshotID = land.SnapshotID; - reply.Data.Dwell = land.Dwell; + reply.Data.Dwell = dwell; reply.Data.SalePrice = land.SalePrice; reply.Data.AuctionID = (int)land.AuctionID; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 3e79ec0..268e2ee 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -163,7 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelInfoRequest += ClientOnParcelInfoRequest; - client.OnParcelDwellRequest += ClientOnParcelDwellRequest; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; client.OnPreAgentUpdate += ClientOnPreAgentUpdate; @@ -1487,18 +1486,6 @@ namespace OpenSim.Region.CoreModules.World.Land #endregion - private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient) - { - ILandObject selectedParcel = null; - lock (m_landList) - { - if (!m_landList.TryGetValue(localID, out selectedParcel)) - return; - } - - remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell); - } - private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) { if (parcelID == UUID.Zero) diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs index 64d29f2..b8c90cd 100644 --- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs @@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers ILandChannel landChannel = m_scene.LandChannel; List parcels = landChannel.AllParcels(); + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); if (parcels != null) { @@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers xmlparcel.AppendChild(infouuid); XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); - dwell.InnerText = parcel.Dwell.ToString(); + if (dwellModule != null) + dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString(); + else + dwell.InnerText = "0"; xmlparcel.AppendChild(dwell); //TODO: figure how to figure out teleport system landData.landingType -- cgit v1.1