Allow moving, deleting, and restoring objects in inventory.

Note: only tested in grid mode, and emptying trash is still not implemented.
afrisby
Brian McBee 2007-12-08 19:13:10 +00:00
parent e0e9237a89
commit beca2373e1
5 changed files with 57 additions and 0 deletions

View File

@ -317,6 +317,9 @@ namespace OpenSim.Framework
public delegate void CopyInventoryItem( public delegate void CopyInventoryItem(
IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName); IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName);
public delegate void MoveInventoryItem(
IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, string newName);
public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID);
public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
@ -399,6 +402,7 @@ namespace OpenSim.Framework
event RequestTaskInventory OnRequestTaskInventory; event RequestTaskInventory OnRequestTaskInventory;
event UpdateInventoryItem OnUpdateInventoryItem; event UpdateInventoryItem OnUpdateInventoryItem;
event CopyInventoryItem OnCopyInventoryItem; event CopyInventoryItem OnCopyInventoryItem;
event MoveInventoryItem OnMoveInventoryItem;
event UDPAssetUploadRequest OnAssetUploadRequest; event UDPAssetUploadRequest OnAssetUploadRequest;
event XferReceive OnXferReceive; event XferReceive OnXferReceive;
event RequestXfer OnRequestXfer; event RequestXfer OnRequestXfer;

View File

@ -434,6 +434,7 @@ namespace OpenSim.Region.ClientStack
public event RequestTaskInventory OnRequestTaskInventory; public event RequestTaskInventory OnRequestTaskInventory;
public event UpdateInventoryItem OnUpdateInventoryItem; public event UpdateInventoryItem OnUpdateInventoryItem;
public event CopyInventoryItem OnCopyInventoryItem; public event CopyInventoryItem OnCopyInventoryItem;
public event MoveInventoryItem OnMoveInventoryItem;
public event UDPAssetUploadRequest OnAssetUploadRequest; public event UDPAssetUploadRequest OnAssetUploadRequest;
public event XferReceive OnXferReceive; public event XferReceive OnXferReceive;
public event RequestXfer OnRequestXfer; public event RequestXfer OnRequestXfer;
@ -2880,6 +2881,16 @@ namespace OpenSim.Region.ClientStack
} }
} }
break; break;
case PacketType.MoveInventoryItem:
MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
if (OnMoveInventoryItem != null)
{
foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
{
OnMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length, Util.FieldToString(datablock.NewName));
}
}
break;
case PacketType.RequestTaskInventory: case PacketType.RequestTaskInventory:
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket) Pack; RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket) Pack;
if (OnRequestTaskInventory != null) if (OnRequestTaskInventory != null)

View File

@ -236,6 +236,46 @@ namespace OpenSim.Region.Environment.Scenes
return asset; return asset;
} }
public void MoveInventoryItem(IClientAPI remoteClient,LLUUID folderID, LLUUID itemID, int length, string newName)
{
MainLog.Instance.Verbose("INVENTORY", "Moving item for " + remoteClient.AgentId.ToStringHyphenated());
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo == null)
{
MainLog.Instance.Warn("INVENTORY", "Failed to find user " + remoteClient.AgentId.ToString());
return;
}
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
if (newName != "")
{
item.inventoryName = newName;
}
item.parentFolderID = folderID;
userInfo.DeleteItem(remoteClient.AgentId, item);
// TODO: preserve current permissions?
AddInventoryItem(remoteClient, item);
}
else
{
MainLog.Instance.Warn("INVENTORY", "Failed to find item " + itemID.ToString());
return;
}
}
else
{
MainLog.Instance.Warn("INVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder");
return;
}
}
private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
AssetBase asset, uint nextOwnerMask) AssetBase asset, uint nextOwnerMask)
{ {

View File

@ -976,6 +976,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory; client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory;
client.OnUpdateInventoryItem += UpdateInventoryItemAsset; client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
client.OnCopyInventoryItem += CopyInventoryItem; client.OnCopyInventoryItem += CopyInventoryItem;
client.OnMoveInventoryItem += MoveInventoryItem;
client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;
client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer; client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer;
client.OnRezScript += RezScript; client.OnRezScript += RezScript;

View File

@ -111,6 +111,7 @@ namespace SimpleApp
public event RequestTaskInventory OnRequestTaskInventory; public event RequestTaskInventory OnRequestTaskInventory;
public event UpdateInventoryItem OnUpdateInventoryItem; public event UpdateInventoryItem OnUpdateInventoryItem;
public event CopyInventoryItem OnCopyInventoryItem; public event CopyInventoryItem OnCopyInventoryItem;
public event MoveInventoryItem OnMoveInventoryItem;
public event UDPAssetUploadRequest OnAssetUploadRequest; public event UDPAssetUploadRequest OnAssetUploadRequest;
public event XferReceive OnXferReceive; public event XferReceive OnXferReceive;
public event RequestXfer OnRequestXfer; public event RequestXfer OnRequestXfer;