From 383eccc543e402710bb48802c6951b94d185a6a8 Mon Sep 17 00:00:00 2001
From: Brian McBee
Date: Sat, 8 Dec 2007 20:41:37 +0000
Subject: 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.
---
.../Cache/UserProfileCacheService.cs | 22 +++++++++++++++++++++-
OpenSim/Framework/IClientAPI.cs | 4 ++++
OpenSim/Region/ClientStack/ClientView.cs | 8 ++++++++
OpenSim/Region/Environment/Scenes/Scene.cs | 3 ++-
.../Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 +
5 files changed, 36 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index fb4c3a6..342bb0d 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Framework.Communications.Cache
///
///
///
- 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 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)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 38309fd..773b5eb 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -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;
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index e40c689..7b6ea97 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -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)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index eb8a6a2..6bdb8a3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -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;
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 31ce53e..87e66ab 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -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;
--
cgit v1.1