Mantis#1597. Thank you, Melanie for a patch that:

Adds handlers for the reclaim land functionality, 
plus all needed permissions checks.
0.6.0-stable
Charles Krinke 2008-06-26 13:45:36 +00:00
parent cf00df106d
commit a58a47a759
7 changed files with 66 additions and 1 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);

View File

@ -899,6 +899,31 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
public delegate bool CanReclaimParcel(LLUUID user, ILandObject parcel, Scene scene);
private List<CanReclaimParcel> CanReclaimParcelCheckFunctions = new List<CanReclaimParcel>();
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<CanBuyLand> CanBuyLandCheckFunctions = new List<CanBuyLand>();

View File

@ -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;