diff options
Diffstat (limited to 'OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs index c904392..e239a90 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | |||
@@ -64,27 +64,33 @@ namespace OpenSim.Capabilities.Handlers | |||
64 | 64 | ||
65 | UUID[] itemIDs = new UUID[itemsRequested.Count]; | 65 | UUID[] itemIDs = new UUID[itemsRequested.Count]; |
66 | int i = 0; | 66 | int i = 0; |
67 | |||
67 | foreach (OSDMap osdItemId in itemsRequested) | 68 | foreach (OSDMap osdItemId in itemsRequested) |
68 | { | 69 | { |
69 | itemIDs[i++] = osdItemId["item_id"].AsUUID(); | 70 | itemIDs[i++] = osdItemId["item_id"].AsUUID(); |
70 | } | 71 | } |
71 | 72 | ||
72 | InventoryItemBase[] items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs); | 73 | InventoryItemBase[] items = null; |
73 | 74 | ||
74 | if (items == null) | 75 | if (m_agentID != UUID.Zero) |
75 | { | 76 | { |
76 | // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated | 77 | items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs); |
77 | m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); | 78 | |
78 | items = new InventoryItemBase[itemsRequested.Count]; | 79 | if (items == null) |
79 | i = 0; | ||
80 | InventoryItemBase item = new InventoryItemBase(); | ||
81 | item.Owner = m_agentID; | ||
82 | foreach (UUID id in itemIDs) | ||
83 | { | 80 | { |
84 | item.ID = id; | 81 | // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated |
85 | items[i++] = m_inventoryService.GetItem(item); | 82 | m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); |
83 | items = new InventoryItemBase[itemsRequested.Count]; | ||
84 | foreach (UUID id in itemIDs) | ||
85 | items[i++] = m_inventoryService.GetItem(m_agentID, id); | ||
86 | } | 86 | } |
87 | } | 87 | } |
88 | else | ||
89 | { | ||
90 | items = new InventoryItemBase[itemsRequested.Count]; | ||
91 | foreach (UUID id in itemIDs) | ||
92 | items[i++] = m_inventoryService.GetItem(UUID.Zero, id); | ||
93 | } | ||
88 | 94 | ||
89 | foreach (InventoryItemBase item in items) | 95 | foreach (InventoryItemBase item in items) |
90 | { | 96 | { |
@@ -93,7 +99,6 @@ namespace OpenSim.Capabilities.Handlers | |||
93 | // We don't know the agent that this request belongs to so we'll use the agent id of the item | 99 | // We don't know the agent that this request belongs to so we'll use the agent id of the item |
94 | // which will be the same for all items. | 100 | // which will be the same for all items. |
95 | llsdReply.agent_id = item.Owner; | 101 | llsdReply.agent_id = item.Owner; |
96 | |||
97 | llsdReply.items.Array.Add(ConvertInventoryItem(item)); | 102 | llsdReply.items.Array.Add(ConvertInventoryItem(item)); |
98 | } | 103 | } |
99 | } | 104 | } |
@@ -114,7 +119,7 @@ namespace OpenSim.Capabilities.Handlers | |||
114 | llsdItem.asset_id = invItem.AssetID; | 119 | llsdItem.asset_id = invItem.AssetID; |
115 | llsdItem.created_at = invItem.CreationDate; | 120 | llsdItem.created_at = invItem.CreationDate; |
116 | llsdItem.desc = invItem.Description; | 121 | llsdItem.desc = invItem.Description; |
117 | llsdItem.flags = (int)invItem.Flags; | 122 | llsdItem.flags = ((int)invItem.Flags) & 0xff; |
118 | llsdItem.item_id = invItem.ID; | 123 | llsdItem.item_id = invItem.ID; |
119 | llsdItem.name = invItem.Name; | 124 | llsdItem.name = invItem.Name; |
120 | llsdItem.parent_id = invItem.Folder; | 125 | llsdItem.parent_id = invItem.Folder; |
@@ -138,4 +143,4 @@ namespace OpenSim.Capabilities.Handlers | |||
138 | return llsdItem; | 143 | return llsdItem; |
139 | } | 144 | } |
140 | } | 145 | } |
141 | } \ No newline at end of file | 146 | } |