diff options
Diffstat (limited to 'OpenSim/Grid/InventoryServer/GridInventoryService.cs')
-rw-r--r-- | OpenSim/Grid/InventoryServer/GridInventoryService.cs | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index ffff89f..e30c31e 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs | |||
@@ -43,7 +43,14 @@ namespace OpenSim.Grid.InventoryServer | |||
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, | 46 | /// <summary> |
47 | /// Get a user's inventory. | ||
48 | /// </summary> | ||
49 | /// <param name="userID"></param> | ||
50 | /// <param name="folderList"></param> | ||
51 | /// <param name="itemsList"></param> | ||
52 | /// <returns>true if the inventory was retrieved, false otherwise</returns> | ||
53 | private bool GetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, | ||
47 | out List<InventoryItemBase> itemsList) | 54 | out List<InventoryItemBase> itemsList) |
48 | { | 55 | { |
49 | List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID); | 56 | List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID); |
@@ -93,22 +100,39 @@ namespace OpenSim.Grid.InventoryServer | |||
93 | /// Return a user's entire inventory | 100 | /// Return a user's entire inventory |
94 | /// </summary> | 101 | /// </summary> |
95 | /// <param name="rawUserID"></param> | 102 | /// <param name="rawUserID"></param> |
96 | /// <returns></returns> | 103 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> |
97 | public InventoryCollection GetUserInventory(Guid rawUserID) | 104 | public InventoryCollection GetUserInventory(Guid rawUserID) |
98 | { | 105 | { |
99 | LLUUID userID = new LLUUID(rawUserID); | 106 | LLUUID userID = new LLUUID(rawUserID); |
100 | 107 | ||
101 | m_log.Info("[AGENT INVENTORY]: Processing request for inventory of " + userID.ToString()); | 108 | m_log.InfoFormat("[AGENT INVENTORY]: Processing request for inventory of {0}", userID); |
102 | 109 | ||
103 | InventoryCollection invCollection = new InventoryCollection(); | 110 | InventoryCollection invCollection = new InventoryCollection(); |
104 | List<InventoryFolderBase> folders; | 111 | |
105 | List<InventoryItemBase> allItems; | 112 | List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID); |
106 | if (TryGetUsersInventory(userID, out folders, out allItems)) | 113 | |
114 | if (null == allFolders) | ||
115 | { | ||
116 | m_log.WarnFormat("[AGENT INVENTORY]: No inventory found for user {0}", rawUserID); | ||
117 | |||
118 | return invCollection; | ||
119 | } | ||
120 | |||
121 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | ||
122 | |||
123 | foreach (InventoryFolderBase folder in allFolders) | ||
107 | { | 124 | { |
108 | invCollection.AllItems = allItems; | 125 | List<InventoryItemBase> items = RequestFolderItems(folder.ID); |
109 | invCollection.Folders = folders; | 126 | |
110 | invCollection.UserID = userID; | 127 | if (items != null) |
128 | { | ||
129 | allItems.InsertRange(0, items); | ||
130 | } | ||
111 | } | 131 | } |
132 | |||
133 | invCollection.AllItems = allItems; | ||
134 | invCollection.Folders = allFolders; | ||
135 | invCollection.UserID = userID; | ||
112 | 136 | ||
113 | // foreach (InventoryFolderBase folder in folders) | 137 | // foreach (InventoryFolderBase folder in folders) |
114 | // { | 138 | // { |