This enables return from the parcel object owner display.

There's some oddness with the parcel counts, but if you can get past the oddness, you can return objects under an owner that you have permission to return.
0.6.0-stable
Teravus Ovares 2008-05-24 11:10:21 +00:00
parent 3965fa2ff3
commit 375673ec90
11 changed files with 161 additions and 47 deletions

View File

@ -502,6 +502,8 @@ namespace OpenSim.Framework
public delegate void ParcelAbandonRequest(int local_id, IClientAPI remote_client); public delegate void ParcelAbandonRequest(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);
public delegate void EstateOwnerMessageRequest(LLUUID AgentID, LLUUID SessionID, LLUUID TransactionID, LLUUID Invoice, byte[] Method, byte[][] Parameters, IClientAPI remote_client); public delegate void EstateOwnerMessageRequest(LLUUID AgentID, LLUUID SessionID, LLUUID TransactionID, LLUUID Invoice, byte[] Method, byte[][] Parameters, IClientAPI remote_client);
public delegate void RegionInfoRequest(IClientAPI remote_client); public delegate void RegionInfoRequest(IClientAPI remote_client);
@ -772,6 +774,7 @@ namespace OpenSim.Framework
event ParcelSelectObjects OnParcelSelectObjects; event ParcelSelectObjects OnParcelSelectObjects;
event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
event ParcelAbandonRequest OnParcelAbandonRequest; event ParcelAbandonRequest OnParcelAbandonRequest;
event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
event RegionInfoRequest OnRegionInfoRequest; event RegionInfoRequest OnRegionInfoRequest;
event EstateCovenantRequest OnEstateCovenantRequest; event EstateCovenantRequest OnEstateCovenantRequest;

View File

@ -221,6 +221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects; private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects;
private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest; private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest;
private ParcelAbandonRequest handlerParcelAbandonRequest = null; private ParcelAbandonRequest handlerParcelAbandonRequest = null;
private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest = null;
private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest; private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest;
private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest; private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest;
private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers; private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers;
@ -814,6 +815,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event ParcelSelectObjects OnParcelSelectObjects; public event ParcelSelectObjects OnParcelSelectObjects;
public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest; public event ParcelAbandonRequest OnParcelAbandonRequest;
public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
public event RegionInfoRequest OnRegionInfoRequest; public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest; public event EstateCovenantRequest OnEstateCovenantRequest;
@ -5419,6 +5422,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerParcelAbandonRequest(releasePacket.Data.LocalID, this); handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
} }
break; break;
case PacketType.ParcelReturnObjects:
ParcelReturnObjectsPacket parcelReturnObjects = (ParcelReturnObjectsPacket)Pack;
LLUUID[] puserselectedOwnerIDs = new LLUUID[parcelReturnObjects.OwnerIDs.Length];
for (int parceliterator = 0; parceliterator < parcelReturnObjects.OwnerIDs.Length; parceliterator++)
puserselectedOwnerIDs[parceliterator] = parcelReturnObjects.OwnerIDs[parceliterator].OwnerID;
LLUUID[] puserselectedTaskIDs = new LLUUID[parcelReturnObjects.TaskIDs.Length];
for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++)
puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID;
handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest;
if (handlerParcelReturnObjectsRequest != null)
{
handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID,parcelReturnObjects.ParcelData.ReturnType,puserselectedOwnerIDs,puserselectedTaskIDs, this);
}
break;
#endregion #endregion
#region Estate Packets #region Estate Packets

View File

@ -41,5 +41,6 @@ namespace OpenSim.Region.Environment.Interfaces
bool IsLandPrimCountTainted(); bool IsLandPrimCountTainted();
bool IsForcefulBansAllowed(); bool IsForcefulBansAllowed();
void UpdateLandObject(int localID, LandData data); void UpdateLandObject(int localID, LandData data);
void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient);
} }
} }

View File

