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 | |
parent | * Adds llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z,TF) (diff) | |
download | opensim-SC-4db839c3b84bed8a775074beb1ae0b526bc05e81.zip opensim-SC-4db839c3b84bed8a775074beb1ae0b526bc05e81.tar.gz opensim-SC-4db839c3b84bed8a775074beb1ae0b526bc05e81.tar.bz2 opensim-SC-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 '')
10 files changed, 115 insertions, 15 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 3aed301..dbcb9bd 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -637,7 +637,7 @@ namespace OpenSim.Data.MySQL | |||
637 | } | 637 | } |
638 | 638 | ||
639 | /// <summary> | 639 | /// <summary> |
640 | /// Delete an inventory folder | 640 | /// Deletes an inventory folder |
641 | /// </summary> | 641 | /// </summary> |
642 | /// <param name="folderId">Id of folder to delete</param> | 642 | /// <param name="folderId">Id of folder to delete</param> |
643 | public void deleteInventoryFolder(LLUUID folderID) | 643 | public void deleteInventoryFolder(LLUUID folderID) |
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; |
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index fe892ca..016ecff 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs | |||
@@ -220,6 +220,16 @@ namespace OpenSim.Grid.InventoryServer | |||
220 | MoveExistingInventoryFolder(folder); | 220 | MoveExistingInventoryFolder(folder); |
221 | return true; | 221 | return true; |
222 | } | 222 | } |
223 | |||
224 | /// <summary> | ||
225 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | ||
226 | /// </summary> | ||
227 | /// <param name="userID"></param> | ||
228 | /// <param name="folder"></param> | ||
229 | public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) | ||
230 | { | ||
231 | // XXX No implementation yet (temporarily)! | ||
232 | } | ||
223 | 233 | ||
224 | public bool AddInventoryItem(InventoryItemBase item) | 234 | public bool AddInventoryItem(InventoryItemBase item) |
225 | { | 235 | { |
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index a567eeb..175829b 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -100,6 +100,16 @@ namespace OpenSim.Region.Communications.Local | |||
100 | DeleteItem(item); | 100 | DeleteItem(item); |
101 | } | 101 | } |
102 | 102 | ||
103 | /// <summary> | ||
104 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | ||
105 | /// </summary> | ||
106 | /// <param name="userID"></param> | ||
107 | /// <param name="folder"></param> | ||
108 | public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) | ||
109 | { | ||
110 | PurgeFolder(folder); | ||
111 | } | ||
112 | |||
103 | public override bool HasInventoryForUser(LLUUID userID) | 113 | public override bool HasInventoryForUser(LLUUID userID) |
104 | { | 114 | { |
105 | InventoryFolderBase root = RequestRootFolder(userID); | 115 | InventoryFolderBase root = RequestRootFolder(userID); |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index e0167a7..8c27cb1 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -175,6 +175,16 @@ namespace OpenSim.Region.Communications.OGS1 | |||
175 | e.Source, e.Message); | 175 | e.Source, e.Message); |
176 | } | 176 | } |
177 | } | 177 | } |
178 | |||
179 | /// <summary> | ||
180 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | ||
181 | /// </summary> | ||
182 | /// <param name="userID"></param> | ||
183 | /// <param name="folder"></param> | ||
184 | public void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) | ||
185 | { | ||
186 | // XXX No implementation yet (temporarily)! | ||
187 | } | ||
178 | 188 | ||
179 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 189 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
180 | { | 190 | { |