mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
try to better merge avn and os fetchinventory and fetchinvdescendents
This commit is contained in:
@@ -64,21 +64,36 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
UUID[] itemIDs = new UUID[itemsRequested.Count];
|
||||
int i = 0;
|
||||
|
||||
foreach (OSDMap osdItemId in itemsRequested)
|
||||
{
|
||||
itemIDs[i++] = osdItemId["item_id"].AsUUID();
|
||||
}
|
||||
|
||||
InventoryItemBase[] items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
|
||||
InventoryItemBase[] items = null;
|
||||
|
||||
if (items == null)
|
||||
if (m_agentID != UUID.Zero)
|
||||
{
|
||||
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
|
||||
m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
|
||||
items = new InventoryItemBase[itemsRequested.Count];
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = m_agentID;
|
||||
foreach (UUID id in itemIDs)
|
||||
{
|
||||
item.ID = id;
|
||||
items[i++] = m_inventoryService.GetItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
|
||||
m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
|
||||
items = new InventoryItemBase[itemsRequested.Count];
|
||||
i = 0;
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = m_agentID;
|
||||
foreach (UUID id in itemIDs)
|
||||
{
|
||||
item.ID = id;
|
||||
@@ -93,7 +108,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// We don't know the agent that this request belongs to so we'll use the agent id of the item
|
||||
// which will be the same for all items.
|
||||
llsdReply.agent_id = item.Owner;
|
||||
|
||||
llsdReply.items.Array.Add(ConvertInventoryItem(item));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user