@ -64,7 +64,7 @@ namespace OpenSim.Region.Environment.Interfaces
void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client); void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client);
void sendLandObjectOwners(IClientAPI remote_client); void sendLandObjectOwners(IClientAPI remote_client);
void returnObject(SceneObjectGroup obj); void returnObject(SceneObjectGroup obj);
void returnLandObjects(int type, LLUUID owner); void returnLandObjects(uint type, LLUUID[] owners, IClientAPI remote_client);
void resetLandPrimCounts(); void resetLandPrimCounts();
void addPrimToCount(SceneObjectGroup obj); void addPrimToCount(SceneObjectGroup obj);
void removePrimFromCount(SceneObjectGroup obj); void removePrimFromCount(SceneObjectGroup obj);

View File

@ -142,6 +142,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land
m_landManagementModule.UpdateLandObject(localID, data); m_landManagementModule.UpdateLandObject(localID, data);
} }
} }
public void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient)
{
if (m_landManagementModule != null)
{
m_landManagementModule.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
}
}
#endregion #endregion
} }

View File

@ -901,9 +901,19 @@ namespace OpenSim.Region.Environment.Modules.World.Land
} }
public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client) public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client)
{
lock (landList)
{
if (landList.ContainsKey(local_id))
{ {
landList[local_id].sendLandObjectOwners(remote_client); landList[local_id].sendLandObjectOwners(remote_client);
} }
else
{
System.Console.WriteLine("[PARCEL]: Invalid land object passed for parcel object owner request");
}
}
}
public void handleParcelAbandonRequest(int local_id, IClientAPI remote_client) public void handleParcelAbandonRequest(int local_id, IClientAPI remote_client)
{ {
@ -1004,6 +1014,24 @@ namespace OpenSim.Region.Environment.Modules.World.Land
AddLandObject(new_land); AddLandObject(new_land);
} }
public void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient)
{
ILandObject selectedParcel = null;
lock (landList)
{
if (landList.ContainsKey(localID))
selectedParcel = landList[localID];
}
if (selectedParcel == null)
return;
if (returnType == 16) // parcel return
{
selectedParcel.returnLandObjects(returnType, agentIDs, remoteClient);
}
}
public void NoLandDataFromStorage() public void NoLandDataFromStorage()
{ {
ResetSimLandObjects(); ResetSimLandObjects();

View File

@ -683,6 +683,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public Dictionary<LLUUID, int> getLandObjectOwners() public Dictionary<LLUUID, int> getLandObjectOwners()
{ {
Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>();
lock (primsOverMe)
{
try
{
foreach (SceneObjectGroup obj in primsOverMe) foreach (SceneObjectGroup obj in primsOverMe)
{ {
if (!ownersAndCount.ContainsKey(obj.OwnerID)) if (!ownersAndCount.ContainsKey(obj.OwnerID))
@ -691,6 +696,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land
} }
ownersAndCount[obj.OwnerID] += obj.PrimCount; ownersAndCount[obj.OwnerID] += obj.PrimCount;
} }
}
catch (InvalidOperationException)
{
m_log.Error("[LAND]: Unable to enumerate land owners. arr.");
}
}
return ownersAndCount; return ownersAndCount;
} }
@ -700,10 +712,33 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public void returnObject(SceneObjectGroup obj) public void returnObject(SceneObjectGroup obj)
{ {
SceneObjectGroup[] objs = new SceneObjectGroup[1];
objs[0] = obj;
m_scene.returnObjects(objs, obj.OwnerID);
} }
public void returnLandObjects(int type, LLUUID owner) public void returnLandObjects(uint type, LLUUID[] owners, IClientAPI remote_client)
{ {
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>();
for (int i = 0; i < owners.Length; i++)
{
lock (primsOverMe)
{
try
{
foreach (SceneObjectGroup obj in primsOverMe)
{
if (obj.OwnerID == owners[i])
objlist.Add(obj);
}
}
catch (InvalidOperationException)
{
m_log.Info("[PARCEL]: Unable to figure out all the objects owned by " + owners[i].ToString() + " arr.");
}
}
}
m_scene.returnObjects(objlist.ToArray(), remote_client.AgentId);
} }
#endregion #endregion
@ -716,6 +751,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
landData.ownerPrims = 0; landData.ownerPrims = 0;
landData.otherPrims = 0; landData.otherPrims = 0;
landData.selectedPrims = 0; landData.selectedPrims = 0;
lock (primsOverMe)
primsOverMe.Clear(); primsOverMe.Clear();
} }
@ -740,10 +776,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land
} }
} }
lock (primsOverMe)
primsOverMe.Add(obj); primsOverMe.Add(obj);
} }
public void removePrimFromCount(SceneObjectGroup obj) public void removePrimFromCount(SceneObjectGroup obj)
{
lock (primsOverMe)
{ {
if (primsOverMe.Contains(obj)) if (primsOverMe.Contains(obj))
{ {
@ -766,6 +805,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
primsOverMe.Remove(obj); primsOverMe.Remove(obj);
} }
} }
}
#endregion #endregion

