From 7a31a854083bb9345bbc184e8187fa662e21c5f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Dec 2016 14:48:50 +0000 Subject: show online on profile, if target is in same region.( possible should be done elsewhere) --- OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 5314927..c505d94 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -1010,7 +1010,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if (p != null && p.isNPC) { remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born, - Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 16, + Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 0x10, UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero); remoteClient.SendAvatarInterestsReply(avatarID, 0, "", 0, "Getting into trouble", "Droidspeak"); @@ -1085,6 +1085,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } + // if on same region force online + if(p != null && !p.IsDeleted) + flags |= 0x10; + remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); -- cgit v1.1 From 95d6396300d8788ac3b0e5a3ae2d184016eef9cc Mon Sep 17 00:00:00 2001 From: Jeff Kelley Date: Sun, 22 May 2016 00:57:30 +0200 Subject: Add osDie(key) Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/OSSL_Api.cs | 37 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 ++++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ 3 files changed, 49 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9742119..8ecbaba 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1874,6 +1874,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api "dataserver", resobj, new DetectParams[0])); } + + /// + /// Similar to llDie but given an object UUID + /// + /// + + public void osDie(LSL_Key objectUUID) + { + CheckThreatLevel(ThreatLevel.VeryHigh, "osDie"); + m_host.AddScriptLPS(1); + + UUID objUUID; + if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. + { + OSSLShoutError("osDie() cannot delete objects with invalid UUIDs"); + return; + } + + DeleteObject(objUUID); + } + + private void DeleteObject(UUID objUUID) + { + SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID); + + if (sceneOG == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead. + { + OSSLShoutError("osDie() cannot delete " + objUUID.ToString() + ", object was not found in scene."); + return; + } + + if (sceneOG.OwnerID != m_host.OwnerID) + return; + + World.DeleteSceneObject(sceneOG, false); + } + /// /// Write a notecard directly to the prim's inventory. /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index cf3e6df..7415fea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -317,6 +317,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osForceBreakAllLinks(); /// + /// Similar to llDie but given an object UUID + /// + /// + + void osDie(LSL_Key objectUUID); + + /// /// Check if the given key is an npc /// /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 2e8a76c..c34ccd0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -577,6 +577,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceBreakAllLinks(); } + public void osDie(LSL_Key objectUUID) + { + m_OSSL_Functions.osDie(objectUUID); + } + public LSL_Integer osIsNpc(LSL_Key npc) { return m_OSSL_Functions.osIsNpc(npc); -- cgit v1.1 From 553b326fb2dda6650e5992c06213c54e1730347e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Dec 2016 16:08:25 +0000 Subject: restrict osDie to objects rezzed by the script object group and a few more changes --- .../Shared/Api/Implementation/OSSL_Api.cs | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8ecbaba..87fe287 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1882,33 +1882,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osDie(LSL_Key objectUUID) { - CheckThreatLevel(ThreatLevel.VeryHigh, "osDie"); +// CheckThreatLevel(ThreatLevel.VeryHigh, "osDie"); + // if this is restricted to objects rezzed by this host level can be reduced + + CheckThreatLevel(ThreatLevel.Low, "osDie"); m_host.AddScriptLPS(1); UUID objUUID; - if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. + if (!UUID.TryParse(objectUUID, out objUUID)) { OSSLShoutError("osDie() cannot delete objects with invalid UUIDs"); return; } - DeleteObject(objUUID); - } + // harakiri check + if(objUUID == UUID.Zero) + throw new SelfDeleteException(); - private void DeleteObject(UUID objUUID) - { SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID); - if (sceneOG == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead. - { - OSSLShoutError("osDie() cannot delete " + objUUID.ToString() + ", object was not found in scene."); + if (sceneOG == null || sceneOG.IsDeleted) + return; + + if(sceneOG.IsAttachment) return; - } if (sceneOG.OwnerID != m_host.OwnerID) return; + + // harakiri check + if(sceneOG.UUID == m_host.ParentGroup.UUID) + throw new SelfDeleteException(); - World.DeleteSceneObject(sceneOG, false); + // restrict to objects rezzed by host + if(sceneOG.RezzerID == m_host.ParentGroup.UUID) + World.DeleteSceneObject(sceneOG, false); } /// -- cgit v1.1 From 3056926403fb073d26ba11b3ebbcbd424a948dbf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Dec 2016 16:31:39 +0000 Subject: dont self osDie attachments --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 87fe287..c83682e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1897,7 +1897,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // harakiri check if(objUUID == UUID.Zero) - throw new SelfDeleteException(); + { + if (!m_host.ParentGroup.IsAttachment) + throw new SelfDeleteException(); + return; + } SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID); -- cgit v1.1 From 1fd0178e8e1b1eda61898c87373a5234bd85fde4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Dec 2016 00:08:36 +0000 Subject: give regions a option to block profile web urls, so users are not sent to unknown web sites set by other users --- .../CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index c505d94..1f7db64 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -69,6 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles Dictionary m_classifiedInterest = new Dictionary(); private JsonRpcRequestManager rpc = new JsonRpcRequestManager(); + private bool m_allowUserProfileWebURLs = true; public Scene Scene { @@ -159,7 +160,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles Enabled = false; return; } - + + m_allowUserProfileWebURLs = profileConfig.GetBoolean("AllowUserProfileWebURLs", m_allowUserProfileWebURLs); m_log.Debug("[PROFILES]: Full Profiles Enabled"); ReplaceableInterface = null; Enabled = true; @@ -1089,6 +1091,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(p != null && !p.IsDeleted) flags |= 0x10; + + if(!m_allowUserProfileWebURLs) + props.WebUrl =""; + remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); @@ -1119,6 +1125,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles prop.FirstLifeImageId = newProfile.FirstLifeImage; prop.FirstLifeText = newProfile.FirstLifeAboutText; + if(!m_allowUserProfileWebURLs) + prop.WebUrl =""; + string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); -- cgit v1.1 From 48efbeb8d346a104d673c69eeb03c70abf840178 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Dec 2016 15:14:12 +0000 Subject: set pbs shape acording to mesh number of (material) faces --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 44 ++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 6873325..14a4873 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -994,7 +994,6 @@ namespace OpenSim.Region.ClientStack.Linden pbs.TextureEntry = textureEntry.GetBytes(); - bool hasmesh = false; if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ... { int meshindx = inner_instance_list["mesh"].AsInteger(); @@ -1004,10 +1003,34 @@ namespace OpenSim.Region.ClientStack.Linden pbs.SculptType = (byte)SculptType.Mesh; pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction // data will be requested from asset on rez (i hope) - hasmesh = true; } } + // faces number to pbs shape + switch(face_list.Count) + { + case 1: + case 2: + pbs.ProfileCurve = (byte)ProfileCurve.Circle; + pbs.PathCurve = (byte)PathCurve.Circle; + break; + + case 3: + case 4: + pbs.ProfileCurve = (byte)ProfileCurve.Circle; + pbs.PathCurve = (byte)PathCurve.Line; + break; + case 5: + pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle; + pbs.PathCurve = (byte)PathCurve.Line; + break; + + default: + pbs.ProfileCurve = (byte)ProfileCurve.Square; + pbs.PathCurve = (byte)PathCurve.Line; + break; + } + Vector3 position = inner_instance_list["position"].AsVector3(); Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); @@ -1018,23 +1041,6 @@ namespace OpenSim.Region.ClientStack.Linden // int material = inner_instance_list["material"].AsInteger(); byte material = (byte)Material.Wood; -// no longer used - begin ------------------------ -// int mesh = inner_instance_list["mesh"].AsInteger(); - -// OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; -// int base_mask = permissions["base_mask"].AsInteger(); -// int everyone_mask = permissions["everyone_mask"].AsInteger(); -// UUID creator_id = permissions["creator_id"].AsUUID(); -// UUID group_id = permissions["group_id"].AsUUID(); -// int group_mask = permissions["group_mask"].AsInteger(); -// bool is_owner_group = permissions["is_owner_group"].AsBoolean(); -// UUID last_owner_id = permissions["last_owner_id"].AsUUID(); -// int next_owner_mask = permissions["next_owner_mask"].AsInteger(); -// UUID owner_id = permissions["owner_id"].AsUUID(); -// int owner_mask = permissions["owner_mask"].AsInteger(); -// no longer used - end ------------------------ - - SceneObjectPart prim = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); -- cgit v1.1 From c0a23d36dfa28a3204b31883e1e7bc76b249c8fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Dec 2016 23:48:25 +0000 Subject: GetRegionsByName and GetHypergridRegionByName: detect that provided url is for local grid, and make it a local by region name local search --- OpenSim/Services/GridService/GridService.cs | 29 +++++++++++++++---------- OpenSim/Services/GridService/HypergridLinker.cs | 10 +++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 31a186a..82b910a 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -508,6 +508,7 @@ namespace OpenSim.Services.GridService if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) return null; + bool localGrid = string.IsNullOrWhiteSpace(regionURI); string mapname = regionURI + regionName; bool haveMatch = false; @@ -531,7 +532,7 @@ namespace OpenSim.Services.GridService if(haveMatch) return rinfos; } - + rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID); if (rdatas != null && (rdatas.Count > 0)) { @@ -554,14 +555,16 @@ namespace OpenSim.Services.GridService if(haveMatch) return rinfos; } - - string HGname = regionURI +" "+ regionName; - GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname); - if (r != null) + if(!localGrid) { - if( count == maxNumber) - rinfos.RemoveAt(count - 1); - rinfos.Add(r); + string HGname = regionURI +" "+ regionName; // include space for compatibility + GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname); + if (r != null) + { + if( count == maxNumber) + rinfos.RemoveAt(count - 1); + rinfos.Add(r); + } } } else if (rdatas != null && (rdatas.Count > 0)) @@ -597,11 +600,13 @@ namespace OpenSim.Services.GridService if ((rdatas != null) && (rdatas.Count > 0)) return RegionData2RegionInfo(rdatas[0]); // get the first - string HGname = regionURI +" "+ regionName; - return m_HypergridLinker.LinkRegion(scopeID, HGname); + if(!string.IsNullOrWhiteSpace(regionURI)) + { + string HGname = regionURI +" "+ regionName; + return m_HypergridLinker.LinkRegion(scopeID, HGname); + } } - else - return null; + return null; } public List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index ceb2c6e..185f2ff 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -137,6 +137,12 @@ namespace OpenSim.Services.GridService m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); } + m_ThisGatekeeper = m_ThisGatekeeperURI.AbsoluteUri; + if(m_ThisGatekeeperURI.Port == 80) + m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":80/"; + else if(m_ThisGatekeeperURI.Port == 443) + m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":443/"; + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); @@ -302,6 +308,10 @@ namespace OpenSim.Services.GridService serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/"; else if(uri.Port == 443) serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/"; + + if(serverURI == m_ThisGatekeeper) + serverURI = ""; // local grid, look for region name only + return true; } -- cgit v1.1 From 853e98d3406df55832589091217ef14e27a23ea3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 01:13:07 +0000 Subject: reserve constant OBJECT_ATTACHED_SLOTS_AVAILABLE from mantis 8096. But do not implement it --- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 734d878..903b362 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -643,6 +643,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int OBJECT_REZZER_KEY = 32; public const int OBJECT_GROUP_TAG = 33; public const int OBJECT_TEMP_ATTACHED = 34; + public const int OBJECT_ATTACHED_SLOTS_AVAILABLE = 35; // Pathfinding types public const int OPT_OTHER = -1; -- cgit v1.1 From e2d46c060c4b9557cf596d6d828ddd296fa0af70 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 03:38:20 +0000 Subject: ok.. another try on the HG uri --- OpenSim/Framework/Util.cs | 114 +++++++++++++++++++ .../Grid/RemoteGridServiceConnector.cs | 27 ++++- OpenSim/Services/GridService/GridService.cs | 25 +++-- OpenSim/Services/GridService/HypergridLinker.cs | 121 +-------------------- 4 files changed, 160 insertions(+), 127 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a6fd99f..5d8a5e0 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -414,6 +414,120 @@ namespace OpenSim.Framework return regionCoord << 8; } + public static bool buildHGRegionURI(string inputName, out string serverURI, out string regionName) + { + serverURI = string.Empty; + regionName = string.Empty; + + inputName = inputName.Trim(); + + if (!inputName.StartsWith("http") && !inputName.StartsWith("https")) + { + // Formats: grid.example.com:8002:region name + // grid.example.com:region name + // grid.example.com:8002 + // grid.example.com + + string host; + uint port = 80; + + string[] parts = inputName.Split(new char[] { ':' }); + int indx; + if(parts.Length == 0) + return false; + if (parts.Length == 1) + { + indx = inputName.IndexOf('/'); + if (indx < 0) + serverURI = "http://"+ inputName + "/"; + else + { + serverURI = "http://"+ inputName.Substring(0,indx + 1); + if(indx + 2 < inputName.Length) + regionName = inputName.Substring(indx + 1); + } + } + else + { + host = parts[0]; + + if (parts.Length >= 2) + { + indx = parts[1].IndexOf('/'); + if(indx < 0) + { + // If it's a number then assume it's a port. Otherwise, it's a region name. + if (!UInt32.TryParse(parts[1], out port)) + { + port = 80; + regionName = parts[1]; + } + } + else + { + string portstr = parts[1].Substring(0, indx); + if(indx + 2 < parts[1].Length) + regionName = parts[1].Substring(indx + 1); + if (!UInt32.TryParse(portstr, out port)) + port = 80; + } + } + // always take the last one + if (parts.Length >= 3) + { + regionName = parts[2]; + } + + serverURI = "http://"+ host +":"+ port.ToString() + "/"; + } + } + else + { + // Formats: http://grid.example.com region name + // http://grid.example.com "region name" + // http://grid.example.com + + string[] parts = inputName.Split(new char[] { ' ' }); + + if (parts.Length == 0) + return false; + + serverURI = parts[0]; + + int indx = serverURI.LastIndexOf('/'); + if(indx > 10) + { + if(indx + 2 < inputName.Length) + regionName = inputName.Substring(indx + 1); + serverURI = inputName.Substring(0, indx + 1); + } + else if (parts.Length >= 2) + { + regionName = inputName.Substring(serverURI.Length); + } + } + + // use better code for sanity check + Uri uri; + try + { + uri = new Uri(serverURI); + } + catch + { + return false; + } + + if(!string.IsNullOrEmpty(regionName)) + regionName = regionName.Trim(new char[] { '"', ' ' }); + serverURI = uri.AbsoluteUri; + if(uri.Port == 80) + serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/"; + else if(uri.Port == 443) + serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/"; + return true; + } + public static T Clamp(T x, T min, T max) where T : IComparable { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index e6e3abb..f9ce5e1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -227,11 +227,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return rinfo; } - public GridRegion GetRegionByName(UUID scopeID, string regionName) + public GridRegion GetRegionByName(UUID scopeID, string name) { - GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); + GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name); if (rinfo != null) return rinfo; + + // HG urls should not get here, strip them + string regionName = name; + if(name.Contains(".")) + { + string regionURI = ""; + if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) + return rinfo; + } rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); m_RegionInfoCache.Cache(scopeID, rinfo); @@ -242,7 +251,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { List rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); - List grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber); + + // HG urls should not get here, strip them + // side effect is that local regions with same name as HG may also be found + // this mb good or bad + string regionName = name; + if(name.Contains(".")) + { + string regionURI = ""; + if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) + return rinfo; + } + + List grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber); if (grinfo != null) { diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 82b910a..c51bb8b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -505,11 +505,16 @@ namespace OpenSim.Services.GridService { string regionURI = ""; string regionName = ""; - if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) + if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) return null; - bool localGrid = string.IsNullOrWhiteSpace(regionURI); - string mapname = regionURI + regionName; + string mapname; + bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI); + if(localGrid) + mapname = regionName; + else + mapname = regionURI + regionName; + bool haveMatch = false; if (rdatas != null && (rdatas.Count > 0)) @@ -555,7 +560,7 @@ namespace OpenSim.Services.GridService if(haveMatch) return rinfos; } - if(!localGrid) + if(!localGrid && !string.IsNullOrWhiteSpace(regionURI)) { string HGname = regionURI +" "+ regionName; // include space for compatibility GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname); @@ -592,15 +597,21 @@ namespace OpenSim.Services.GridService { string regionURI = ""; string regionName = ""; - if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) + if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) return null; - string mapname = regionURI + regionName; + string mapname; + bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI); + if(localGrid) + mapname = regionName; + else + mapname = regionURI + regionName; + List rdatas = m_Database.Get(Util.EscapeForLike(mapname), scopeID); if ((rdatas != null) && (rdatas.Count > 0)) return RegionData2RegionInfo(rdatas[0]); // get the first - if(!string.IsNullOrWhiteSpace(regionURI)) + if(!localGrid && !string.IsNullOrWhiteSpace(regionURI)) { string HGname = regionURI +" "+ regionName; return m_HypergridLinker.LinkRegion(scopeID, HGname); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 185f2ff..aa394ce 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -196,123 +196,10 @@ namespace OpenSim.Services.GridService { return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); } - - public bool buildHGRegionURI(string inputName, out string serverURI, out string regionName) + + public bool IsLocalGrid(string serverURI) { - serverURI = string.Empty; - regionName = string.Empty; - - inputName = inputName.Trim(); - - if (!inputName.StartsWith("http") && !inputName.StartsWith("https")) - { - // Formats: grid.example.com:8002:region name - // grid.example.com:region name - // grid.example.com:8002 - // grid.example.com - - string host; - uint port = 80; - - string[] parts = inputName.Split(new char[] { ':' }); - int indx; - if(parts.Length == 0) - return false; - if (parts.Length == 1) - { - indx = inputName.IndexOf('/'); - if (indx < 0) - serverURI = "http://"+ inputName + "/"; - else - { - serverURI = "http://"+ inputName.Substring(0,indx + 1); - if(indx + 2 < inputName.Length) - regionName = inputName.Substring(indx + 1); - } - } - else - { - host = parts[0]; - - if (parts.Length >= 2) - { - indx = parts[1].IndexOf('/'); - if(indx < 0) - { - // If it's a number then assume it's a port. Otherwise, it's a region name. - if (!UInt32.TryParse(parts[1], out port)) - { - port = 80; - regionName = parts[1]; - } - } - else - { - string portstr = parts[1].Substring(0, indx); - if(indx + 2 < parts[1].Length) - regionName = parts[1].Substring(indx + 1); - if (!UInt32.TryParse(portstr, out port)) - port = 80; - } - } - // always take the last one - if (parts.Length >= 3) - { - regionName = parts[2]; - } - - serverURI = "http://"+ host +":"+ port.ToString() + "/"; - } - } - else - { - // Formats: http://grid.example.com region name - // http://grid.example.com "region name" - // http://grid.example.com - - string[] parts = inputName.Split(new char[] { ' ' }); - - if (parts.Length == 0) - return false; - - serverURI = parts[0]; - - int indx = serverURI.LastIndexOf('/'); - if(indx > 10) - { - if(indx + 2 < inputName.Length) - regionName = inputName.Substring(indx + 1); - serverURI = inputName.Substring(0, indx + 1); - } - else if (parts.Length >= 2) - { - regionName = inputName.Substring(serverURI.Length); - } - } - - // use better code for sanity check - Uri uri; - try - { - uri = new Uri(serverURI); - } - catch - { - return false; - } - - if(!string.IsNullOrEmpty(regionName)) - regionName = regionName.Trim(new char[] { '"', ' ' }); - serverURI = uri.AbsoluteUri; - if(uri.Port == 80) - serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/"; - else if(uri.Port == 443) - serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/"; - - if(serverURI == m_ThisGatekeeper) - serverURI = ""; // local grid, look for region name only - - return true; + return serverURI == m_ThisGatekeeper; } public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) @@ -323,7 +210,7 @@ namespace OpenSim.Services.GridService string serverURI = string.Empty; string regionName = string.Empty; - if(!buildHGRegionURI(mapName, out serverURI, out regionName)) + if(!Util.buildHGRegionURI(mapName, out serverURI, out regionName)) { reason = "Wrong URI format for link-region"; return null; -- cgit v1.1 From 61d2fb6a17bc583678a383e1e640671432824ec7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 18:22:07 +0000 Subject: viewers regionhandle are not necessary region identifiers, compensate for that on GetLandData in case one get there --- .../ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index b632146..1273f0d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs @@ -131,7 +131,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land uint rx = 0, ry = 0; Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry); - + rx += x; + ry += y; foreach (Scene s in m_Scenes) { uint t = s.RegionInfo.WorldLocX; @@ -147,6 +148,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land if( ry < t) { // m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from"); + x = rx - s.RegionInfo.WorldLocX; + y = ry - s.RegionInfo.WorldLocY; regionAccess = s.RegionInfo.AccessLevel; return s.GetLandData(x, y); } -- cgit v1.1 From 1ddc90f16ea9e97a77b8f7c92567b03311fa293a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 18:55:13 +0000 Subject: useless change that doesn't fix anything --- .../Services/Connectors/Land/LandServicesConnector.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 7839a68..5e9331e 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs @@ -66,22 +66,31 @@ namespace OpenSim.Services.Connectors public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) { LandData landData = null; - Hashtable hash = new Hashtable(); - hash["region_handle"] = regionHandle.ToString(); - hash["x"] = x.ToString(); - hash["y"] = y.ToString(); IList paramList = new ArrayList(); - paramList.Add(hash); regionAccess = 42; // Default to adult. Better safe... try { uint xpos = 0, ypos = 0; Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos); + GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); if (info != null) // just to be sure { + string targetHandlestr = info.RegionHandle.ToString(); + if( ypos == 0 ) //HG proxy? + { + // this is real region handle on hg proxies hack + targetHandlestr = info.RegionSecret; + } + + Hashtable hash = new Hashtable(); + hash["region_handle"] = targetHandlestr; + hash["x"] = x.ToString(); + hash["y"] = y.ToString(); + paramList.Add(hash); + XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); XmlRpcResponse response = request.Send(info.ServerURI, 10000); if (response.IsFault) -- cgit v1.1 From be490a8312837ae66647a7597c29097a13d1c679 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 19:11:05 +0000 Subject: remove a nonsense option --- OpenSim/Services/GridService/GridService.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index c51bb8b..c5419d5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -57,9 +57,6 @@ namespace OpenSim.Services.GridService protected bool m_AllowDuplicateNames = false; protected bool m_AllowHypergridMapSearch = false; - - protected bool m_SuppressVarregionOverlapCheckOnRegistration = false; - private static Dictionary m_ExtraFeatures = new Dictionary(); public GridService(IConfigSource config) @@ -86,8 +83,6 @@ namespace OpenSim.Services.GridService m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); - m_SuppressVarregionOverlapCheckOnRegistration = gridConfig.GetBoolean("SuppressVarregionOverlapCheckOnRegistration", m_SuppressVarregionOverlapCheckOnRegistration); - // This service is also used locally by a simulator running in grid mode. This switches prevents // inappropriate console commands from being registered suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands); -- cgit v1.1 From 9b9f93c4b2f65e85129e50587a2ee63dd1d4f374 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 20:31:07 +0000 Subject: and yes HG uri again --- OpenSim/Framework/Util.cs | 20 ++++++++++++++ .../Grid/RemoteGridServiceConnector.cs | 32 ++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 5d8a5e0..b622523 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -414,6 +414,26 @@ namespace OpenSim.Framework return regionCoord << 8; } + public static bool checkServiceURI(string uristr, out string serviceURI) + { + serviceURI = string.Empty; + try + { + Uri uri = new Uri(uristr); + serviceURI = uri.AbsoluteUri; + if(uri.Port == 80) + serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":80/"; + else if(uri.Port == 443) + serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":443/"; + return true; + } + catch + { + serviceURI = string.Empty; + } + return false; + } + public static bool buildHGRegionURI(string inputName, out string serverURI, out string regionName) { serverURI = string.Empty; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index f9ce5e1..50e4c8a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid MethodBase.GetCurrentMethod().DeclaringType); private bool m_Enabled = false; + private string m_ThisGatekeeper = string.Empty; private IGridService m_LocalGridService; private IGridService m_RemoteGridService; @@ -118,13 +119,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache); if (m_LocalGridService == null) { - m_log.Error("[REMOTE GRID CONNECTOR]: failed to loar local connector"); + m_log.Error("[REMOTE GRID CONNECTOR]: failed to load local connector"); return false; } if(m_RegionInfoCache == null) m_RegionInfoCache = new RegionInfoCache(); + m_ThisGatekeeper = Util.GetConfigVarFromSections(source, "GatekeeperURI", + new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); + // Legacy. Remove soon! + m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); + + Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper); + return true; } @@ -233,13 +241,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (rinfo != null) return rinfo; - // HG urls should not get here, strip them + // HG urls should not get here, strip them + // side effect is that local regions with same name as HG may also be found + // this mb good or bad string regionName = name; if(name.Contains(".")) { + if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) + return rinfo; // no HG + string regionURI = ""; - if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) - return rinfo; + if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) + return rinfo; // invalid + if(m_ThisGatekeeper != regionURI) + return rinfo; // not local grid } rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); @@ -258,9 +273,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid string regionName = name; if(name.Contains(".")) { + if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) + return rinfo; // no HG + string regionURI = ""; - if(!Util.buildHGRegionURI(name, out regionURI, out regionName)) - return rinfo; + if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) + return rinfo; // invalid + if(m_ThisGatekeeper != regionURI) + return rinfo; // not local grid } List grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber); -- cgit v1.1 From aa9a56d4df25c073c504575eee2dafcb3d08f6d1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 21:15:21 +0000 Subject: dont allow regions to be register on map area reserved for HG links --- OpenSim/Services/GridService/GridService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index c5419d5..aa13a67 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -197,6 +197,9 @@ namespace OpenSim.Services.GridService if (regionInfos.RegionID == UUID.Zero) return "Invalid RegionID - cannot be zero UUID"; + if (regionInfos.RegionLocY <= Constants.MaximumRegionSize) + return "Region location reserved for HG links coord Y must be higher than " + (Constants.MaximumRegionSize/256).ToString(); + String reason = "Region overlaps another region"; List rdatas = m_Database.Get( @@ -290,7 +293,7 @@ namespace OpenSim.Services.GridService // Region reregistering in other coordinates. Delete the old entry m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", - regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); + regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY); try { -- cgit v1.1 From b4bbf4f95d1920af9b6e8dfb01ad66873cab9b8a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Dec 2016 23:28:14 +0000 Subject: review llCastRay V3 phantom detection. Make it ignore physics shape type none as physics engines do. --- .../Shared/Api/Implementation/LSL_Api.cs | 252 +++++++++++---------- 1 file changed, 127 insertions(+), 125 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7efdc62..eeaec42 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -15010,7 +15010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int rejectTypes = 0; int dataFlags = 0; int maxHits = 1; - bool detectPhantom = false; + bool notdetectPhantom = true; for (int i = 0; i < options.Length; i += 2) { if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES) @@ -15020,7 +15020,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS) maxHits = options.GetLSLIntegerItem(i + 1); else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM) - detectPhantom = (options.GetLSLIntegerItem(i + 1) != 0); + notdetectPhantom = (options.GetLSLIntegerItem(i + 1) == 0); } if (maxHits > m_maxHitsInCastRay) maxHits = m_maxHitsInCastRay; @@ -15050,157 +15050,159 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.ForEachSOG( delegate(SceneObjectGroup group) { + if(group.IsDeleted || group.RootPart == null) + return; // Check group filters unless part filters are configured - bool isPhysical = (group.RootPart != null && group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical); + bool isPhysical = (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical); bool isNonphysical = !isPhysical; bool isPhantom = group.IsPhantom || group.IsVolumeDetect; bool isAttachment = group.IsAttachment; - bool doGroup = true; if (isPhysical && rejectPhysical) - doGroup = false; + return; if (isNonphysical && rejectNonphysical) - doGroup = false; - if (isPhantom && detectPhantom) - doGroup = true; + return; + if (isPhantom && notdetectPhantom) + return; if (m_filterPartsInCastRay) - doGroup = true; + return; if (isAttachment && !m_doAttachmentsInCastRay) - doGroup = false; + return; + // Parse object/group if passed filters - if (doGroup) + // Iterate over all prims/parts in object/group + foreach(SceneObjectPart part in group.Parts) { - // Iterate over all prims/parts in object/group - foreach(SceneObjectPart part in group.Parts) + // Check part filters if configured + if (m_filterPartsInCastRay) { - // Check part filters if configured - if (m_filterPartsInCastRay) + // ignore PhysicsShapeType.None as physics engines do + // or we will get into trouble in future + if(part.PhysicsShapeType == (byte)PhysicsShapeType.None) + continue; + isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical); + isNonphysical = !isPhysical; + isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || + (part.VolumeDetectActive); + + if (isPhysical && rejectPhysical) + continue; + if (isNonphysical && rejectNonphysical) + continue; + if (isPhantom && notdetectPhantom) + continue; + } + + // Parse prim/part and project ray if passed filters + Vector3 scalePart = part.Scale; + Vector3 posPart = part.GetWorldPosition(); + Quaternion rotPart = part.GetWorldRotation(); + Quaternion rotPartInv = Quaternion.Inverse(rotPart); + Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart; + Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart; + + // Filter parts by shape bounding boxes + Vector3 shapeBoxMax = new Vector3(0.5f, 0.5f, 0.5f); + if (!part.Shape.SculptEntry) + shapeBoxMax = shapeBoxMax * (new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ)); + shapeBoxMax = shapeBoxMax + (new Vector3(tol, tol, tol)); + if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax)) + { + // Prepare data needed to check for ray hits + RayTrans rayTrans = new RayTrans(); + rayTrans.PartId = part.UUID; + rayTrans.GroupId = part.ParentGroup.UUID; + rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0; + rayTrans.ScalePart = scalePart; + rayTrans.PositionPart = posPart; + rayTrans.RotationPart = rotPart; + rayTrans.ShapeNeedsEnds = true; + rayTrans.Position1Ray = pos1Ray; + rayTrans.Position1RayProj = pos1RayProj; + rayTrans.VectorRayProj = pos2RayProj - pos1RayProj; + + // Get detail level depending on type + int lod = 0; + // Mesh detail level + if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh) + lod = (int)m_meshLodInCastRay; + // Sculpt detail level + else if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh) + lod = (int)m_sculptLodInCastRay; + // Shape detail level + else if (!part.Shape.SculptEntry) + lod = (int)m_primLodInCastRay; + + // Try to get cached mesh if configured + ulong meshKey = 0; + FacetedMesh mesh = null; + if (m_useMeshCacheInCastRay) { - isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical); - isNonphysical = !isPhysical; - isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || (part.VolumeDetectActive); - bool doPart = true; - if (isPhysical && rejectPhysical) - doPart = false; - if (isNonphysical && rejectNonphysical) - doPart = false; - if (isPhantom && detectPhantom) - doPart = true; - if (!doPart) - continue; + meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod)); + lock (m_cachedMeshes) + { + m_cachedMeshes.TryGetValue(meshKey, out mesh); + } } - // Parse prim/part and project ray if passed filters - Vector3 scalePart = part.Scale; - Vector3 posPart = part.GetWorldPosition(); - Quaternion rotPart = part.GetWorldRotation(); - Quaternion rotPartInv = Quaternion.Inverse(rotPart); - Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart; - Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart; - - // Filter parts by shape bounding boxes - Vector3 shapeBoxMax = new Vector3(0.5f, 0.5f, 0.5f); - if (!part.Shape.SculptEntry) - shapeBoxMax = shapeBoxMax * (new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ)); - shapeBoxMax = shapeBoxMax + (new Vector3(tol, tol, tol)); - if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax)) + // Create mesh if no cached mesh + if (mesh == null) { - // Prepare data needed to check for ray hits - RayTrans rayTrans = new RayTrans(); - rayTrans.PartId = part.UUID; - rayTrans.GroupId = part.ParentGroup.UUID; - rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0; - rayTrans.ScalePart = scalePart; - rayTrans.PositionPart = posPart; - rayTrans.RotationPart = rotPart; - rayTrans.ShapeNeedsEnds = true; - rayTrans.Position1Ray = pos1Ray; - rayTrans.Position1RayProj = pos1RayProj; - rayTrans.VectorRayProj = pos2RayProj - pos1RayProj; - - // Get detail level depending on type - int lod = 0; - // Mesh detail level - if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh) - lod = (int)m_meshLodInCastRay; - // Sculpt detail level - else if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh) - lod = (int)m_sculptLodInCastRay; - // Shape detail level - else if (!part.Shape.SculptEntry) - lod = (int)m_primLodInCastRay; - - // Try to get cached mesh if configured - ulong meshKey = 0; - FacetedMesh mesh = null; - if (m_useMeshCacheInCastRay) + // Make an OMV prim to be able to mesh part + Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart); + byte[] sculptAsset = null; + if (omvPrim.Sculpt != null) + sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString()); + + // When part is mesh, get mesh + if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null) { - meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod)); - lock (m_cachedMeshes) - { - m_cachedMeshes.TryGetValue(meshKey, out mesh); - } + AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset); + FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh); + meshAsset = null; } - // Create mesh if no cached mesh - if (mesh == null) + // When part is sculpt, create mesh + // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt. + else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null) { - // Make an OMV prim to be able to mesh part - Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart); - byte[] sculptAsset = null; - if (omvPrim.Sculpt != null) - sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString()); - - // When part is mesh, get mesh - if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null) - { - AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset); - FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh); - meshAsset = null; - } - - // When part is sculpt, create mesh - // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt. - else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null) + IJ2KDecoder imgDecoder = World.RequestModuleInterface(); + if (imgDecoder != null) { - IJ2KDecoder imgDecoder = World.RequestModuleInterface(); - if (imgDecoder != null) + Image sculpt = imgDecoder.DecodeToImage(sculptAsset); + if (sculpt != null) { - Image sculpt = imgDecoder.DecodeToImage(sculptAsset); - if (sculpt != null) - { - mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay); - sculpt.Dispose(); - } + mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay); + sculpt.Dispose(); } - } - - // When part is shape, create mesh - else if (omvPrim.Sculpt == null) - { - if ( - omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 && - omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 && - omvPrim.PrimData.PathSkew == 0.0 && - omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0 - ) - rayTrans.ShapeNeedsEnds = false; - mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay); } + } - // Cache mesh if configured - if (m_useMeshCacheInCastRay && mesh != null) + // When part is shape, create mesh + else if (omvPrim.Sculpt == null) + { + if ( + omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 && + omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 && + omvPrim.PrimData.PathSkew == 0.0 && + omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0 + ) + rayTrans.ShapeNeedsEnds = false; + mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay); + } + + // Cache mesh if configured + if (m_useMeshCacheInCastRay && mesh != null) + { + lock(m_cachedMeshes) { - lock(m_cachedMeshes) - { - if (!m_cachedMeshes.ContainsKey(meshKey)) - m_cachedMeshes.Add(meshKey, mesh); - } + if (!m_cachedMeshes.ContainsKey(meshKey)) + m_cachedMeshes.Add(meshKey, mesh); } } - // Check mesh for ray hits - AddRayInFacetedMesh(mesh, rayTrans, ref rayHits); - mesh = null; } + // Check mesh for ray hits + AddRayInFacetedMesh(mesh, rayTrans, ref rayHits); + mesh = null; } } } -- cgit v1.1 From 389a1652fbd6827e8641b5dafe132cd4b5e849f9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 17 Dec 2016 20:11:34 +0000 Subject: break userprofiles a bit more --- .../Avatar/UserProfiles/UserProfileModule.cs | 188 +++++++++++++-------- 1 file changed, 113 insertions(+), 75 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 1f7db64..57025bf 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -161,7 +161,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } - m_allowUserProfileWebURLs = profileConfig.GetBoolean("AllowUserProfileWebURLs", m_allowUserProfileWebURLs); + m_allowUserProfileWebURLs = profileConfig.GetBoolean("AllowUserProfileWebURLs", m_allowUserProfileWebURLs); + m_log.Debug("[PROFILES]: Full Profiles Enabled"); ReplaceableInterface = null; Enabled = true; @@ -318,37 +319,46 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; IClientAPI remoteClient = (IClientAPI)sender; + Dictionary classifieds = new Dictionary(); UUID targetID; - UUID.TryParse(args[0], out targetID); - + if(!UUID.TryParse(args[0], out targetID) || targetID == UUID.Zero) + return; ScenePresence p = FindPresence(targetID); if (p != null && p.isNPC) { - remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), new Dictionary()); + remoteClient.SendAvatarClassifiedReply(targetID, classifieds); return; } string serverURI = string.Empty; GetUserProfileServerURI(targetID, out serverURI); - UUID creatorId = UUID.Zero; - Dictionary classifieds = new Dictionary(); + if(string.IsNullOrWhiteSpace(serverURI)) + { + remoteClient.SendAvatarClassifiedReply(targetID, classifieds); + return; + } OSDMap parameters= new OSDMap(); - UUID.TryParse(args[0], out creatorId); - parameters.Add("creatorId", OSD.FromUUID(creatorId)); + + parameters.Add("creatorId", OSD.FromUUID(targetID)); OSD Params = (OSD)parameters; if(!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) { - remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); + remoteClient.SendAvatarClassifiedReply(targetID, classifieds); return; } parameters = (OSDMap)Params; - OSDArray list = (OSDArray)parameters["result"]; + if(!parameters.ContainsKey("result") || parameters["result"] == null) + { + remoteClient.SendAvatarClassifiedReply(targetID, classifieds); + return; + } + OSDArray list = (OSDArray)parameters["result"]; foreach(OSD map in list) { @@ -362,7 +372,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { if (!m_classifiedCache.ContainsKey(cid)) { - m_classifiedCache.Add(cid,creatorId); + m_classifiedCache.Add(cid,targetID); m_classifiedInterest.Add(cid, 0); } @@ -370,7 +380,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } } - remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); + remoteClient.SendAvatarClassifiedReply(targetID, classifieds); } public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) @@ -397,6 +407,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string serverURI = string.Empty; GetUserProfileServerURI(target, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + { + return; + } object Ad = (object)ad; if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) @@ -467,6 +481,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + { + return; + } OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}}; OSD Params = (OSD)parameters; @@ -533,10 +551,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + return; UUID classifiedId; + if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId)) + return; + OSDMap parameters= new OSDMap(); - UUID.TryParse(queryClassifiedID.ToString(), out classifiedId); parameters.Add("classifiedId", OSD.FromUUID(classifiedId)); OSD Params = (OSD)parameters; if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString())) @@ -571,33 +593,41 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles IClientAPI remoteClient = (IClientAPI)sender; UUID targetId; - UUID.TryParse(args[0], out targetId); + if(!UUID.TryParse(args[0], out targetId)) + return; - // Can't handle NPC yet... - ScenePresence p = FindPresence(targetId); + Dictionary picks = new Dictionary(); + ScenePresence p = FindPresence(targetId); if (p != null && p.isNPC) { - remoteClient.SendAvatarPicksReply(new UUID(args[0]), new Dictionary()); + remoteClient.SendAvatarPicksReply(targetId, picks); return; } string serverURI = string.Empty; GetUserProfileServerURI(targetId, out serverURI); - - Dictionary picks = new Dictionary(); + if(string.IsNullOrWhiteSpace(serverURI)) + { + remoteClient.SendAvatarPicksReply(targetId, picks); + return; + } OSDMap parameters= new OSDMap(); parameters.Add("creatorId", OSD.FromUUID(targetId)); OSD Params = (OSD)parameters; if(!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString())) { - remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); + remoteClient.SendAvatarPicksReply(targetId, picks); return; } parameters = (OSDMap)Params; - + if(!parameters.ContainsKey("result") || parameters["result"] == null) + { + remoteClient.SendAvatarPicksReply(targetId, picks); + return; + } OSDArray list = (OSDArray)parameters["result"]; foreach(OSD map in list) @@ -605,12 +635,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles OSDMap m = (OSDMap)map; UUID cid = m["pickuuid"].AsUUID(); string name = m["name"].AsString(); - - m_log.DebugFormat("[PROFILES]: PicksRequest {0}", name); - picks[cid] = name; } - remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); + remoteClient.SendAvatarPicksReply(targetId, picks); } /// @@ -630,20 +657,27 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if (!(sender is IClientAPI)) return; + UserProfilePick pick = new UserProfilePick (); UUID targetID; - UUID.TryParse (args [0], out targetID); + if(!UUID.TryParse(args [0], out targetID)) + return; + + pick.CreatorId = targetID; + + if(!UUID.TryParse (args [1], out pick.PickId)) + return; + string serverURI = string.Empty; GetUserProfileServerURI (targetID, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + { + return; + } string theirGatekeeperURI; - GetUserGatekeeperURI (targetID, out theirGatekeeperURI); + GetUserGatekeeperURI(targetID, out theirGatekeeperURI); IClientAPI remoteClient = (IClientAPI)sender; - - UserProfilePick pick = new UserProfilePick (); - UUID.TryParse (args [0], out pick.CreatorId); - UUID.TryParse (args [1], out pick.PickId); - object Pick = (object)pick; if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) { @@ -654,13 +688,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles pick = (UserProfilePick)Pick; Vector3 globalPos = new Vector3(Vector3.Zero); + Vector3.TryParse(pick.GlobalPos, out globalPos); - // Smoke and mirrors - if (pick.Gatekeeper == MyGatekeeper) - { - Vector3.TryParse(pick.GlobalPos,out globalPos); - } - else + if (!string.IsNullOrWhiteSpace(MyGatekeeper) && pick.Gatekeeper != MyGatekeeper) { // Setup the illusion string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName); @@ -668,21 +698,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if(target == null) { - // This is a dead or unreachable region + // This is a unreachable region } else { - // Work our slight of hand - int x = target.RegionLocX; - int y = target.RegionLocY; - - dynamic synthX = globalPos.X - (globalPos.X/Constants.RegionSize) * Constants.RegionSize; - synthX += x; - globalPos.X = synthX; - - dynamic synthY = globalPos.Y - (globalPos.Y/Constants.RegionSize) * Constants.RegionSize; - synthY += y; - globalPos.Y = synthY; + // we have a proxy on map + // this is a fail on large regions + uint gtmp = (uint)globalPos.X >> 8; + globalPos.X -= (gtmp << 8); + globalPos.X += target.RegionLocX; + + gtmp = (uint)globalPos.Y >> 8; + globalPos.Y -= (gtmp << 8); + globalPos.Y += target.RegionLocY; } } @@ -732,6 +760,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles UserProfilePick pick = new UserProfilePick(); string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + { + return; + } + ScenePresence p = FindPresence(remoteClient.AgentId); Vector3 avaPos = p.AbsolutePosition; @@ -797,6 +830,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles { string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + { + return; + } OSDMap parameters= new OSDMap(); parameters.Add("pickId", OSD.FromUUID(queryPickID)); @@ -830,11 +867,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if (!(sender is IClientAPI)) return; + if(!UUID.TryParse(args[0], out note.TargetId)) + return; + IClientAPI remoteClient = (IClientAPI)sender; + note.UserId = remoteClient.AgentId; + string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); - note.UserId = remoteClient.AgentId; - UUID.TryParse(args[0], out note.TargetId); + if(string.IsNullOrWhiteSpace(serverURI)) + { + remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); + return; + } object Note = (object)note; if(!rpc.JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) @@ -842,8 +887,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); return; } - note = (UserProfileNotes) Note; - + note = (UserProfileNotes) Note; remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); } @@ -877,6 +921,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + return; object Note = note; if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) @@ -912,6 +958,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + return; object Pref = pref; if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString())) @@ -936,7 +984,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string serverURI = string.Empty; bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); - + if(string.IsNullOrWhiteSpace(serverURI)) + return; object Pref = (object)pref; if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) @@ -987,6 +1036,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); + if(string.IsNullOrWhiteSpace(serverURI)) + return; object Param = prop; if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString())) @@ -1006,9 +1057,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles return; } - // Can't handle NPC yet... ScenePresence p = FindPresence(avatarID); - if (p != null && p.isNPC) { remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born, @@ -1035,19 +1084,15 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } Byte[] membershipType = new Byte[1]; - string born = String.Empty; + string born = string.Empty; uint flags = 0x00; if (null != account) { if (account.UserTitle == "") - { membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8); - } else - { membershipType = Utils.StringToBytes(account.UserTitle); - } born = Util.ToDateTime(account.Created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); @@ -1058,16 +1103,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if (GetUserAccountData(avatarID, out userInfo) == true) { if ((string)userInfo["user_title"] == "") - { membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8); - } else - { membershipType = Utils.StringToBytes((string)userInfo["user_title"]); - } int val_born = (int)userInfo["user_created"]; - born = Util.ToDateTime(val_born).ToString( + if(val_born != 0) + born = Util.ToDateTime(val_born).ToString( "M/d/yyyy", CultureInfo.InvariantCulture); // picky, picky @@ -1077,20 +1119,17 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles } UserProfileProperties props = new UserProfileProperties(); - string result = string.Empty; - props.UserId = avatarID; - if (!GetProfileData(ref props, foreign, out result)) + string result = string.Empty; + if(!GetProfileData(ref props, foreign, out result)) { -// m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result); - return; + props.AboutText ="Profile not avaible at this time. User may still be unknown to this grid"; } // if on same region force online if(p != null && !p.IsDeleted) flags |= 0x10; - if(!m_allowUserProfileWebURLs) props.WebUrl =""; @@ -1166,12 +1205,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles string serverURI = string.Empty; GetUserProfileServerURI(properties.UserId, out serverURI); - // This is checking a friend on the home grid // Not HG friend if (String.IsNullOrEmpty(serverURI)) { - message = "No Presence - foreign friend"; + message = "User profile service unknown at this time"; return false; } -- cgit v1.1 From c93551d8f43cf91f909a3909bc2bdbf70666201b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 17 Dec 2016 22:38:31 +0000 Subject: allow a creator that is also onwer to change export flag. Add missing setting to ini files --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 61ea8ac..000944f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -431,9 +431,11 @@ namespace OpenSim.Region.Framework.Scenes bool denyExportChange = false; // m_log.DebugFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions); - + const uint permALLandExport = (uint)(PermissionMask.All | PermissionMask.Export); // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export - if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner) + if (item.CreatorIdAsUuid != item.Owner && + ((item.BasePermissions & permALLandExport) != permALLandExport || + (item.CurrentPermissions & (uint)PermissionMask.Export) == 0)) denyExportChange = true; // m_log.DebugFormat("[XXX]: Deny Export Update {0}", denyExportChange); -- cgit v1.1 From df7435a7030bc88987f2a60a2fe118f13342a31c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 18 Dec 2016 03:20:41 +0000 Subject: just give up on Export flag, seems just broken no matter water with current FS and singu 1.8.7 --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 ++++- OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 000944f..9772b35 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -433,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions); const uint permALLandExport = (uint)(PermissionMask.All | PermissionMask.Export); // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export - if (item.CreatorIdAsUuid != item.Owner && + if (item.CreatorIdAsUuid != item.Owner || ((item.BasePermissions & permALLandExport) != permALLandExport || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0)) denyExportChange = true; @@ -451,10 +451,12 @@ namespace OpenSim.Region.Framework.Scenes { itemUpd.NextPermissions = (uint)(PermissionMask.All); itemUpd.EveryOnePermissions |= (uint)PermissionMask.Export; + sendUpdate = true; } else { itemUpd.EveryOnePermissions &= ~(uint)PermissionMask.Export; + sendUpdate = true; } } else @@ -464,6 +466,7 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("[XXX]: Force full perm"); itemUpd.NextPermissions = (uint)(PermissionMask.All); + sendUpdate = true; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 98617d1..68d80f0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -258,7 +258,8 @@ namespace OpenSim.Region.Framework.Scenes uint perms=(uint)(PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Move | - PermissionMask.Transfer) | 7; + PermissionMask.Transfer | + PermissionMask.Export ) | 7; uint ownerMask = 0x7fffffff; @@ -281,6 +282,8 @@ namespace OpenSim.Region.Framework.Scenes perms &= ~(uint)PermissionMask.Copy; if ((ownerMask & (uint)PermissionMask.Transfer) == 0) perms &= ~(uint)PermissionMask.Transfer; + if ((ownerMask & (uint)PermissionMask.Export) == 0) + perms &= ~(uint)PermissionMask.Export; // If root prim permissions are applied here, this would screw // with in-inventory manipulation of the next owner perms -- cgit v1.1 From 2cf422582aad3dc99304b831b7d8bece2b28ecb3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 18 Dec 2016 03:55:44 +0000 Subject: leave stupid broken permissions alone --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 +---- OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9772b35..000944f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -433,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions); const uint permALLandExport = (uint)(PermissionMask.All | PermissionMask.Export); // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export - if (item.CreatorIdAsUuid != item.Owner || + if (item.CreatorIdAsUuid != item.Owner && ((item.BasePermissions & permALLandExport) != permALLandExport || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0)) denyExportChange = true; @@ -451,12 +451,10 @@ namespace OpenSim.Region.Framework.Scenes { itemUpd.NextPermissions = (uint)(PermissionMask.All); itemUpd.EveryOnePermissions |= (uint)PermissionMask.Export; - sendUpdate = true; } else { itemUpd.EveryOnePermissions &= ~(uint)PermissionMask.Export; - sendUpdate = true; } } else @@ -466,7 +464,6 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("[XXX]: Force full perm"); itemUpd.NextPermissions = (uint)(PermissionMask.All); - sendUpdate = true; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 68d80f0..98617d1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -258,8 +258,7 @@ namespace OpenSim.Region.Framework.Scenes uint perms=(uint)(PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Move | - PermissionMask.Transfer | - PermissionMask.Export ) | 7; + PermissionMask.Transfer) | 7; uint ownerMask = 0x7fffffff; @@ -282,8 +281,6 @@ namespace OpenSim.Region.Framework.Scenes perms &= ~(uint)PermissionMask.Copy; if ((ownerMask & (uint)PermissionMask.Transfer) == 0) perms &= ~(uint)PermissionMask.Transfer; - if ((ownerMask & (uint)PermissionMask.Export) == 0) - perms &= ~(uint)PermissionMask.Export; // If root prim permissions are applied here, this would screw // with in-inventory manipulation of the next owner perms -- cgit v1.1 From 30cd36ff98e9f695ec2aa3e7bf3a558dc19897db Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 18 Dec 2016 03:56:53 +0000 Subject: leave stupid broken permissions alone --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 000944f..61ea8ac 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -431,11 +431,9 @@ namespace OpenSim.Region.Framework.Scenes bool denyExportChange = false; // m_log.DebugFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions); - const uint permALLandExport = (uint)(PermissionMask.All | PermissionMask.Export); + // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export - if (item.CreatorIdAsUuid != item.Owner && - ((item.BasePermissions & permALLandExport) != permALLandExport || - (item.CurrentPermissions & (uint)PermissionMask.Export) == 0)) + if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner) denyExportChange = true; // m_log.DebugFormat("[XXX]: Deny Export Update {0}", denyExportChange); -- cgit v1.1