From a6abecf5fa5de0a78b1d77ef0aee1efafb255a2f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 26 Jan 2012 00:33:34 -0500 Subject: Change references from sop to sog and add protection from null ref I had code made additions to the map module that was based on the earlier work that I did before Melanie made improvements. Updating the new code to incorporate the same changes. --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 1a9313b..4ae96f0 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -489,18 +489,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap List mapitems = new List(); mapItemReply mapitem = new mapItemReply(); - SceneObjectPart sop = m_scene.GetSceneObjectPart(m_scene.RegionInfo.RegionSettings.TelehubObject); - - mapitem = new mapItemReply(); - mapitem.x = (uint)(xstart + sop.AbsolutePosition.X); - mapitem.y = (uint)(ystart + sop.AbsolutePosition.Y); - mapitem.id = UUID.Zero; - mapitem.name = sop.Name; - mapitem.Extra = 0; // color (not used) - mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub - mapitems.Add(mapitem); + SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); + if (sog != null) + { + mapitem = new mapItemReply(); + mapitem.x = (uint)(xstart + sog.AbsolutePosition.X); + mapitem.y = (uint)(ystart + sog.AbsolutePosition.Y); + mapitem.id = UUID.Zero; + mapitem.name = sog.Name; + mapitem.Extra = 0; // color (not used) + mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub + mapitems.Add(mapitem); - remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); + remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); + } } else { -- cgit v1.1 From da720ce9be7d050ad2ff26c97490ebd4e17be2cc Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 26 Jan 2012 10:21:45 +0000 Subject: Support rejecting a teleport if a user is banned in all parcels that have spawn points --- OpenSim/Region/Framework/Scenes/Scene.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f03c345..984058c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5067,6 +5067,36 @@ namespace OpenSim.Region.Framework.Scenes } } + if (position == Vector3.Zero) // Teleport + { + if (!RegionInfo.EstateSettings.AllowDirectTeleport) + { + SceneObjectGroup telehub; + if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject)) != null) + { + List spawnPoints = RegionInfo.RegionSettings.SpawnPoints(); + bool banned = true; + foreach (SpawnPoint sp in spawnPoints) + { + Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); + if (land == null) + continue; + if (land.IsEitherBannedOrRestricted(agentID)) + continue; + banned = false; + break; + } + + if (banned) + { + reason = "No suitable landing point found"; + return false; + } + } + } + } + reason = String.Empty; return true; } -- cgit v1.1 From 616373db169fbfc06652fb3f2d40b531426f6dd3 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Thu, 26 Jan 2012 21:53:42 +0100 Subject: llManageEstateAccess implementation http://wiki.secondlife.com/wiki/LlManageEstateAccess Signed-off-by: BlueWall --- OpenSim/Framework/EstateSettings.cs | 6 ++ .../Shared/Api/Implementation/LSL_Api.cs | 69 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Constants.cs | 8 +++ .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++ 5 files changed, 89 insertions(+) diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 2a495b0..98604f2 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -373,5 +373,11 @@ namespace OpenSim.Framework return l_EstateAccess.Contains(user); } + + public bool GroupAccess(UUID groupID) + { + return l_EstateGroups.Contains(groupID); + } + } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6fa812d..fb5fd45 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10646,6 +10646,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return list; } + public LSL_Integer llManageEstateAccess(int action, string avatar) + { + m_host.AddScriptLPS(1); + EstateSettings estate = World.RegionInfo.EstateSettings; + bool isAccount = false; + bool isGroup = false; + + if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManager(m_host.OwnerID)) + return 0; + + UUID id = new UUID(); + if (!UUID.TryParse(avatar, out id)) + return 0; + + UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, id); + isAccount = account != null ? true : false; + if (!isAccount) + { + IGroupsModule groups = World.RequestModuleInterface(); + if (groups != null) + { + GroupRecord group = groups.GetGroupRecord(id); + isGroup = group != null ? true : false; + if (!isGroup) + return 0; + } + else + return 0; + } + + switch (action) + { + case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_ADD: + if (!isAccount) return 0; + if (estate.HasAccess(id)) return 1; + if (estate.IsBanned(id)) + estate.RemoveBan(id); + estate.AddEstateUser(id); + break; + case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_AGENT_REMOVE: + if (!isAccount || !estate.HasAccess(id)) return 0; + estate.RemoveEstateUser(id); + break; + case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_ADD: + if (!isGroup) return 0; + if (estate.GroupAccess(id)) return 1; + estate.AddEstateGroup(id); + break; + case ScriptBaseClass.ESTATE_ACCESS_ALLOWED_GROUP_REMOVE: + if (!isGroup || !estate.GroupAccess(id)) return 0; + estate.RemoveEstateGroup(id); + break; + case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_ADD: + if (!isAccount) return 0; + if (estate.IsBanned(id)) return 1; + EstateBan ban = new EstateBan(); + ban.EstateID = estate.EstateID; + ban.BannedUserID = id; + estate.AddBan(ban); + break; + case ScriptBaseClass.ESTATE_ACCESS_BANNED_AGENT_REMOVE: + if (!isAccount || !estate.IsBanned(id)) return 0; + estate.RemoveBan(id); + break; + default: return 0; + } + return 1; + } + #region Not Implemented // // Listing the unimplemented lsl functions here, please move diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 282443b..b66537f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -242,6 +242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llLoopSound(string sound, double volume); void llLoopSoundMaster(string sound, double volume); void llLoopSoundSlave(string sound, double volume); + LSL_Integer llManageEstateAccess(int action, string avatar); void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 176dc56..ab2c543 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -432,6 +432,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int REGION_FLAG_ALLOW_DIRECT_TELEPORT = 0x100000; // region allows direct teleports public const int REGION_FLAG_RESTRICT_PUSHOBJECT = 0x400000; // region restricts llPushObject + //llManageEstateAccess + public const int ESTATE_ACCESS_ALLOWED_AGENT_ADD = 0; + public const int ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1; + public const int ESTATE_ACCESS_ALLOWED_GROUP_ADD = 2; + public const int ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 3; + public const int ESTATE_ACCESS_BANNED_AGENT_ADD = 4; + public const int ESTATE_ACCESS_BANNED_AGENT_REMOVE = 5; + public static readonly LSLInteger PAY_HIDE = new LSLInteger(-1); public static readonly LSLInteger PAY_DEFAULT = new LSLInteger(-2); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 9733683..840d3a4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1054,6 +1054,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llLoopSoundSlave(sound, volume); } + public LSL_Integer llManageEstateAccess(int action, string avatar) + { + return m_LSL_Functions.llManageEstateAccess(action, avatar); + } + public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) { m_LSL_Functions.llMakeExplosion(particles, scale, vel, lifetime, arc, texture, offset); -- cgit v1.1 From 91ac21b9ec36d698bfaa7ecf6e8d981562ddb4c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 26 Jan 2012 17:00:58 -0800 Subject: HG Inventoty: Guard against items not found. --- OpenSim/Services/HypergridService/HGInventoryService.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index daf8c3a..41d5a7a 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -319,13 +319,14 @@ namespace OpenSim.Services.HypergridService public override InventoryItemBase GetItem(InventoryItemBase item) { InventoryItemBase it = base.GetItem(item); + if (it != null) + { + UserAccount user = m_Cache.GetUser(it.CreatorId); - UserAccount user = m_Cache.GetUser(it.CreatorId); - - // Adjust the creator data - if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) - it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName; - + // Adjust the creator data + if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) + it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName; + } return it; } -- cgit v1.1