diff options
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | 81 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 16 |
2 files changed, 94 insertions, 3 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 574de89..c694d27 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -205,7 +205,7 @@ namespace OpenSim.Services.Connectors | |||
205 | InventoryCollection inventory = new InventoryCollection(); | 205 | InventoryCollection inventory = new InventoryCollection(); |
206 | inventory.Folders = new List<InventoryFolderBase>(); | 206 | inventory.Folders = new List<InventoryFolderBase>(); |
207 | inventory.Items = new List<InventoryItemBase>(); | 207 | inventory.Items = new List<InventoryItemBase>(); |
208 | inventory.UserID = principalID; | 208 | inventory.OwnerID = principalID; |
209 | 209 | ||
210 | try | 210 | try |
211 | { | 211 | { |
@@ -235,7 +235,86 @@ namespace OpenSim.Services.Connectors | |||
235 | 235 | ||
236 | return inventory; | 236 | return inventory; |
237 | } | 237 | } |
238 | |||
239 | public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) | ||
240 | { | ||
241 | InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length]; | ||
242 | //m_log.DebugFormat("[XXX]: In GetMultipleFoldersContent {0}", folderIDs.Length); | ||
243 | try | ||
244 | { | ||
245 | Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEFOLDERSCONTENT", | ||
246 | new Dictionary<string, object> { | ||
247 | { "PRINCIPAL", principalID.ToString() }, | ||
248 | { "FOLDERS", String.Join(",", folderIDs) }, | ||
249 | { "COUNT", folderIDs.Length.ToString() } | ||
250 | }); | ||
251 | |||
252 | if (!CheckReturn(resultSet)) | ||
253 | return null; | ||
238 | 254 | ||
255 | int i = 0; | ||
256 | foreach (KeyValuePair<string, object> kvp in resultSet) | ||
257 | { | ||
258 | InventoryCollection inventory = new InventoryCollection(); | ||
259 | if (kvp.Key.StartsWith("F_")) | ||
260 | { | ||
261 | UUID fid = UUID.Zero; | ||
262 | if (UUID.TryParse(kvp.Key.Substring(2), out fid) && fid == folderIDs[i]) | ||
263 | { | ||
264 | inventory.Folders = new List<InventoryFolderBase>(); | ||
265 | inventory.Items = new List<InventoryItemBase>(); | ||
266 | |||
267 | Dictionary<string, object> ret = (Dictionary<string, object>)kvp.Value; | ||
268 | |||
269 | if (ret.ContainsKey("FID")) | ||
270 | { | ||
271 | if (!UUID.TryParse(ret["FID"].ToString(), out inventory.FolderID)) | ||
272 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Could not parse folder id {0}", ret["FID"].ToString()); | ||
273 | } | ||
274 | else | ||
275 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: FID key not present in response"); | ||
276 | |||
277 | inventory.Version = -1; | ||
278 | if (ret.ContainsKey("VERSION")) | ||
279 | Int32.TryParse(ret["VERSION"].ToString(), out inventory.Version); | ||
280 | if (ret.ContainsKey("OWNER")) | ||
281 | UUID.TryParse(ret["OWNER"].ToString(), out inventory.OwnerID); | ||
282 | |||
283 | //m_log.DebugFormat("[XXX]: Received {0} ({1}) {2} {3}", inventory.FolderID, fid, inventory.Version, inventory.OwnerID); | ||
284 | |||
285 | Dictionary<string, object> folders = | ||
286 | (Dictionary<string, object>)ret["FOLDERS"]; | ||
287 | Dictionary<string, object> items = | ||
288 | (Dictionary<string, object>)ret["ITEMS"]; | ||
289 | |||
290 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i | ||
291 | { | ||
292 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); | ||
293 | } | ||
294 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | ||
295 | { | ||
296 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | ||
297 | } | ||
298 | |||
299 | inventoryArr[i] = inventory; | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Folder id does not match. Expected {0} got {1}", | ||
304 | folderIDs[i], fid); | ||
305 | } | ||
306 | |||
307 | i += 1; | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | catch (Exception e) | ||
312 | { | ||
313 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleFoldersContent: {0}", e.Message); | ||
314 | } | ||
315 | |||
316 | return inventoryArr; | ||
317 | } | ||
239 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | 318 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) |
240 | { | 319 | { |
241 | Dictionary<string,object> ret = MakeRequest("GETFOLDERITEMS", | 320 | Dictionary<string,object> ret = MakeRequest("GETFOLDERITEMS", |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 9ded1c4..0331c66 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -340,7 +340,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
340 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 340 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
341 | { | 341 | { |
342 | InventoryCollection inventory = new InventoryCollection(); | 342 | InventoryCollection inventory = new InventoryCollection(); |
343 | inventory.UserID = userID; | 343 | inventory.OwnerID = userID; |
344 | 344 | ||
345 | NameValueCollection requestArgs = new NameValueCollection | 345 | NameValueCollection requestArgs = new NameValueCollection |
346 | { | 346 | { |
@@ -371,6 +371,18 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
371 | return inventory; | 371 | return inventory; |
372 | } | 372 | } |
373 | 373 | ||
374 | public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) | ||
375 | { | ||
376 | InventoryCollection[] invColl = new InventoryCollection[folderIDs.Length]; | ||
377 | int i = 0; | ||
378 | foreach (UUID fid in folderIDs) | ||
379 | { | ||
380 | invColl[i++] = GetFolderContent(principalID, fid); | ||
381 | } | ||
382 | |||
383 | return invColl; | ||
384 | } | ||
385 | |||
374 | /// <summary> | 386 | /// <summary> |
375 | /// Gets the items inside a folder | 387 | /// Gets the items inside a folder |
376 | /// </summary> | 388 | /// </summary> |
@@ -380,7 +392,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
380 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | 392 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) |
381 | { | 393 | { |
382 | InventoryCollection inventory = new InventoryCollection(); | 394 | InventoryCollection inventory = new InventoryCollection(); |
383 | inventory.UserID = userID; | 395 | inventory.OwnerID = userID; |
384 | 396 | ||
385 | NameValueCollection requestArgs = new NameValueCollection | 397 | NameValueCollection requestArgs = new NameValueCollection |
386 | { | 398 | { |