diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index fa2ab0b372..8eb82b20d9 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -514,6 +514,7 @@ namespace OpenSim.Framework public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); public delegate void ParcelAbandonRequest(int local_id, IClientAPI remote_client); + public delegate void ParcelReclaim(int local_id, IClientAPI remote_client); public delegate void ParcelReturnObjectsRequest(int local_id, uint return_type, LLUUID[] agent_ids, LLUUID[] selected_ids, IClientAPI remote_client); @@ -793,6 +794,7 @@ namespace OpenSim.Framework event ParcelSelectObjects OnParcelSelectObjects; event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; event ParcelAbandonRequest OnParcelAbandonRequest; + event ParcelReclaim OnParcelReclaim; event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest; event RegionInfoRequest OnRegionInfoRequest; event EstateCovenantRequest OnEstateCovenantRequest; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index eb2a4825dd..49174bd76c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -235,6 +235,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects; private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest; private ParcelAbandonRequest handlerParcelAbandonRequest = null; + private ParcelReclaim handlerParcelReclaim = null; private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest = null; private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest; private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest; @@ -868,6 +869,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ParcelSelectObjects OnParcelSelectObjects; public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; public event ParcelAbandonRequest OnParcelAbandonRequest; + public event ParcelReclaim OnParcelReclaim; public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest; public event RegionInfoRequest OnRegionInfoRequest; public event EstateCovenantRequest OnEstateCovenantRequest; @@ -5661,6 +5663,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerParcelAbandonRequest(releasePacket.Data.LocalID, this); } break; + case PacketType.ParcelReclaim: + ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack; + + handlerParcelReclaim = OnParcelReclaim; + if (handlerParcelReclaim != null) + { + handlerParcelReclaim(reclaimPacket.Data.LocalID, this); + } + break; case PacketType.ParcelReturnObjects: diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index 984bc4e0c6..05bd983d2d 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -94,6 +94,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land client.OnParcelAccessListRequest += new ParcelAccessListRequest(handleParcelAccessRequest); client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(handleParcelAccessUpdateRequest); client.OnParcelAbandonRequest += new ParcelAbandonRequest(handleParcelAbandonRequest); + client.OnParcelReclaim += new ParcelReclaim(handleParcelReclaim); if (m_scene.Entities.ContainsKey(client.AgentId)) { @@ -932,6 +933,21 @@ namespace OpenSim.Region.Environment.Modules.World.Land { landList[local_id].landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; m_scene.Broadcast(SendParcelOverlay); + landList[local_id].sendLandUpdateToClient(remote_client); + } + } + + } + + public void handleParcelReclaim(int local_id, IClientAPI remote_client) + { + if (landList.ContainsKey(local_id)) + { + if (m_scene.ExternalChecks.ExternalChecksCanReclaimParcel(remote_client.AgentId, landList[local_id])) + { + landList[local_id].landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; + m_scene.Broadcast(SendParcelOverlay); + landList[local_id].sendLandUpdateToClient(remote_client); } } @@ -1060,4 +1076,4 @@ namespace OpenSim.Region.Environment.Modules.World.Land } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index f4d2848d31..05a41460fc 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -243,6 +243,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event ParcelJoinRequest OnParcelJoinRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event ParcelAbandonRequest OnParcelAbandonRequest; + public event ParcelReclaim OnParcelReclaim; public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest; public event ParcelAccessListRequest OnParcelAccessListRequest; public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index a851cad576..e8defb720d 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs @@ -143,6 +143,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions m_scene.ExternalChecks.addSetBypassPermissions(SetBypassPermissions); //FULLY IMPLEMENTED m_scene.ExternalChecks.addPropagatePermissions(PropagatePermissions); //FULLY IMPLEMENTED m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED + m_scene.ExternalChecks.addCheckReclaimParcel(CanReclaimParcel); //FULLY IMPLEMENTED m_scene.ExternalChecks.addGenerateClientFlags(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED @@ -531,6 +532,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions return GenericParcelPermission(user, parcel); } + private bool CanReclaimParcel(LLUUID user, ILandObject parcel, Scene scene) + { + DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); + if (m_bypassPermissions) return m_bypassPermissionsValue; + + return GenericParcelPermission(user, parcel); + } + private bool CanBeGodLike(LLUUID user, Scene scene) { DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index eac9e25996..dba10df959 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs @@ -899,6 +899,31 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + public delegate bool CanReclaimParcel(LLUUID user, ILandObject parcel, Scene scene); + private List CanReclaimParcelCheckFunctions = new List(); + + public void addCheckReclaimParcel(CanReclaimParcel delegateFunc) + { + if (!CanReclaimParcelCheckFunctions.Contains(delegateFunc)) + CanReclaimParcelCheckFunctions.Add(delegateFunc); + } + public void removeCheckReclaimParcel(CanReclaimParcel delegateFunc) + { + if (CanReclaimParcelCheckFunctions.Contains(delegateFunc)) + CanReclaimParcelCheckFunctions.Remove(delegateFunc); + } + + public bool ExternalChecksCanReclaimParcel(LLUUID user, ILandObject parcel) + { + foreach (CanReclaimParcel check in CanReclaimParcelCheckFunctions) + { + if (check(user, parcel, m_scene) == false) + { + return false; + } + } + return true; + } public delegate bool CanBuyLand(LLUUID user, ILandObject parcel, Scene scene); private List CanBuyLandCheckFunctions = new List(); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index a097f23941..090ef37d25 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -148,6 +148,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event ParcelJoinRequest OnParcelJoinRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event ParcelAbandonRequest OnParcelAbandonRequest; + public event ParcelReclaim OnParcelReclaim; public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest; public event ParcelAccessListRequest OnParcelAccessListRequest; public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;