hackish code to allow emptying of trash. This really should be done on the inventory server, and not from the region.

Also: it appeared to work the first try, so I have probably done something horribly wrong.
afrisby
Brian McBee 2007-12-08 20:41:37 +00:00
parent beca2373e1
commit 383eccc543
5 changed files with 36 additions and 2 deletions

View File

@ -136,7 +136,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="fetchFolders"></param>
/// <param name="fetchItems"></param>
/// <param name="sortOrder"></param>
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder)
{
InventoryFolderImpl fold = null;
@ -181,6 +181,26 @@ namespace OpenSim.Framework.Communications.Cache
}
}
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
{
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
if (userProfile.RootFolder != null)
{
InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
if (subFolder != null)
{
List<InventoryItemBase> items=subFolder.RequestListOfItems();
foreach(InventoryItemBase item in items)
{
userProfile.DeleteItem(remoteClient.AgentId, item);
}
}
}
}
}
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
{
if (ownerID == libraryRoot.agentID)

View File

@ -306,6 +306,9 @@ namespace OpenSim.Framework
public delegate void FetchInventoryDescendents(
IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
public delegate void PurgeInventoryDescendents(
IClientAPI remoteClient, LLUUID folderID);
public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID);
public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
@ -398,6 +401,7 @@ namespace OpenSim.Framework
event CreateNewInventoryItem OnCreateNewInventoryItem;
event CreateInventoryFolder OnCreateNewInventoryFolder;
event FetchInventoryDescendents OnFetchInventoryDescendents;
event PurgeInventoryDescendents OnPurgeInventoryDescendents;
event FetchInventory OnFetchInventory;
event RequestTaskInventory OnRequestTaskInventory;
event UpdateInventoryItem OnUpdateInventoryItem;

View File

@ -430,6 +430,7 @@ namespace OpenSim.Region.ClientStack
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
public event FetchInventory OnFetchInventory;
public event RequestTaskInventory OnRequestTaskInventory;
public event UpdateInventoryItem OnUpdateInventoryItem;
@ -2827,6 +2828,13 @@ namespace OpenSim.Region.ClientStack
Fetch.InventoryData.SortOrder);
}
break;
case PacketType.PurgeInventoryDescendents:
if (OnPurgeInventoryDescendents != null)
{
PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack;
OnPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
}
break;
case PacketType.UpdateInventoryItem:
UpdateInventoryItemPacket update = (UpdateInventoryItemPacket) Pack;
if (OnUpdateInventoryItem != null)

View File

@ -971,7 +971,8 @@ namespace OpenSim.Region.Environment.Scenes
client.OnCreateNewInventoryItem += CreateNewInventoryItem;
client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder;
client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFecthInventoryDescendents;
client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents;
client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents;
client.OnRequestTaskInventory += RequestTaskInventory;
client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory;
client.OnUpdateInventoryItem += UpdateInventoryItemAsset;

View File

@ -107,6 +107,7 @@ namespace SimpleApp
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
public event FetchInventory OnFetchInventory;
public event RequestTaskInventory OnRequestTaskInventory;
public event UpdateInventoryItem OnUpdateInventoryItem;