diff options
-rw-r--r-- | OpenSim/Framework/Communications/IInventoryServices.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/InventoryServiceBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/GridInventoryService.cs | 42 |
3 files changed, 36 insertions, 12 deletions
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 966ab75..ecc6c71 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -85,8 +85,8 @@ namespace OpenSim.Framework.Communications | |||
85 | /// Returns a list of all the folders in a given user's inventory. | 85 | /// Returns a list of all the folders in a given user's inventory. |
86 | /// </summary> | 86 | /// </summary> |
87 | /// <param name="userId"></param> | 87 | /// <param name="userId"></param> |
88 | /// <returns>A flat list of the user's inventory folder tree. | 88 | /// <returns>A flat list of the user's inventory folder tree, |
89 | /// Null if there is no inventory for this user</returns> | 89 | /// null if there is no inventory for this user</returns> |
90 | List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId); | 90 | List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId); |
91 | } | 91 | } |
92 | } | 92 | } |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index f9a47b1..e50e19e 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -141,7 +141,7 @@ namespace OpenSim.Framework.Communications | |||
141 | 141 | ||
142 | if (null != existingRootFolder) | 142 | if (null != existingRootFolder) |
143 | { | 143 | { |
144 | m_log.ErrorFormat( | 144 | m_log.WarnFormat( |
145 | "[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have " | 145 | "[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have " |
146 | + "a root inventory folder with id {1}", | 146 | + "a root inventory folder with id {1}", |
147 | user, existingRootFolder.ID); | 147 | user, existingRootFolder.ID); |
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 | // { |