diff options
author | Brian McBee | 2007-12-15 04:57:14 +0000 |
---|---|---|
committer | Brian McBee | 2007-12-15 04:57:14 +0000 |
commit | 8a8c89a0f32b528bd588715bdbfc875c852e7187 (patch) | |
tree | b46cb20d03dfdb21a5cbdfa514a8e745070a3713 /OpenSim | |
parent | Set svn:eol-style. Cleaned up set-eol-style.sh a bit. (diff) | |
download | opensim-SC-8a8c89a0f32b528bd588715bdbfc875c852e7187.zip opensim-SC-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.gz opensim-SC-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.bz2 opensim-SC-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.xz |
Grid Inventory feature upgrade: renaming folders should now be correct, subfolders work, moving folders works.
Tested only in MYSQL, but may work in MSSQL and sqlite.
Probably not working in standalone mode.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 32 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/IInventoryServices.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/InventoryServiceBase.cs | 20 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs | 28 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 22 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs | 32 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryItemBase.cs | 6 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/GridInventoryService.cs | 59 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/Main.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 63 | ||||
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalInventoryService.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 3 |
16 files changed, 281 insertions, 21 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index c07a15b..1d2c920 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs | |||
@@ -142,5 +142,15 @@ namespace OpenSim.Framework.Communications.Cache | |||
142 | } | 142 | } |
143 | return itemList; | 143 | return itemList; |
144 | } | 144 | } |
145 | |||
146 | public List<InventoryFolderBase> RequestListOfFolders() | ||
147 | { | ||
148 | List<InventoryFolderBase> folderList = new List<InventoryFolderBase>(); | ||
149 | foreach (InventoryFolderBase folder in SubFolders.Values) | ||
150 | { | ||
151 | folderList.Add(folder); | ||
152 | } | ||
153 | return folderList; | ||
154 | } | ||
145 | } | 155 | } |
146 | } | 156 | } |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 32d941c..bf7f5c1 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -147,6 +147,23 @@ namespace OpenSim.Framework.Communications.Cache | |||
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID) | ||
151 | { | ||
152 | CachedUserInfo userProfile; | ||
153 | |||
154 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | ||
155 | { | ||
156 | if (userProfile.RootFolder != null) | ||
157 | { | ||
158 | InventoryFolderBase baseFolder = new InventoryFolderBase(); | ||
159 | baseFolder.agentID = remoteClient.AgentId; | ||
160 | baseFolder.folderID = folderID; | ||
161 | baseFolder.parentID = parentID; | ||
162 | m_parent.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder); | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | |||
150 | /// <summary> | 167 | /// <summary> |
151 | /// Tell the client about the various child items and folders contained in the requested folder. | 168 | /// Tell the client about the various child items and folders contained in the requested folder. |
152 | /// </summary> | 169 | /// </summary> |
@@ -163,14 +180,15 @@ namespace OpenSim.Framework.Communications.Cache | |||
163 | if (folderID == libraryRoot.folderID) | 180 | if (folderID == libraryRoot.folderID) |
164 | { | 181 | { |
165 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, | 182 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, |
166 | libraryRoot.RequestListOfItems(), libraryRoot.SubFoldersCount); | 183 | libraryRoot.RequestListOfItems(), libraryRoot.RequestListOfFolders(), libraryRoot.SubFoldersCount); |
167 | 184 | ||
168 | return; | 185 | return; |
169 | } | 186 | } |
170 | 187 | ||
171 | if ((fold = libraryRoot.HasSubFolder(folderID)) != null) | 188 | if ((fold = libraryRoot.HasSubFolder(folderID)) != null) |
172 | { | 189 | { |
173 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.SubFoldersCount); | 190 | System.Console.WriteLine("fetching librarysubfolder"); |
191 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); | ||
174 | 192 | ||
175 | return; | 193 | return; |
176 | } | 194 | } |
@@ -182,19 +200,19 @@ namespace OpenSim.Framework.Communications.Cache | |||
182 | { | 200 | { |
183 | if (userProfile.RootFolder.folderID == folderID) | 201 | if (userProfile.RootFolder.folderID == folderID) |
184 | { | 202 | { |
203 | System.Console.Write("fetching root folder"); | ||
185 | if (fetchItems) | 204 | if (fetchItems) |
186 | { | 205 | { |
187 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, | 206 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, |
188 | userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.SubFoldersCount); | 207 | userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.RequestListOfFolders(), userProfile.RootFolder.SubFoldersCount); |
189 | } | 208 | } |
190 | } | 209 | } |
191 | else | 210 | else |
192 | { | 211 | { |
193 | InventoryFolderImpl folder = userProfile.RootFolder.HasSubFolder(folderID); | 212 | if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) |
194 | |||
195 | if (fetchItems && folder != null) | ||
196 | { | 213 | { |
197 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems(), folder.SubFoldersCount); | 214 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); |
215 | return; | ||
198 | } | 216 | } |
199 | } | 217 | } |
200 | } | 218 | } |
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 191cdf2..9c493d4 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -40,6 +40,7 @@ namespace OpenSim.Framework.Communications | |||
40 | { | 40 | { |
41 | void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); | 41 | void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); |
42 | void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); | 42 | void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); |
43 | void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder); | ||
43 | void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 44 | void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
44 | void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 45 | void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
45 | void CreateNewUserInventory(LLUUID user); | 46 | void CreateNewUserInventory(LLUUID user); |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 28b81d4..1e13031 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -130,6 +130,17 @@ namespace OpenSim.Framework.Communications | |||
130 | /// <summary> | 130 | /// <summary> |
131 | /// | 131 | /// |
132 | /// </summary> | 132 | /// </summary> |
133 | public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) | ||
134 | { | ||
135 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
136 | { | ||
137 | plugin.Value.moveInventoryFolder(folder); | ||
138 | } | ||
139 | } | ||
140 | |||
141 | /// <summary> | ||
142 | /// | ||
143 | /// </summary> | ||
133 | /// <param name="parentFolderID"></param> | 144 | /// <param name="parentFolderID"></param> |
134 | /// <returns></returns> | 145 | /// <returns></returns> |
135 | public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) | 146 | public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) |
@@ -161,6 +172,14 @@ namespace OpenSim.Framework.Communications | |||
161 | } | 172 | } |
162 | } | 173 | } |
163 | 174 | ||
175 | public void MoveFolder(InventoryFolderBase folder) | ||
176 | { | ||
177 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
178 | { | ||
179 | plugin.Value.moveInventoryFolder(folder); | ||
180 | } | ||
181 | } | ||
182 | |||
164 | public void AddItem(InventoryItemBase item) | 183 | public void AddItem(InventoryItemBase item) |
165 | { | 184 | { |
166 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 185 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) |
@@ -251,6 +270,7 @@ namespace OpenSim.Framework.Communications | |||
251 | InventoryItemInfo itemCallBack); | 270 | InventoryItemInfo itemCallBack); |
252 | 271 | ||
253 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); | 272 | public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); |
273 | public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder); | ||
254 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); | 274 | public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); |
255 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); | 275 | public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); |
256 | } | 276 | } |
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs index ef2a0f3..69b53a3 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs | |||
@@ -604,6 +604,34 @@ namespace OpenSim.Framework.Data.MSSQL | |||
604 | 604 | ||
605 | } | 605 | } |
606 | 606 | ||
607 | /// <summary> | ||
608 | /// Updates an inventory folder | ||
609 | /// </summary> | ||
610 | /// <param name="folder">Folder to update</param> | ||
611 | |||
612 | public void moveInventoryFolder(InventoryFolderBase folder) | ||
613 | { | ||
614 | SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + | ||
615 | "parentFolderID = @parentFolderID," + | ||
616 | "folderID = @keyFolderID;", database.getConnection()); | ||
617 | SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToStringHyphenated()); | ||
618 | SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToStringHyphenated()); | ||
619 | SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToStringHyphenated()); | ||
620 | command.Parameters.Add(param1); | ||
621 | command.Parameters.Add(param2); | ||
622 | command.Parameters.Add(param3); | ||
623 | |||
624 | try | ||
625 | { | ||
626 | command.ExecuteNonQuery(); | ||
627 | } | ||
628 | catch (Exception e) | ||
629 | { | ||
630 | MainLog.Instance.Error(e.ToString()); | ||
631 | } | ||
632 | |||
633 | |||
634 | } | ||
607 | 635 | ||
608 | /// <summary> | 636 | /// <summary> |
609 | /// Append a list of all the child folders of a parent folder | 637 | /// Append a list of all the child folders of a parent folder |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index edf7c43..6828f66 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | |||
@@ -529,6 +529,28 @@ namespace OpenSim.Framework.Data.MySQL | |||
529 | addInventoryFolder(folder); | 529 | addInventoryFolder(folder); |
530 | } | 530 | } |
531 | 531 | ||
532 | /// Creates a new inventory folder | ||
533 | /// </summary> | ||
534 | /// <param name="folder">Folder to create</param> | ||
535 | public void moveInventoryFolder(InventoryFolderBase folder) | ||
536 | { | ||
537 | string sql = | ||
538 | "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID"; | ||
539 | |||
540 | MySqlCommand cmd = new MySqlCommand(sql, database.Connection); | ||
541 | cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToStringHyphenated()); | ||
542 | cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated()); | ||
543 | |||
544 | |||
545 | try | ||
546 | { | ||
547 | cmd.ExecuteNonQuery(); | ||
548 | } | ||
549 | catch (Exception e) | ||
550 | { | ||
551 | MainLog.Instance.Error(e.ToString()); | ||
552 | } | ||
553 | } | ||
532 | 554 | ||
533 | /// <summary> | 555 | /// <summary> |
534 | /// Append a list of all the child folders of a parent folder | 556 | /// Append a list of all the child folders of a parent folder |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index b9a1daa..fe27e32 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs | |||
@@ -141,6 +141,24 @@ namespace OpenSim.Framework.Data.SQLite | |||
141 | invFoldersDa.Update(ds, "inventoryfolders"); | 141 | invFoldersDa.Update(ds, "inventoryfolders"); |
142 | } | 142 | } |
143 | 143 | ||
144 | private void moveFolder(InventoryFolderBase folder) | ||
145 | { | ||
146 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
147 | |||
148 | DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.folderID); | ||
149 | if (inventoryRow == null) | ||
150 | { | ||
151 | inventoryRow = inventoryFolderTable.NewRow(); | ||
152 | fillFolderRow(inventoryRow, folder); | ||
153 | inventoryFolderTable.Rows.Add(inventoryRow); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | moveFolderRow(inventoryRow, folder); | ||
158 | } | ||
159 | |||
160 | invFoldersDa.Update(ds, "inventoryfolders"); | ||
161 | } | ||
144 | private void addItem(InventoryItemBase item) | 162 | private void addItem(InventoryItemBase item) |
145 | { | 163 | { |
146 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; | 164 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; |
@@ -404,6 +422,15 @@ namespace OpenSim.Framework.Data.SQLite | |||
404 | } | 422 | } |
405 | 423 | ||
406 | /// <summary> | 424 | /// <summary> |
425 | /// Moves a folder based on its ID with folder | ||
426 | /// </summary> | ||
427 | /// <param name="folder">The inventory folder</param> | ||
428 | public void moveInventoryFolder(InventoryFolderBase folder) | ||
429 | { | ||
430 | moveFolder(folder); | ||
431 | } | ||
432 | |||
433 | /// <summary> | ||
407 | /// Delete a folder | 434 | /// Delete a folder |
408 | /// </summary> | 435 | /// </summary> |
409 | /// <remarks> | 436 | /// <remarks> |
@@ -534,6 +561,11 @@ namespace OpenSim.Framework.Data.SQLite | |||
534 | row["version"] = folder.version; | 561 | row["version"] = folder.version; |
535 | } | 562 | } |
536 | 563 | ||
564 | private void moveFolderRow(DataRow row, InventoryFolderBase folder) | ||
565 | { | ||
566 | row["UUID"] = folder.folderID; | ||
567 | row["parentID"] = folder.parentID; | ||
568 | } | ||
537 | 569 | ||
538 | /*********************************************************************** | 570 | /*********************************************************************** |
539 | * | 571 | * |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8075d0d..738df13 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -330,6 +330,9 @@ namespace OpenSim.Framework | |||
330 | public delegate void UpdateInventoryFolder( | 330 | public delegate void UpdateInventoryFolder( |
331 | IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); | 331 | IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); |
332 | 332 | ||
333 | public delegate void MoveInventoryFolder( | ||
334 | IClientAPI remoteClient, LLUUID folderID, LLUUID parentID); | ||
335 | |||
333 | public delegate void CreateNewInventoryItem( | 336 | public delegate void CreateNewInventoryItem( |
334 | IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, | 337 | IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, |
335 | sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); | 338 | sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); |
@@ -432,6 +435,7 @@ namespace OpenSim.Framework | |||
432 | event CreateNewInventoryItem OnCreateNewInventoryItem; | 435 | event CreateNewInventoryItem OnCreateNewInventoryItem; |
433 | event CreateInventoryFolder OnCreateNewInventoryFolder; | 436 | event CreateInventoryFolder OnCreateNewInventoryFolder; |
434 | event UpdateInventoryFolder OnUpdateInventoryFolder; | 437 | event UpdateInventoryFolder OnUpdateInventoryFolder; |
438 | event MoveInventoryFolder OnMoveInventoryFolder; | ||
435 | event FetchInventoryDescendents OnFetchInventoryDescendents; | 439 | event FetchInventoryDescendents OnFetchInventoryDescendents; |
436 | event PurgeInventoryDescendents OnPurgeInventoryDescendents; | 440 | event PurgeInventoryDescendents OnPurgeInventoryDescendents; |
437 | event FetchInventory OnFetchInventory; | 441 | event FetchInventory OnFetchInventory; |
@@ -522,7 +526,7 @@ namespace OpenSim.Framework | |||
522 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | 526 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
523 | LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); | 527 | LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); |
524 | 528 | ||
525 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, int subFoldersCount); | 529 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount); |
526 | void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); | 530 | void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); |
527 | 531 | ||
528 | /// <summary> | 532 | /// <summary> |
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index adcc289..8cb3e73 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -239,6 +239,12 @@ namespace OpenSim.Framework | |||
239 | void updateInventoryFolder(InventoryFolderBase folder); | 239 | void updateInventoryFolder(InventoryFolderBase folder); |
240 | 240 | ||
241 | /// <summary> | 241 | /// <summary> |
242 | /// Updates a folder based on its ID with folder | ||
243 | /// </summary> | ||
244 | /// <param name="folder">The inventory folder</param> | ||
245 | void moveInventoryFolder(InventoryFolderBase folder); | ||
246 | |||
247 | /// <summary> | ||
242 | /// Deletes a folder based on its ID with folder | 248 | /// Deletes a folder based on its ID with folder |
243 | /// </summary> | 249 | /// </summary> |
244 | /// <param name="folder">The id of the folder</param> | 250 | /// <param name="folder">The id of the folder</param> |
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index 8756ecb..6ae1d82 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs | |||
@@ -45,22 +45,33 @@ namespace OpenSim.Grid.InventoryServer | |||
45 | 45 | ||
46 | private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, out List<InventoryItemBase> itemsList) | 46 | private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, out List<InventoryItemBase> itemsList) |
47 | { | 47 | { |
48 | List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID); | 48 | List<InventoryFolderBase> rootFolders = RequestFirstLevelFolders(userID); |
49 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | 49 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); |
50 | List<InventoryFolderBase> allFolders = new List<InventoryFolderBase>(); | ||
50 | 51 | ||
51 | if (folders != null) | 52 | if (rootFolders != null) |
52 | { | 53 | { |
53 | foreach (InventoryFolderBase folder in folders) | 54 | allFolders.InsertRange(0, rootFolders); |
55 | foreach (InventoryFolderBase subfolder in rootFolders) | ||
54 | { | 56 | { |
55 | List<InventoryItemBase> items = RequestFolderItems(folder.folderID); | 57 | List<InventoryFolderBase> subFolders = GetAllFolders(subfolder.folderID); |
56 | if (items != null) | 58 | if (subFolders != null) |
57 | { | 59 | { |
58 | allItems.InsertRange(0, items); | 60 | allFolders.InsertRange(0, subFolders); |
59 | } | 61 | } |
60 | } | 62 | } |
61 | } | 63 | } |
62 | 64 | ||
63 | folderList = folders; | 65 | foreach (InventoryFolderBase folder in allFolders) |
66 | { | ||
67 | List<InventoryItemBase> items = RequestFolderItems(folder.folderID); | ||
68 | if (items != null) | ||
69 | { | ||
70 | allItems.InsertRange(0, items); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | folderList = allFolders; | ||
64 | itemsList = allItems; | 75 | itemsList = allItems; |
65 | if (folderList != null) | 76 | if (folderList != null) |
66 | { | 77 | { |
@@ -72,6 +83,26 @@ namespace OpenSim.Grid.InventoryServer | |||
72 | } | 83 | } |
73 | } | 84 | } |
74 | 85 | ||
86 | private List<InventoryFolderBase> GetAllFolders(LLUUID folder) | ||
87 | { | ||
88 | List<InventoryFolderBase> allFolders = new List<InventoryFolderBase>(); | ||
89 | List<InventoryFolderBase> folders = RequestSubFolders(folder); | ||
90 | if (folders != null) | ||
91 | { | ||
92 | allFolders.InsertRange(0, folders); | ||
93 | foreach (InventoryFolderBase subfolder in folders) | ||
94 | { | ||
95 | List<InventoryFolderBase> subFolders = GetAllFolders(subfolder.folderID); | ||
96 | if (subFolders != null) | ||
97 | { | ||
98 | allFolders.InsertRange(0, subFolders); | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | return allFolders; | ||
103 | } | ||
104 | |||
105 | |||
75 | public InventoryCollection GetUserInventory(Guid rawUserID) | 106 | public InventoryCollection GetUserInventory(Guid rawUserID) |
76 | { | 107 | { |
77 | Console.WriteLine("Request for Inventory for " + rawUserID.ToString()); | 108 | Console.WriteLine("Request for Inventory for " + rawUserID.ToString()); |
@@ -104,6 +135,11 @@ namespace OpenSim.Grid.InventoryServer | |||
104 | AddFolder(folder); | 135 | AddFolder(folder); |
105 | } | 136 | } |
106 | 137 | ||
138 | public override void MoveExistingInventoryFolder(InventoryFolderBase folder) | ||
139 | { | ||
140 | MoveFolder(folder); | ||
141 | } | ||
142 | |||
107 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 143 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
108 | { | 144 | { |
109 | AddItem(item); | 145 | AddItem(item); |
@@ -111,11 +147,16 @@ namespace OpenSim.Grid.InventoryServer | |||
111 | 147 | ||
112 | public bool AddInventoryFolder( InventoryFolderBase folder) | 148 | public bool AddInventoryFolder( InventoryFolderBase folder) |
113 | { | 149 | { |
114 | Console.WriteLine("creating new folder for " + folder.agentID.ToString()); | ||
115 | AddNewInventoryFolder(folder.agentID, folder); | 150 | AddNewInventoryFolder(folder.agentID, folder); |
116 | return true; | 151 | return true; |
117 | } | 152 | } |
118 | 153 | ||
154 | public bool MoveInventoryFolder(InventoryFolderBase folder) | ||
155 | { | ||
156 | MoveExistingInventoryFolder(folder); | ||
157 | return true; | ||
158 | } | ||
159 | |||
119 | public bool AddInventoryItem( InventoryItemBase item) | 160 | public bool AddInventoryItem( InventoryItemBase item) |
120 | { | 161 | { |
121 | Console.WriteLine("creating new item for " + item.avatarID.ToString()); | 162 | Console.WriteLine("creating new item for " + item.avatarID.ToString()); |
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 58b63f4..df854f9 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs | |||
@@ -88,6 +88,10 @@ namespace OpenSim.Grid.InventoryServer | |||
88 | m_inventoryService.AddInventoryFolder)); | 88 | m_inventoryService.AddInventoryFolder)); |
89 | 89 | ||
90 | httpServer.AddStreamHandler( | 90 | httpServer.AddStreamHandler( |
91 | new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/MoveFolder/", | ||
92 | m_inventoryService.MoveInventoryFolder)); | ||
93 | |||
94 | httpServer.AddStreamHandler( | ||
91 | new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/NewItem/", | 95 | new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/NewItem/", |
92 | m_inventoryService.AddInventoryItem)); | 96 | m_inventoryService.AddInventoryItem)); |
93 | httpServer.AddStreamHandler( | 97 | httpServer.AddStreamHandler( |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 0514df5..1746db8 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -502,6 +502,7 @@ namespace OpenSim.Region.ClientStack | |||
502 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | 502 | public event CreateNewInventoryItem OnCreateNewInventoryItem; |
503 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | 503 | public event CreateInventoryFolder OnCreateNewInventoryFolder; |
504 | public event UpdateInventoryFolder OnUpdateInventoryFolder; | 504 | public event UpdateInventoryFolder OnUpdateInventoryFolder; |
505 | public event MoveInventoryFolder OnMoveInventoryFolder; | ||
505 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | 506 | public event FetchInventoryDescendents OnFetchInventoryDescendents; |
506 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; | 507 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; |
507 | public event FetchInventory OnFetchInventory; | 508 | public event FetchInventory OnFetchInventory; |
@@ -892,7 +893,7 @@ namespace OpenSim.Region.ClientStack | |||
892 | /// <param name="subFoldersCount">The number of subfolders contained in the given folder. This is necessary since | 893 | /// <param name="subFoldersCount">The number of subfolders contained in the given folder. This is necessary since |
893 | /// the client is expecting inventory packets which incorporate this number into the descendents field, even though | 894 | /// the client is expecting inventory packets which incorporate this number into the descendents field, even though |
894 | /// we send back no details of the folders themselves (only the items).</param> | 895 | /// we send back no details of the folders themselves (only the items).</param> |
895 | public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, int subFoldersCount) | 896 | public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) |
896 | { | 897 | { |
897 | Encoding enc = Encoding.ASCII; | 898 | Encoding enc = Encoding.ASCII; |
898 | uint FULL_MASK_PERMISSIONS = 2147483647; | 899 | uint FULL_MASK_PERMISSIONS = 2147483647; |
@@ -931,14 +932,14 @@ namespace OpenSim.Region.ClientStack | |||
931 | descend.ItemData[i].FolderID = item.parentFolderID; | 932 | descend.ItemData[i].FolderID = item.parentFolderID; |
932 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 933 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
933 | descend.ItemData[i].GroupMask = 0; | 934 | descend.ItemData[i].GroupMask = 0; |
934 | descend.ItemData[i].InvType = (sbyte) item.invType; | 935 | descend.ItemData[i].InvType = (sbyte)item.invType; |
935 | descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); | 936 | descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); |
936 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; | 937 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; |
937 | descend.ItemData[i].OwnerID = item.avatarID; | 938 | descend.ItemData[i].OwnerID = item.avatarID; |
938 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; | 939 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; |
939 | descend.ItemData[i].SalePrice = 0; | 940 | descend.ItemData[i].SalePrice = 0; |
940 | descend.ItemData[i].SaleType = 0; | 941 | descend.ItemData[i].SaleType = 0; |
941 | descend.ItemData[i].Type = (sbyte) item.assetType; | 942 | descend.ItemData[i].Type = (sbyte)item.assetType; |
942 | descend.ItemData[i].CRC = | 943 | descend.ItemData[i].CRC = |
943 | 944 | ||
944 | Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, | 945 | Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, |
@@ -976,6 +977,47 @@ namespace OpenSim.Region.ClientStack | |||
976 | { | 977 | { |
977 | OutPacket(descend, ThrottleOutPacketType.Asset); | 978 | OutPacket(descend, ThrottleOutPacketType.Asset); |
978 | } | 979 | } |
980 | |||
981 | //send subfolders | ||
982 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); | ||
983 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; | ||
984 | i = 0; | ||
985 | count = 0; | ||
986 | foreach (InventoryFolderBase folder in folders) | ||
987 | { | ||
988 | descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); | ||
989 | descend.FolderData[i].FolderID = folder.folderID; | ||
990 | descend.FolderData[i].Name = Helpers.StringToField(folder.name); | ||
991 | descend.FolderData[i].ParentID = folder.parentID; | ||
992 | descend.FolderData[i].Type = (sbyte)folder.type; | ||
993 | i++; | ||
994 | count++; | ||
995 | if (i == 40) | ||
996 | { | ||
997 | OutPacket(descend, ThrottleOutPacketType.Asset); | ||
998 | |||
999 | if ((folders.Count - count) > 0) | ||
1000 | { | ||
1001 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); | ||
1002 | if ((folders.Count - count) < 40) | ||
1003 | { | ||
1004 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[items.Count - count]; | ||
1005 | descend.AgentData.Descendents = folders.Count - count; | ||
1006 | } | ||
1007 | else | ||
1008 | { | ||
1009 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40]; | ||
1010 | descend.AgentData.Descendents = 40; | ||
1011 | } | ||
1012 | i = 0; | ||
1013 | } | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | if (i < 40) | ||
1018 | { | ||
1019 | OutPacket(descend, ThrottleOutPacketType.Asset); | ||
1020 | } | ||
979 | } | 1021 | } |
980 | 1022 | ||
981 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) | 1023 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) |
@@ -2821,6 +2863,17 @@ namespace OpenSim.Region.ClientStack | |||
2821 | } | 2863 | } |
2822 | } | 2864 | } |
2823 | break; | 2865 | break; |
2866 | case PacketType.MoveInventoryFolder: | ||
2867 | if (OnMoveInventoryFolder != null) | ||
2868 | { | ||
2869 | MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack; | ||
2870 | for (int i = 0; i < invFolder.InventoryData.Length; i++) | ||
2871 | { | ||
2872 | OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID, | ||
2873 | invFolder.InventoryData[i].ParentID); | ||
2874 | } | ||
2875 | } | ||
2876 | break; | ||
2824 | case PacketType.CreateInventoryItem: | 2877 | case PacketType.CreateInventoryItem: |
2825 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; | 2878 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; |
2826 | if (OnCreateNewInventoryItem != null) | 2879 | if (OnCreateNewInventoryItem != null) |
@@ -3267,6 +3320,10 @@ namespace OpenSim.Region.ClientStack | |||
3267 | // TODO: handle this packet | 3320 | // TODO: handle this packet |
3268 | MainLog.Instance.Warn("CLIENT", "unhandled RequestRegionInfo packet"); | 3321 | MainLog.Instance.Warn("CLIENT", "unhandled RequestRegionInfo packet"); |
3269 | break; | 3322 | break; |
3323 | case PacketType.InventoryDescendents: | ||
3324 | // TODO: handle this packet | ||
3325 | MainLog.Instance.Warn("CLIENT", "unhandled InventoryDescent packet"); | ||
3326 | break; | ||
3270 | default: | 3327 | default: |
3271 | MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString()); | 3328 | MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString()); |
3272 | break; | 3329 | break; |
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index e82d267..08bd850 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -68,6 +68,11 @@ namespace OpenSim.Region.Communications.Local | |||
68 | AddFolder(folder); | 68 | AddFolder(folder); |
69 | } | 69 | } |
70 | 70 | ||
71 | public override void MoveExistingInventoryFolder(InventoryFolderBase folder) | ||
72 | { | ||
73 | MoveFolder(folder); | ||
74 | } | ||
75 | |||
71 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 76 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
72 | { | 77 | { |
73 | AddItem(item); | 78 | AddItem(item); |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index d45e150..4f5d9ab 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -126,6 +126,16 @@ namespace OpenSim.Region.Communications.OGS1 | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) | ||
130 | { | ||
131 | try | ||
132 | { | ||
133 | RestObjectPoster.BeginPostObject<InventoryFolderBase>(_inventoryServerUrl + "/MoveFolder/", folder); | ||
134 | } | ||
135 | catch (Exception) | ||
136 | { | ||
137 | } | ||
138 | } | ||
129 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 139 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
130 | { | 140 | { |
131 | try | 141 | try |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 59548a2..aad977a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1102,6 +1102,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1102 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; | 1102 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
1103 | client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; | 1103 | client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; |
1104 | client.OnUpdateInventoryFolder += CommsManager.UserProfileCacheService.HandleUpdateInventoryFolder; | 1104 | client.OnUpdateInventoryFolder += CommsManager.UserProfileCacheService.HandleUpdateInventoryFolder; |
1105 | client.OnMoveInventoryFolder += CommsManager.UserProfileCacheService.HandleMoveInventoryFolder; | ||
1105 | client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents; | 1106 | client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents; |
1106 | client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents; | 1107 | client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents; |
1107 | client.OnRequestTaskInventory += RequestTaskInventory; | 1108 | client.OnRequestTaskInventory += RequestTaskInventory; |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 9864074..9b2cdda 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -108,6 +108,7 @@ namespace SimpleApp | |||
108 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | 108 | public event CreateNewInventoryItem OnCreateNewInventoryItem; |
109 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | 109 | public event CreateInventoryFolder OnCreateNewInventoryFolder; |
110 | public event UpdateInventoryFolder OnUpdateInventoryFolder; | 110 | public event UpdateInventoryFolder OnUpdateInventoryFolder; |
111 | public event MoveInventoryFolder OnMoveInventoryFolder; | ||
111 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | 112 | public event FetchInventoryDescendents OnFetchInventoryDescendents; |
112 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; | 113 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; |
113 | public event FetchInventory OnFetchInventory; | 114 | public event FetchInventory OnFetchInventory; |
@@ -317,7 +318,7 @@ namespace SimpleApp | |||
317 | { | 318 | { |
318 | } | 319 | } |
319 | 320 | ||
320 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, int subFoldersCount) | 321 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) |
321 | { | 322 | { |
322 | } | 323 | } |
323 | 324 | ||