From 6a8b8f3168d251d152fdeac007ab7a3f7a280e39 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 2 Dec 2016 22:56:14 +0000 Subject: [PATCH 1/8] change a wrong error message and avoid a null ref (that may happen due to needed time delays) --- .../EntityTransfer/EntityTransferModule.cs | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 33aa7adfc9..a7105e2bb2 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2093,19 +2093,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer spScene.SimulationService.UpdateAgent(neighbour, agentpos); } } - catch (ArgumentOutOfRangeException) - { - m_log.ErrorFormat( - "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", - neighbour.ExternalHostName, - neighbour.RegionHandle, - neighbour.RegionLocX, - neighbour.RegionLocY); - } catch (Exception e) { m_log.ErrorFormat( - "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", + "[ENTITY TRANSFER MODULE]: Error creating child agent at {0} ({1} ({2}, {3}). {4}", neighbour.ExternalHostName, neighbour.RegionHandle, neighbour.RegionLocX, @@ -2279,24 +2270,28 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// /// - private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, + private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData agentCircData, GridRegion reg, IPEndPoint endPoint, bool newAgent) { if (newAgent) { + // we may already had lost this sp + if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened + return; + Scene scene = sp.Scene; m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); - string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); + string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(agentCircData.CapsPath); string reason = String.Empty; EntityTransferContext ctx = new EntityTransferContext(); - bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, ctx, out reason); + bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, agentCircData, (uint)TeleportFlags.Default, ctx, out reason); if (regionAccepted) { @@ -2306,6 +2301,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_eqModule != null) { #region IP Translation for NAT + if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened + return; + IClientIPEndpoint ipepClient; if (sp.ClientView.TryGet(out ipepClient)) { From 2ff75e76920a006e4993013540bb50ef61a2f863 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 3 Dec 2016 18:35:31 +0000 Subject: [PATCH 2/8] ubMeshmerizer, fix the orientation of last triangle on top/bottom faces in case on circle hollow shape --- OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs index 2f97caff60..51d067a19c 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs @@ -718,8 +718,8 @@ namespace PrimMesher } newFace.v1 = 0; - newFace.v2 = numTotalVerts - numHollowVerts; - newFace.v3 = numTotalVerts - 1; + newFace.v2 = numTotalVerts - 1; + newFace.v3 = numTotalVerts - numHollowVerts; faces.Add(newFace); } } From 2a29a270da2cf2c7676437c4b02dad0ed2f4f721 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Sun, 4 Dec 2016 08:26:29 +0100 Subject: [PATCH 3/8] Adding new string-parameter: "region_max_prims" for llGetEnv(string name); Signed-off-by: Mandarinka Tasty Signed-off-by: UbitUmarov --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9c8d40a8a6..763106fb12 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6303,6 +6303,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IUrlModule UrlModule = World.RequestModuleInterface(); return UrlModule.ExternalHostNameForLSL; } + else if (name == "region_max_prims") + { + return World.RegionInfo.ObjectCapacity.ToString(); + } else { return ""; From e1cf34d6fb2d43261ad66262af091574c075f489 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 4 Dec 2016 15:50:48 +0000 Subject: [PATCH 4/8] replace GetDisplaynames by a handler really usable as a client cap. Most capabilities.handlers are so it all things not propor PER CLIENT CAP handlers --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 84 ++++++++++ .../Linden/Caps/GetDisplayNamesModule.cs | 143 ------------------ 2 files changed, 84 insertions(+), 143 deletions(-) delete mode 100644 OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 60bfaa518b..f96ae8b952 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -29,9 +29,11 @@ using System; using System.Timers; using System.Collections; using System.Collections.Generic; +using System.Collections.Specialized; using System.IO; using System.Reflection; using System.Text; +using System.Web; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -125,6 +127,8 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_AllowCapHomeLocation = true; private bool m_AllowCapGroupMemberData = true; + private IUserManagement m_UserManager; + private enum FileAgentInventoryState : int { @@ -196,6 +200,7 @@ namespace OpenSim.Region.ClientStack.Linden m_assetService = m_Scene.AssetService; m_regionName = m_Scene.RegionInfo.RegionName; + m_UserManager = m_Scene.RequestModuleInterface(); RegisterHandlers(); @@ -229,6 +234,7 @@ namespace OpenSim.Region.ClientStack.Linden RegisterRegionServiceHandlers(); RegisterInventoryServiceHandlers(); + RegisterOtherHandlers(); } public void RegisterRegionServiceHandlers() @@ -314,6 +320,19 @@ namespace OpenSim.Region.ClientStack.Linden } } + public void RegisterOtherHandlers() + { + try + { + IRequestHandler GetDisplayNamesHandler = new RestStreamHandler( + "GET", GetNewCapPath(), GetDisplayNames, "GetDisplayNames", null); + m_HostCapsObj.RegisterHandler("GetDisplayNames", GetDisplayNamesHandler); + } + catch (Exception e) + { + m_log.Error("[CAPS]: " + e.ToString()); + } + } /// /// Construct a client response detailing all the capabilities this server can provide. /// @@ -1794,6 +1813,71 @@ namespace OpenSim.Region.ClientStack.Linden response = OSDParser.SerializeLLSDXmlString(resp); return response; } + + public string GetDisplayNames(string request, string path, + string param, IOSHttpRequest httpRequest, + IOSHttpResponse httpResponse) + { + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NoContent; + httpResponse.ContentType = "text/plain"; + + ScenePresence sp = m_Scene.GetScenePresence(m_AgentID); + if(sp == null || sp.IsDeleted) + return ""; + + NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); + string[] ids = query.GetValues("ids"); + + if (m_UserManager == null) + { + m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component"); + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; + return ""; + } + + Dictionary names = m_UserManager.GetUsersNames(ids); + + OSDMap osdReply = new OSDMap(); + OSDArray agents = new OSDArray(); + + osdReply["agents"] = agents; + foreach (KeyValuePair kvp in names) + { + if (string.IsNullOrEmpty(kvp.Value)) + continue; + if(kvp.Key == UUID.Zero) + continue; + + string[] parts = kvp.Value.Split(new char[] {' '}); + OSDMap osdname = new OSDMap(); + if(parts[0] == "Unknown") + { + osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1)); + osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2)); + } + else + { + osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); + osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); + } + osdname["display_name"] = OSD.FromString(kvp.Value); + osdname["legacy_first_name"] = parts[0]; + osdname["legacy_last_name"] = parts[1]; + osdname["username"] = OSD.FromString(kvp.Value); + osdname["id"] = OSD.FromUUID(kvp.Key); + osdname["is_display_name_default"] = OSD.FromBoolean(true); + + agents.Add(osdname); + } + + // Full content request + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK; + //httpResponse.ContentLength = ??; + httpResponse.ContentType = "application/llsd+xml"; + + string reply = OSDParser.SerializeLLSDXmlString(osdReply); + return reply; + } } public class AssetUploader diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs deleted file mode 100644 index bf559d3abe..0000000000 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Drawing; -using System.Drawing.Imaging; -using System.Reflection; -using System.IO; -using System.Web; -using log4net; -using Nini.Config; -using Mono.Addins; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenMetaverse.Imaging; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using Caps = OpenSim.Framework.Capabilities.Caps; -using OpenSim.Capabilities.Handlers; - -namespace OpenSim.Region.ClientStack.Linden -{ - - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetDisplayNamesModule")] - public class GetDisplayNamesModule : INonSharedRegionModule - { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected Scene m_scene; - protected IUserManagement m_UserManager; - - protected bool m_Enabled = false; - - protected string m_URL; - - #region ISharedRegionModule Members - - public virtual void Initialise(IConfigSource source) - { - IConfig config = source.Configs["ClientStack.LindenCaps"]; - if (config == null) - return; - - m_URL = config.GetString("Cap_GetDisplayNames", string.Empty); - if (m_URL != string.Empty) - m_Enabled = true; - } - - public virtual void AddRegion(Scene s) - { - if (!m_Enabled) - return; - - m_scene = s; - } - - public virtual void RemoveRegion(Scene s) - { - if (!m_Enabled) - return; - - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; - m_scene = null; - } - - public virtual void RegionLoaded(Scene s) - { - if (!m_Enabled) - return; - - m_UserManager = m_scene.RequestModuleInterface(); - m_scene.EventManager.OnRegisterCaps += RegisterCaps; - } - - public virtual void PostInitialise() - { - } - - public virtual void Close() { } - - public virtual string Name { get { return "GetDisplayNamesModule"; } } - - public virtual Type ReplaceableInterface - { - get { return null; } - } - - #endregion - - public virtual void RegisterCaps(UUID agentID, Caps caps) - { - if (m_URL == "localhost") - { - string capUrl = "/CAPS/" + UUID.Random() + "/"; -// m_log.DebugFormat("[GET_DISPLAY_NAMES]: {0} in region {1}", capUrl, m_scene.RegionInfo.RegionName); - caps.RegisterHandler( - "GetDisplayNames", - new GetDisplayNamesHandler(capUrl, m_UserManager, "GetDisplayNames", agentID.ToString())); - } - else - { -// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); - IExternalCapsModule handler = m_scene.RequestModuleInterface(); - if (handler != null) - handler.RegisterExternalUserCapsHandler(agentID,caps,"GetDisplayNames", m_URL); - else - caps.RegisterHandler("GetDisplayNames", m_URL); - } - } - - } -} From fcd1e36ed6177f3b3e83d7fd829df3a5325c5e9c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 4 Dec 2016 17:01:49 +0000 Subject: [PATCH 5/8] a few changes to new GetDisplaynames and friends --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index f96ae8b952..2481d11bd7 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -201,6 +201,8 @@ namespace OpenSim.Region.ClientStack.Linden m_assetService = m_Scene.AssetService; m_regionName = m_Scene.RegionInfo.RegionName; m_UserManager = m_Scene.RequestModuleInterface(); + if (m_UserManager == null) + m_log.Error("[CAPS]: GetDisplayNames disabled because user management component not found"); RegisterHandlers(); @@ -324,9 +326,12 @@ namespace OpenSim.Region.ClientStack.Linden { try { - IRequestHandler GetDisplayNamesHandler = new RestStreamHandler( + if (m_UserManager != null) + { + IRequestHandler GetDisplayNamesHandler = new RestStreamHandler( "GET", GetNewCapPath(), GetDisplayNames, "GetDisplayNames", null); - m_HostCapsObj.RegisterHandler("GetDisplayNames", GetDisplayNamesHandler); + m_HostCapsObj.RegisterHandler("GetDisplayNames", GetDisplayNamesHandler); + } } catch (Exception e) { @@ -1818,22 +1823,23 @@ namespace OpenSim.Region.ClientStack.Linden string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NoContent; + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.Gone; httpResponse.ContentType = "text/plain"; ScenePresence sp = m_Scene.GetScenePresence(m_AgentID); if(sp == null || sp.IsDeleted) return ""; + if(sp.IsInTransit) + { + httpResponse.StatusCode = (int)System.Net.HttpStatusCode.ServiceUnavailable; + httpResponse.AddHeader("Retry-After","30"); + return ""; + } + NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); string[] ids = query.GetValues("ids"); - if (m_UserManager == null) - { - m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component"); - httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; - return ""; - } Dictionary names = m_UserManager.GetUsersNames(ids); From 7c566dca5a41cd3a9cb0336b00bdf7d63e24d2e9 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Sun, 4 Dec 2016 07:10:13 +0100 Subject: [PATCH 6/8] The new Constant: integer OBJECT_REZZER_KEY = 32; Signed-off-by: Mandarinka Tasty Signed-off-by: UbitUmarov --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 9 +++++++-- OpenSim/Data/MySQL/Resources/RegionStore.migrations | 8 ++++++++ OpenSim/Data/SQLite/Resources/RegionStore.migrations | 8 ++++++++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++ OpenSim/Framework/TaskInventoryItem.cs | 11 +++++++++++ .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 ++ .../Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs | 1 + .../InventoryAccess/InventoryAccessModule.cs | 2 ++ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 ++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 1 + OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 ++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 +++++++++- .../Scenes/Serialization/SceneObjectSerializer.cs | 9 +++++++++ .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++++ .../ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 1 + 15 files changed, 76 insertions(+), 3 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index ab24b765a9..2aaa2ff553 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -167,7 +167,7 @@ namespace OpenSim.Data.MySQL "SitTargetOrientY, SitTargetOrientZ, " + "RegionUUID, CreatorID, " + "OwnerID, GroupID, " + - "LastOwnerID, SceneGroupID, " + + "LastOwnerID, RezzerID, SceneGroupID, " + "PayPrice, PayButton1, " + "PayButton2, PayButton3, " + "PayButton4, LoopedSound, " + @@ -207,7 +207,7 @@ namespace OpenSim.Data.MySQL "?SitTargetOrientW, ?SitTargetOrientX, " + "?SitTargetOrientY, ?SitTargetOrientZ, " + "?RegionUUID, ?CreatorID, ?OwnerID, " + - "?GroupID, ?LastOwnerID, ?SceneGroupID, " + + "?GroupID, ?LastOwnerID, ?RezzerID, ?SceneGroupID, " + "?PayPrice, ?PayButton1, ?PayButton2, " + "?PayButton3, ?PayButton4, ?LoopedSound, " + "?LoopedSoundGain, ?TextureAnimation, " + @@ -1279,6 +1279,10 @@ namespace OpenSim.Data.MySQL prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); prim.GroupID = DBGuid.FromDB(row["GroupID"]); prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); + if (row["RezzerID"] != DBNull.Value) + prim.RezzerID = DBGuid.FromDB(row["RezzerID"]); + else + prim.RezzerID = UUID.Zero; // explicit conversion of integers is required, which sort // of sucks. No idea if there is a shortcut here or not. @@ -1682,6 +1686,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); + cmd.Parameters.AddWithValue("RezzerID", prim.RezzerID.ToString()); cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index edc04b9a5e..2108c764b3 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -453,3 +453,11 @@ MODIFY `cloud_scroll_x` float(9,7) NOT NULL DEFAULT '0.20', MODIFY `cloud_scroll_y` float(9,7) NOT NULL DEFAULT '0.01'; COMMIT; + +:VERSION 56 #----- Add RezzerID field in table prims + +BEGIN; + +ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL; + +COMMIT; diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 64624db9b0..eef14d6a46 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -363,3 +363,11 @@ CREATE TABLE IF NOT EXISTS bakedterrain( Heightfield blob); COMMIT; + +:VERSION 35 #----- Add RezzerID field in table prims + +BEGIN; + +ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL; + +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index c1c7b7e8f1..5cfc202384 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -1216,6 +1216,7 @@ namespace OpenSim.Data.SQLite createCol(prims, "OwnerID", typeof(String)); createCol(prims, "GroupID", typeof(String)); createCol(prims, "LastOwnerID", typeof(String)); + createCol(prims, "RezzerID", typeof(String)); createCol(prims, "OwnerMask", typeof(Int32)); createCol(prims, "NextOwnerMask", typeof(Int32)); createCol(prims, "GroupMask", typeof(Int32)); @@ -1679,6 +1680,7 @@ namespace OpenSim.Data.SQLite prim.OwnerID = new UUID((String)row["OwnerID"]); prim.GroupID = new UUID((String)row["GroupID"]); prim.LastOwnerID = new UUID((String)row["LastOwnerID"]); + prim.RezzerID = row["RezzerID"] == DBNull.Value ? UUID.Zero : new UUID((String)row["RezzerID"]); prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); @@ -2125,6 +2127,7 @@ namespace OpenSim.Data.SQLite row["OwnerID"] = prim.OwnerID.ToString(); row["GroupID"] = prim.GroupID.ToString(); row["LastOwnerID"] = prim.LastOwnerID.ToString(); + row["RezzerID"] = prim.RezzerID.ToString(); row["OwnerMask"] = prim.OwnerMask; row["NextOwnerMask"] = prim.NextOwnerMask; row["GroupMask"] = prim.GroupMask; diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 2ec4bd1af3..b195bbe237 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -59,6 +59,7 @@ namespace OpenSim.Framework private int _invType = 0; private UUID _itemID = UUID.Zero; private UUID _lastOwnerID = UUID.Zero; + private UUID _rezzerID = UUID.Zero; private string _name = String.Empty; private uint _nextOwnerMask = FULL_MASK_PERMISSIONS_GENERAL; private UUID _ownerID = UUID.Zero; @@ -254,6 +255,16 @@ namespace OpenSim.Framework } } + public UUID RezzerID + { + get { + return _rezzerID; + } + set { + _rezzerID = value; + } + } + public string Name { get { return _name; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 2481d11bd7..032104d398 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1046,6 +1046,7 @@ namespace OpenSim.Region.ClientStack.Linden prim.OwnerID = owner_id; prim.GroupID = UUID.Zero; prim.LastOwnerID = creatorID; + prim.RezzerID = creatorID; prim.CreationDate = Util.UnixTimeSinceEpoch(); if (grp == null) @@ -1093,6 +1094,7 @@ namespace OpenSim.Region.ClientStack.Linden { grp = new SceneObjectGroup(prim); grp.LastOwnerID = creatorID; + grp.RezzerID = creatorID; } else grp.AddPart(prim); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 769fe285ed..713125cffb 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs @@ -284,6 +284,7 @@ namespace OpenSim.Region.ClientStack.Linden prim.OwnerID = AgentId; prim.GroupID = obj.GroupID; prim.LastOwnerID = prim.OwnerID; + prim.RezzerID = AgentId; prim.CreationDate = Util.UnixTimeSinceEpoch(); prim.Name = obj.Name; prim.Description = ""; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index fa7803f215..771e5fe645 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -981,6 +981,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset. part.LastOwnerID = part.OwnerID; part.OwnerID = remoteClient.AgentId; + part.RezzerID = remoteClient.AgentId; } } @@ -1150,6 +1151,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess part.LastOwnerID = part.OwnerID; part.OwnerID = item.Owner; + part.RezzerID = item.Owner; part.Inventory.ChangeInventoryOwner(item.Owner); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 339fc156f3..daf7741999 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2625,6 +2625,8 @@ namespace OpenSim.Region.Framework.Scenes } group.FromPartID = sourcePart.UUID; + group.RezzerID = group.FromPartID; + if( i == 0) AddNewSceneObject(group, true, curpos, rot, vel); else diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f5f83caad0..579874afb5 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1942,6 +1942,7 @@ namespace OpenSim.Region.Framework.Scenes else { part.LastOwnerID = part.ParentGroup.RootPart.LastOwnerID; + part.RezzerID = part.ParentGroup.RootPart.RezzerID; childParts.Add(part); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6cdbac5e6d..fcbcc3f9f1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -886,6 +886,12 @@ namespace OpenSim.Region.Framework.Scenes set { m_rootPart.LastOwnerID = value; } } + public UUID RezzerID + { + get { return m_rootPart.RezzerID; } + set { m_rootPart.RezzerID = value; } + } + public UUID OwnerID { get { return m_rootPart.OwnerID; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3a06e7df42..b95b5beb52 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -460,7 +460,7 @@ namespace OpenSim.Region.Framework.Scenes m_name = "Object"; CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed); - LastOwnerID = CreatorID = OwnerID = ownerID; + RezzerID = LastOwnerID = CreatorID = OwnerID = ownerID; UUID = UUID.Random(); Shape = shape; OwnershipCost = 0; @@ -484,6 +484,7 @@ namespace OpenSim.Region.Framework.Scenes #region XML Schema + private UUID _rezzerID; private UUID _lastOwnerID; private UUID _ownerID; private UUID _groupID; @@ -1385,6 +1386,12 @@ namespace OpenSim.Region.Framework.Scenes set { _lastOwnerID = value; } } + public UUID RezzerID + { + get { return _rezzerID; } + set { _rezzerID = value; } + } + public uint BaseMask { get { return _baseMask; } @@ -2222,6 +2229,7 @@ namespace OpenSim.Region.Framework.Scenes // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. dupe.LastOwnerID = OwnerID; + dupe.RezzerID = RezzerID; byte[] extraP = new byte[Shape.ExtraParams.Length]; Array.Copy(Shape.ExtraParams, extraP, extraP.Length); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7d3a168f03..0b7379b065 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -428,6 +428,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("GroupID", ProcessGroupID); m_SOPXmlProcessors.Add("OwnerID", ProcessOwnerID); m_SOPXmlProcessors.Add("LastOwnerID", ProcessLastOwnerID); + m_SOPXmlProcessors.Add("RezzerID", ProcessRezzerID); m_SOPXmlProcessors.Add("BaseMask", ProcessBaseMask); m_SOPXmlProcessors.Add("OwnerMask", ProcessOwnerMask); m_SOPXmlProcessors.Add("GroupMask", ProcessGroupMask); @@ -864,6 +865,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); } + private static void ProcessRezzerID(SceneObjectPart obj, XmlReader reader) + { + obj.RezzerID = Util.ReadUUID(reader, "RezzerID"); + } + private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader) { obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); @@ -1452,6 +1458,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID; WriteUUID(writer, "LastOwnerID", lastOwnerID, options); + UUID rezzerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.RezzerID; + WriteUUID(writer, "RezzerID", rezzerID, options); + writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 763106fb12..71e8ca9593 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -13793,6 +13793,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } catch { }; ret.Add(new LSL_Integer(invcount)); break; + case ScriptBaseClass.OBJECT_REZZER_KEY: + ret.Add(new LSL_Key(id)); + break; case ScriptBaseClass.OBJECT_GROUP_TAG: ret.Add(new LSL_String(av.Grouptitle)); break; @@ -13988,6 +13991,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api count += parts[i].Inventory.Count; ret.Add(new LSL_Integer(count)); break; + case ScriptBaseClass.OBJECT_REZZER_KEY: + ret.Add(new LSL_Key(obj.ParentGroup.RezzerID.ToString())); + break; case ScriptBaseClass.OBJECT_GROUP_TAG: ret.Add(new LSL_String(String.Empty)); break; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 48afcc03e1..734d878c86 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -640,6 +640,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int OBJECT_OMEGA = 29; public const int OBJECT_PRIM_COUNT = 30; public const int OBJECT_TOTAL_INVENTORY_COUNT = 31; + public const int OBJECT_REZZER_KEY = 32; public const int OBJECT_GROUP_TAG = 33; public const int OBJECT_TEMP_ATTACHED = 34; From 51104be6d41170bc17d0d24278868b6c1cddfed7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 4 Dec 2016 17:56:47 +0000 Subject: [PATCH 7/8] remove SOG.FromPartID from main code and flag it obsolete --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 +-- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 ++++++- .../Scripting/JsonStore/JsonStoreScriptModule.cs | 2 +- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index daf7741999..61ea8acd0f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2624,8 +2624,7 @@ namespace OpenSim.Region.Framework.Scenes group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; } - group.FromPartID = sourcePart.UUID; - group.RezzerID = group.FromPartID; + group.RezzerID = sourcePart.UUID; if( i == 0) AddNewSceneObject(group, true, curpos, rot, vel); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fcbcc3f9f1..e42b6757f0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1059,7 +1059,12 @@ namespace OpenSim.Region.Framework.Scenes /// /// If not applicable will be UUID.Zero /// - public UUID FromPartID { get; set; } + /// obsolete use RezzerID + public UUID FromPartID + { + get { return RezzerID; } + set {RezzerID = value; } + } /// /// The folder ID that this object was rezzed from, if applicable. diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index e7d461fba6..7a0370a681 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs @@ -783,7 +783,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; } - group.FromPartID = host.RootPart.UUID; + group.RezzerID = host.RootPart.UUID; m_scene.AddNewSceneObject(group, true, curpos, rot, vel); UUID storeID = group.UUID; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a21a0caa4e..19f2d0972b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -4030,8 +4030,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject"); m_host.AddScriptLPS(1); - - return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); + UUID rezID = m_host.ParentGroup.RezzerID; + if(rezID == UUID.Zero || m_host.ParentGroup.Scene.GetScenePresence(rezID) != null) + return new LSL_Key(UUID.Zero.ToString()); + return new LSL_Key(rezID.ToString()); } /// From 181b1ad82b0ec5ca6e1ef107020a81e961f4da56 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 4 Dec 2016 23:02:40 +0000 Subject: [PATCH 8/8] HG: fix the never ending avatar confirmation when 2 users from same grid made friendship on another grid --- .../Avatar/Friends/HGFriendsModule.cs | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 27b737632c..995474910e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -337,7 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (UUID.TryParse(friendID, out id)) return base.FriendshipMessage(friendID); - return "Please confirm this friendship you made while you were away."; + return "Please confirm this friendship you made while you where on another HG grid"; } protected override FriendInfo GetFriend(FriendInfo[] friends, UUID friendID) @@ -456,6 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { // local grid users m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); + DeletePreviousHGRelations(agentID, friendID); base.StoreFriendships(agentID, friendID); return; } @@ -624,6 +625,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } + private void DeletePreviousHGRelations(UUID a1, UUID a2) + { + // Delete any previous friendship relations + FriendInfo[] finfos = null; + finfos = GetFriendsFromCache(a1); + if (finfos != null) + { + foreach (FriendInfo f in finfos) + { + if (f.TheirFlags == -1) + { + if (f.Friend.StartsWith(a2.ToString())) + { + FriendsService.Delete(a1, f.Friend); + // and also the converse + FriendsService.Delete(f.Friend, a1.ToString()); + } + } + } + } + + finfos = GetFriendsFromCache(a1); + if (finfos != null) + { + foreach (FriendInfo f in finfos) + { + if (f.TheirFlags == -1) + { + if (f.Friend.StartsWith(a1.ToString())) + { + FriendsService.Delete(a2, f.Friend); + // and also the converse + FriendsService.Delete(f.Friend, a2.ToString()); + } + } + } + } + } + protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) { Boolean agentIsLocal = true;