diff options
author | Justin Clarke Casey | 2008-04-23 17:04:15 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-04-23 17:04:15 +0000 |
commit | 4db839c3b84bed8a775074beb1ae0b526bc05e81 (patch) | |
tree | e412c914e674aa874ca22ddf99a44459d1811868 /OpenSim/Framework | |
parent | * Adds llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z,TF) (diff) | |
download | opensim-SC_OLD-4db839c3b84bed8a775074beb1ae0b526bc05e81.zip opensim-SC_OLD-4db839c3b84bed8a775074beb1ae0b526bc05e81.tar.gz opensim-SC_OLD-4db839c3b84bed8a775074beb1ae0b526bc05e81.tar.bz2 opensim-SC_OLD-4db839c3b84bed8a775074beb1ae0b526bc05e81.tar.xz |
* Implement proper emptying of trashcan on standalone
* On standalone, folders (and their items) should now be persistently deleted on trash emptying, as well as immediate child items
* An implementation for grid mode will follow.
Diffstat (limited to 'OpenSim/Framework')
6 files changed, 84 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index daf9ab5..7812499 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs | |||
@@ -79,14 +79,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// Delete all the folders and items in this folder. | 81 | /// Delete all the folders and items in this folder. |
82 | /// | ||
83 | /// TODO: This method is not used yet, but will be shortly | ||
84 | /// </summary> | 82 | /// </summary> |
85 | public void DeleteAllContents() | 83 | public void Purge() |
86 | { | 84 | { |
87 | foreach (InventoryFolderImpl folder in SubFolders.Values) | 85 | foreach (InventoryFolderImpl folder in SubFolders.Values) |
88 | { | 86 | { |
89 | folder.DeleteAllContents(); | 87 | folder.Purge(); |
90 | } | 88 | } |
91 | 89 | ||
92 | SubFolders.Clear(); | 90 | SubFolders.Clear(); |
@@ -206,7 +204,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
206 | } | 204 | } |
207 | 205 | ||
208 | /// <summary> | 206 | /// <summary> |
209 | /// Return the list of folders in this folder | 207 | /// Return the list of immediate child folders in this folder. |
210 | /// </summary> | 208 | /// </summary> |
211 | public List<InventoryFolderBase> RequestListOfFolders() | 209 | public List<InventoryFolderBase> RequestListOfFolders() |
212 | { | 210 | { |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index e3f6815..61ec483 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -496,6 +496,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
496 | return new List<InventoryItemBase>(); | 496 | return new List<InventoryItemBase>(); |
497 | } | 497 | } |
498 | 498 | ||
499 | /// <summary> | ||
500 | /// This should delete all the items and folders in the given directory. | ||
501 | /// </summary> | ||
502 | /// <param name="remoteClient"></param> | ||
503 | /// <param name="folderID"></param> | ||
499 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID) | 504 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID) |
500 | { | 505 | { |
501 | // m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}", | 506 | // m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}", |
@@ -506,14 +511,28 @@ namespace OpenSim.Framework.Communications.Cache | |||
506 | { | 511 | { |
507 | if (userProfile.HasInventory) | 512 | if (userProfile.HasInventory) |
508 | { | 513 | { |
509 | InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID); | 514 | InventoryFolderImpl purgedFolder = userProfile.RootFolder.HasSubFolder(folderID); |
510 | if (subFolder != null) | 515 | if (purgedFolder != null) |
511 | { | 516 | { |
512 | List<InventoryItemBase> items = subFolder.RequestListOfItems(); | 517 | // XXX Nasty - have to create a new object to hold details we already have |
518 | InventoryFolderBase purgedBaseFolder = new InventoryFolderBase(); | ||
519 | purgedBaseFolder.Owner = purgedFolder.Owner; | ||
520 | purgedBaseFolder.ID = purgedFolder.ID; | ||
521 | purgedBaseFolder.Name = purgedFolder.Name; | ||
522 | purgedBaseFolder.ParentID = purgedFolder.ParentID; | ||
523 | purgedBaseFolder.Type = purgedFolder.Type; | ||
524 | purgedBaseFolder.Version = purgedFolder.Version; | ||
525 | |||
526 | m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder); | ||
527 | |||
528 | // XXX Remains temporarily so that we still delete items in the grid case. | ||
529 | List<InventoryItemBase> items = purgedFolder.RequestListOfItems(); | ||
513 | foreach (InventoryItemBase item in items) | 530 | foreach (InventoryItemBase item in items) |
514 | { | 531 | { |
515 | userProfile.DeleteItem(remoteClient.AgentId, item); | 532 | userProfile.DeleteItem(remoteClient.AgentId, item); |
516 | } | 533 | } |
534 | |||
535 | purgedFolder.Purge(); | ||
517 | } | 536 | } |
518 | } | 537 | } |
519 | else | 538 | else |
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 90bda01..5690f89 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -56,9 +56,21 @@ namespace OpenSim.Framework.Communications | |||
56 | /// <param name="folder"></param> | 56 | /// <param name="folder"></param> |
57 | void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); | 57 | void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); |
58 | 58 | ||
59 | /// <summary> | ||
60 | /// Move an inventory folder to a new location | ||
61 | /// </summary> | ||
62 | /// <param name="userID"></param> | ||
63 | /// <param name="folder">A folder containing the details of the new location</param> | ||
59 | void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder); | 64 | void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder); |
60 | 65 | ||
61 | /// <summary> | 66 | /// <summary> |
67 | /// Purge an inventory folder of all its items and subfolders. | ||
68 | /// </summary> | ||
69 | /// <param name="userID"></param> | ||
70 | /// <param name="folder"></param> | ||
71 | void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder); | ||
72 | |||
73 | /// <summary> | ||
62 | /// Add a new item to the given user's inventory | 74 | /// Add a new item to the given user's inventory |
63 | /// </summary> | 75 | /// </summary> |
64 | /// <param name="userID"></param> | 76 | /// <param name="userID"></param> |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index f614e7d..769c530 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Framework.Communications | |||
50 | { | 50 | { |
51 | if (!String.IsNullOrEmpty(FileName)) | 51 | if (!String.IsNullOrEmpty(FileName)) |
52 | { | 52 | { |
53 | m_log.Info("[AGENTINVENTORY]: Inventory storage: Attempting to load " + FileName); | 53 | m_log.Info("[AGENT INVENTORY]: Inventory storage: Attempting to load " + FileName); |
54 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 54 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
55 | 55 | ||
56 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 56 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
@@ -161,9 +161,19 @@ namespace OpenSim.Framework.Communications | |||
161 | // See IInventoryServices | 161 | // See IInventoryServices |
162 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); | 162 | public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); |
163 | 163 | ||
164 | // See IInventoryServices | ||
164 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); | 165 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); |
166 | |||
167 | // See IInventoryServices | ||
165 | public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder); | 168 | public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder); |
169 | |||
170 | // See IInventoryServices | ||
171 | public abstract void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder); | ||
172 | |||
173 | // See IInventoryServices | ||
166 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 174 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
175 | |||
176 | // See IInventoryServices | ||
167 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 177 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
168 | 178 | ||
169 | #endregion | 179 | #endregion |
@@ -228,6 +238,36 @@ namespace OpenSim.Framework.Communications | |||
228 | } | 238 | } |
229 | } | 239 | } |
230 | 240 | ||
241 | /// <summary> | ||
242 | /// Purge a folder of all items items and subfolders. | ||
243 | /// | ||
244 | /// FIXME: Really nasty in a sense, because we have to query the database to get information we may | ||
245 | /// already know... Needs heavy refactoring. | ||
246 | /// </summary> | ||
247 | /// <param name="folder"></param> | ||
248 | protected void PurgeFolder(InventoryFolderBase folder) | ||
249 | { | ||
250 | List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); | ||
251 | |||
252 | foreach (InventoryFolderBase subFolder in subFolders) | ||
253 | { | ||
254 | // m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); | ||
255 | |||
256 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
257 | { | ||
258 | plugin.Value.deleteInventoryFolder(subFolder.ID); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | // XXX Temporarily don't delete the items since UserProfileCacheService is still doing this | ||
263 | // List<InventoryItemBase> items = RequestFolderItems(folder.ID); | ||
264 | // | ||
265 | // foreach (InventoryItemBase item : items) | ||
266 | // { | ||
267 | // DeleteItem(item); | ||
268 | // } | ||
269 | } | ||
270 | |||
231 | private void AddNewInventorySet(UsersInventory inventory) | 271 | private void AddNewInventorySet(UsersInventory inventory) |
232 | { | 272 | { |
233 | foreach (InventoryFolderBase folder in inventory.Folders.Values) | 273 | foreach (InventoryFolderBase folder in inventory.Folders.Values) |
@@ -236,6 +276,9 @@ namespace OpenSim.Framework.Communications | |||
236 | } | 276 | } |
237 | } | 277 | } |
238 | 278 | ||
279 | /// <summary> | ||
280 | /// Used to create a new user inventory. | ||
281 | /// </summary> | ||
239 | private class UsersInventory | 282 | private class UsersInventory |
240 | { | 283 | { |
241 | public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>(); | 284 | public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>(); |
diff --git a/OpenSim/Framework/IInventoryData.cs b/OpenSim/Framework/IInventoryData.cs index 6a500f8..d72231d 100644 --- a/OpenSim/Framework/IInventoryData.cs +++ b/OpenSim/Framework/IInventoryData.cs | |||
@@ -144,7 +144,7 @@ namespace OpenSim.Framework | |||
144 | void moveInventoryFolder(InventoryFolderBase folder); | 144 | void moveInventoryFolder(InventoryFolderBase folder); |
145 | 145 | ||
146 | /// <summary> | 146 | /// <summary> |
147 | /// Deletes a folder based on its ID with folder | 147 | /// Deletes a folder. Thie will delete both the folder itself and its contents (items and descendent folders) |
148 | /// </summary> | 148 | /// </summary> |
149 | /// <param name="folder">The id of the folder</param> | 149 | /// <param name="folder">The id of the folder</param> |
150 | void deleteInventoryFolder(LLUUID folder); | 150 | void deleteInventoryFolder(LLUUID folder); |
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 8c8d858..6ed2961 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -108,8 +108,6 @@ namespace OpenSim.Framework | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | |||
112 | |||
113 | public int InvType { | 111 | public int InvType { |
114 | get { | 112 | get { |
115 | return _invType; | 113 | return _invType; |