diff options
Diffstat (limited to 'OpenSim/Grid/InventoryServer/GridInventoryService.cs')
-rw-r--r-- | OpenSim/Grid/InventoryServer/GridInventoryService.cs | 66 |
1 files changed, 8 insertions, 58 deletions
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index d9510e9..f0eef31 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs | |||
@@ -28,8 +28,11 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Threading; | ||
32 | |||
31 | using libsecondlife; | 33 | using libsecondlife; |
32 | using log4net; | 34 | using log4net; |
35 | |||
33 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
35 | 38 | ||
@@ -48,71 +51,18 @@ namespace OpenSim.Grid.InventoryServer | |||
48 | } | 51 | } |
49 | 52 | ||
50 | /// <summary> | 53 | /// <summary> |
51 | /// Get a user's inventory. | ||
52 | /// </summary> | ||
53 | /// <param name="userID"></param> | ||
54 | /// <param name="folderList"></param> | ||
55 | /// <param name="itemsList"></param> | ||
56 | /// <returns>true if the inventory was retrieved, false otherwise</returns> | ||
57 | private bool GetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, | ||
58 | out List<InventoryItemBase> itemsList) | ||
59 | { | ||
60 | List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID); | ||
61 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | ||
62 | |||
63 | foreach (InventoryFolderBase folder in allFolders) | ||
64 | { | ||
65 | List<InventoryItemBase> items = RequestFolderItems(folder.ID); | ||
66 | if (items != null) | ||
67 | { | ||
68 | allItems.InsertRange(0, items); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | folderList = allFolders; | ||
73 | itemsList = allItems; | ||
74 | if (folderList != null) | ||
75 | { | ||
76 | return true; | ||
77 | } | ||
78 | else | ||
79 | { | ||
80 | return false; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | private List<InventoryFolderBase> GetAllFolders(LLUUID folder) | ||
85 | { | ||
86 | List<InventoryFolderBase> allFolders = new List<InventoryFolderBase>(); | ||
87 | List<InventoryFolderBase> folders = RequestSubFolders(folder); | ||
88 | if (folders != null) | ||
89 | { | ||
90 | allFolders.InsertRange(0, folders); | ||
91 | foreach (InventoryFolderBase subfolder in folders) | ||
92 | { | ||
93 | List<InventoryFolderBase> subFolders = GetAllFolders(subfolder.ID); | ||
94 | if (subFolders != null) | ||
95 | { | ||
96 | allFolders.InsertRange(0, subFolders); | ||
97 | } | ||
98 | } | ||
99 | } | ||
100 | return allFolders; | ||
101 | } | ||
102 | |||
103 | /// <summary> | ||
104 | /// Return a user's entire inventory | 54 | /// Return a user's entire inventory |
105 | /// </summary> | 55 | /// </summary> |
106 | /// <param name="rawUserID"></param> | 56 | /// <param name="rawUserID"></param> |
107 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> | 57 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> |
108 | public InventoryCollection GetUserInventory(Guid rawUserID) | 58 | public InventoryCollection GetUserInventory(Guid rawUserID) |
109 | { | 59 | { |
110 | // uncomment me to simulate an overloaded inventory server | ||
111 | //Thread.Sleep(20000); | ||
112 | |||
113 | LLUUID userID = new LLUUID(rawUserID); | 60 | LLUUID userID = new LLUUID(rawUserID); |
114 | 61 | ||
115 | m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID); | 62 | m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID); |
63 | |||
64 | // uncomment me to simulate an overloaded inventory server | ||
65 | //Thread.Sleep(20000); | ||
116 | 66 | ||
117 | InventoryCollection invCollection = new InventoryCollection(); | 67 | InventoryCollection invCollection = new InventoryCollection(); |
118 | 68 | ||