View File

@ -243,6 +243,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event ParcelJoinRequest OnParcelJoinRequest; public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest; public event ParcelAbandonRequest OnParcelAbandonRequest;
public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest; public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects; public event ParcelSelectObjects OnParcelSelectObjects;

View File

@ -1690,8 +1690,14 @@ namespace OpenSim.Region.Environment.Scenes
//returnstring += "</scene>\n"; //returnstring += "</scene>\n";
bool permissionToDelete = false;
for (int i = 0; i < returnobjects.Length; i++)
{
CachedUserInfo userInfo = CachedUserInfo userInfo =
CommsManager.UserProfileCacheService.GetUserDetails(AgentId); CommsManager.UserProfileCacheService.GetUserDetails(returnobjects[i].OwnerID);
if (userInfo != null) if (userInfo != null)
{ {
LLUUID folderID = LLUUID.Zero; LLUUID folderID = LLUUID.Zero;
@ -1710,11 +1716,6 @@ namespace OpenSim.Region.Environment.Scenes
{ {
folderID = userInfo.RootFolder.ID; folderID = userInfo.RootFolder.ID;
} }
bool permissionToDelete = false;
for (int i = 0; i < returnobjects.Length; i++)
{
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(returnobjects[i].UUID, AgentId); permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(returnobjects[i].UUID, AgentId);
// If the user doesn't have permission, go on to the next one. // If the user doesn't have permission, go on to the next one.
@ -1732,7 +1733,7 @@ namespace OpenSim.Region.Environment.Scenes
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.Creator = returnobjects[i].RootPart.CreatorID; item.Creator = returnobjects[i].RootPart.CreatorID;
item.Owner = AgentId; item.Owner = returnobjects[i].OwnerID;
item.ID = LLUUID.Random(); item.ID = LLUUID.Random();
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
item.Description = asset.Description; item.Description = asset.Description;
@ -1769,6 +1770,12 @@ namespace OpenSim.Region.Environment.Scenes
userInfo.AddItem(item); userInfo.AddItem(item);
ScenePresence notifyUser = GetScenePresence(item.Owner);
if (notifyUser != null)
{
notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item);
}
SceneObjectGroup ObjectDeleting = returnobjects[i]; SceneObjectGroup ObjectDeleting = returnobjects[i];
returnobjects[i] = null; returnobjects[i] = null;

View File

@ -1660,6 +1660,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnSetStartLocationRequest += SetHomeRezPoint; client.OnSetStartLocationRequest += SetHomeRezPoint;
client.OnUndo += m_innerScene.HandleUndo; client.OnUndo += m_innerScene.HandleUndo;
client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate;
client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel;
// EventManager.TriggerOnNewClient(client); // EventManager.TriggerOnNewClient(client);
} }

View File

@ -147,6 +147,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event ParcelJoinRequest OnParcelJoinRequest; public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest; public event ParcelAbandonRequest OnParcelAbandonRequest;
public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest; public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects; public event ParcelSelectObjects OnParcelSelectObjects;