diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 110 |
1 files changed, 108 insertions, 2 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 0288fa6..cf0762b 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -41,7 +41,9 @@ using OpenSim.Server.Handlers.Base; | |||
41 | using log4net; | 41 | using log4net; |
42 | using OpenMetaverse; | 42 | using OpenMetaverse; |
43 | 43 | ||
44 | namespace OpenSim.Server.Handlers.Asset | 44 | using System.Threading; |
45 | |||
46 | namespace OpenSim.Server.Handlers.Inventory | ||
45 | { | 47 | { |
46 | public class XInventoryInConnector : ServiceConnector | 48 | public class XInventoryInConnector : ServiceConnector |
47 | { | 49 | { |
@@ -123,6 +125,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
123 | return HandleGetFolderForType(request); | 125 | return HandleGetFolderForType(request); |
124 | case "GETFOLDERCONTENT": | 126 | case "GETFOLDERCONTENT": |
125 | return HandleGetFolderContent(request); | 127 | return HandleGetFolderContent(request); |
128 | case "GETMULTIPLEFOLDERSCONTENT": | ||
129 | return HandleGetMultipleFoldersContent(request); | ||
126 | case "GETFOLDERITEMS": | 130 | case "GETFOLDERITEMS": |
127 | return HandleGetFolderItems(request); | 131 | return HandleGetFolderItems(request); |
128 | case "ADDFOLDER": | 132 | case "ADDFOLDER": |
@@ -145,6 +149,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
145 | return HandleDeleteItems(request); | 149 | return HandleDeleteItems(request); |
146 | case "GETITEM": | 150 | case "GETITEM": |
147 | return HandleGetItem(request); | 151 | return HandleGetItem(request); |
152 | case "GETMULTIPLEITEMS": | ||
153 | return HandleGetMultipleItems(request); | ||
148 | case "GETFOLDER": | 154 | case "GETFOLDER": |
149 | return HandleGetFolder(request); | 155 | return HandleGetFolder(request); |
150 | case "GETACTIVEGESTURES": | 156 | case "GETACTIVEGESTURES": |
@@ -284,6 +290,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
284 | InventoryCollection icoll = m_InventoryService.GetFolderContent(principal, folderID); | 290 | InventoryCollection icoll = m_InventoryService.GetFolderContent(principal, folderID); |
285 | if (icoll != null) | 291 | if (icoll != null) |
286 | { | 292 | { |
293 | result["FID"] = icoll.FolderID.ToString(); | ||
294 | result["VERSION"] = icoll.Version.ToString(); | ||
287 | Dictionary<string, object> folders = new Dictionary<string, object>(); | 295 | Dictionary<string, object> folders = new Dictionary<string, object>(); |
288 | int i = 0; | 296 | int i = 0; |
289 | if (icoll.Folders != null) | 297 | if (icoll.Folders != null) |
@@ -314,7 +322,71 @@ namespace OpenSim.Server.Handlers.Asset | |||
314 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | 322 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
315 | } | 323 | } |
316 | 324 | ||
317 | byte[] HandleGetFolderItems(Dictionary<string,object> request) | 325 | byte[] HandleGetMultipleFoldersContent(Dictionary<string, object> request) |
326 | { | ||
327 | Dictionary<string, object> resultSet = new Dictionary<string, object>(); | ||
328 | UUID principal = UUID.Zero; | ||
329 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
330 | string folderIDstr = request["FOLDERS"].ToString(); | ||
331 | int count = 0; | ||
332 | Int32.TryParse(request["COUNT"].ToString(), out count); | ||
333 | |||
334 | UUID[] fids = new UUID[count]; | ||
335 | string[] uuids = folderIDstr.Split(','); | ||
336 | int i = 0; | ||
337 | foreach (string id in uuids) | ||
338 | { | ||
339 | UUID fid = UUID.Zero; | ||
340 | if (UUID.TryParse(id, out fid)) | ||
341 | fids[i] = fid; | ||
342 | i += 1; | ||
343 | } | ||
344 | |||
345 | count = 0; | ||
346 | InventoryCollection[] icollList = m_InventoryService.GetMultipleFoldersContent(principal, fids); | ||
347 | if (icollList != null && icollList.Length > 0) | ||
348 | { | ||
349 | foreach (InventoryCollection icoll in icollList) | ||
350 | { | ||
351 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
352 | result["FID"] = icoll.FolderID.ToString(); | ||
353 | result["VERSION"] = icoll.Version.ToString(); | ||
354 | result["OWNER"] = icoll.OwnerID.ToString(); | ||
355 | Dictionary<string, object> folders = new Dictionary<string, object>(); | ||
356 | i = 0; | ||
357 | if (icoll.Folders != null) | ||
358 | { | ||
359 | foreach (InventoryFolderBase f in icoll.Folders) | ||
360 | { | ||
361 | folders["folder_" + i.ToString()] = EncodeFolder(f); | ||
362 | i++; | ||
363 | } | ||
364 | result["FOLDERS"] = folders; | ||
365 | } | ||
366 | i = 0; | ||
367 | if (icoll.Items != null) | ||
368 | { | ||
369 | Dictionary<string, object> items = new Dictionary<string, object>(); | ||
370 | foreach (InventoryItemBase it in icoll.Items) | ||
371 | { | ||
372 | items["item_" + i.ToString()] = EncodeItem(it); | ||
373 | i++; | ||
374 | } | ||
375 | result["ITEMS"] = items; | ||
376 | } | ||
377 | |||
378 | resultSet["F_" + fids[count++]] = result; | ||
379 | //m_log.DebugFormat("[XXX]: Sending {0} {1}", fids[count-1], icoll.FolderID); | ||
380 | } | ||
381 | } | ||
382 | |||
383 | string xmlString = ServerUtils.BuildXmlResponse(resultSet); | ||
384 | |||
385 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
386 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | ||
387 | } | ||
388 | |||
389 | byte[] HandleGetFolderItems(Dictionary<string, object> request) | ||
318 | { | 390 | { |
319 | Dictionary<string,object> result = new Dictionary<string,object>(); | 391 | Dictionary<string,object> result = new Dictionary<string,object>(); |
320 | UUID principal = UUID.Zero; | 392 | UUID principal = UUID.Zero; |
@@ -506,6 +578,40 @@ namespace OpenSim.Server.Handlers.Asset | |||
506 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | 578 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
507 | } | 579 | } |
508 | 580 | ||
581 | byte[] HandleGetMultipleItems(Dictionary<string, object> request) | ||
582 | { | ||
583 | Dictionary<string, object> resultSet = new Dictionary<string, object>(); | ||
584 | UUID principal = UUID.Zero; | ||
585 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
586 | string itemIDstr = request["ITEMS"].ToString(); | ||
587 | int count = 0; | ||
588 | Int32.TryParse(request["COUNT"].ToString(), out count); | ||
589 | |||
590 | UUID[] fids = new UUID[count]; | ||
591 | string[] uuids = itemIDstr.Split(','); | ||
592 | int i = 0; | ||
593 | foreach (string id in uuids) | ||
594 | { | ||
595 | UUID fid = UUID.Zero; | ||
596 | if (UUID.TryParse(id, out fid)) | ||
597 | fids[i] = fid; | ||
598 | i += 1; | ||
599 | } | ||
600 | |||
601 | InventoryItemBase[] itemsList = m_InventoryService.GetMultipleItems(principal, fids); | ||
602 | if (itemsList != null && itemsList.Length > 0) | ||
603 | { | ||
604 | count = 0; | ||
605 | foreach (InventoryItemBase item in itemsList) | ||
606 | resultSet["item_" + count++] = (item == null) ? (object)"NULL" : EncodeItem(item); | ||
607 | } | ||
608 | |||
609 | string xmlString = ServerUtils.BuildXmlResponse(resultSet); | ||
610 | |||
611 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
612 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | ||
613 | } | ||
614 | |||
509 | byte[] HandleGetFolder(Dictionary<string,object> request) | 615 | byte[] HandleGetFolder(Dictionary<string,object> request) |
510 | { | 616 | { |
511 | Dictionary<string, object> result = new Dictionary<string, object>(); | 617 | Dictionary<string, object> result = new Dictionary<string, object>(); |