aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/InventoryService/InventoryService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/InventoryService/InventoryService.cs')
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs73
1 files changed, 67 insertions, 6 deletions
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index b4e2549..f2a7b41 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -85,7 +85,6 @@ namespace OpenSim.Services.InventoryService
85 return userFolders; 85 return userFolders;
86 } 86 }
87 87
88 // See IInventoryServices
89 public virtual bool HasInventoryForUser(UUID userID) 88 public virtual bool HasInventoryForUser(UUID userID)
90 { 89 {
91 return false; 90 return false;
@@ -107,7 +106,7 @@ namespace OpenSim.Services.InventoryService
107 } 106 }
108 107
109 // See IInventoryServices 108 // See IInventoryServices
110 public bool CreateNewUserInventory(UUID user) 109 public bool CreateUserInventory(UUID user)
111 { 110 {
112 InventoryFolderBase existingRootFolder = RequestRootFolder(user); 111 InventoryFolderBase existingRootFolder = RequestRootFolder(user);
113 112
@@ -131,6 +130,68 @@ namespace OpenSim.Services.InventoryService
131 } 130 }
132 131
133 // See IInventoryServices 132 // See IInventoryServices
133
134 /// <summary>
135 /// Return a user's entire inventory synchronously
136 /// </summary>
137 /// <param name="rawUserID"></param>
138 /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
139 public InventoryCollection GetUserInventory(UUID userID)
140 {
141 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Processing request for inventory of {0}", userID);
142
143 // Uncomment me to simulate a slow responding inventory server
144 //Thread.Sleep(16000);
145
146 InventoryCollection invCollection = new InventoryCollection();
147
148 List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
149
150 if (null == allFolders)
151 {
152 m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID);
153
154 return invCollection;
155 }
156
157 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
158
159 foreach (InventoryFolderBase folder in allFolders)
160 {
161 List<InventoryItemBase> items = GetFolderItems(folder.ID);
162
163 if (items != null)
164 {
165 allItems.InsertRange(0, items);
166 }
167 }
168
169 invCollection.UserID = userID;
170 invCollection.Folders = allFolders;
171 invCollection.Items = allItems;
172
173 // foreach (InventoryFolderBase folder in invCollection.Folders)
174 // {
175 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
176 // }
177 //
178 // foreach (InventoryItemBase item in invCollection.Items)
179 // {
180 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
181 // }
182
183 m_log.InfoFormat(
184 "[LOCAL INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items",
185 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
186
187 return invCollection;
188 }
189
190 /// <summary>
191 /// Asynchronous inventory fetch.
192 /// </summary>
193 /// <param name="userID"></param>
194 /// <param name="callback"></param>
134 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 195 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
135 { 196 {
136 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); 197 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
@@ -152,7 +213,7 @@ namespace OpenSim.Services.InventoryService
152 { 213 {
153 rootFolder = new InventoryFolderImpl(folder); 214 rootFolder = new InventoryFolderImpl(folder);
154 folders.Add(rootFolder); 215 folders.Add(rootFolder);
155 items.AddRange(RequestFolderItems(rootFolder.ID)); 216 items.AddRange(GetFolderItems(rootFolder.ID));
156 break; // Only 1 root folder per user 217 break; // Only 1 root folder per user
157 } 218 }
158 } 219 }
@@ -164,7 +225,7 @@ namespace OpenSim.Services.InventoryService
164 if (folder.ID != rootFolder.ID) 225 if (folder.ID != rootFolder.ID)
165 { 226 {
166 folders.Add(new InventoryFolderImpl(folder)); 227 folders.Add(new InventoryFolderImpl(folder));
167 items.AddRange(RequestFolderItems(folder.ID)); 228 items.AddRange(GetFolderItems(folder.ID));
168 } 229 }
169 } 230 }
170 } 231 }
@@ -208,7 +269,7 @@ namespace OpenSim.Services.InventoryService
208 return inventoryList; 269 return inventoryList;
209 } 270 }
210 271
211 public List<InventoryItemBase> RequestFolderItems(UUID folderID) 272 public List<InventoryItemBase> GetFolderItems(UUID folderID)
212 { 273 {
213 List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); 274 List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
214 275
@@ -360,7 +421,7 @@ namespace OpenSim.Services.InventoryService
360 } 421 }
361 } 422 }
362 423
363 List<InventoryItemBase> items = RequestFolderItems(folder.ID); 424 List<InventoryItemBase> items = GetFolderItems(folder.ID);
364 425
365 foreach (InventoryItemBase item in items) 426 foreach (InventoryItemBase item in items)
366 { 427 {