diff options
author | UbitUmarov | 2015-09-12 06:10:52 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-12 06:10:52 +0100 |
commit | 118aff520efba90bc9f8c767beaf5378a92b1939 (patch) | |
tree | ab70d2346fa7b2164bdfb75278e51ec4bb21ed18 /OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | |
parent | fix the typos that seem to matter so much to some :p (diff) | |
download | opensim-SC-118aff520efba90bc9f8c767beaf5378a92b1939.zip opensim-SC-118aff520efba90bc9f8c767beaf5378a92b1939.tar.gz opensim-SC-118aff520efba90bc9f8c767beaf5378a92b1939.tar.bz2 opensim-SC-118aff520efba90bc9f8c767beaf5378a92b1939.tar.xz |
try to better merge avn and os fetchinventory and fetchinvdescendents
Diffstat (limited to 'OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs index 638e8bc..1753f60 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | |||
@@ -64,21 +64,36 @@ 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) |
76 | { | ||
77 | items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs); | ||
78 | |||
79 | if (items == null) | ||
80 | { | ||
81 | // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated | ||
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 | InventoryItemBase item = new InventoryItemBase(); | ||
85 | item.Owner = m_agentID; | ||
86 | foreach (UUID id in itemIDs) | ||
87 | { | ||
88 | item.ID = id; | ||
89 | items[i++] = m_inventoryService.GetItem(item); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | else | ||
75 | { | 94 | { |
76 | // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated | ||
77 | m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); | ||
78 | items = new InventoryItemBase[itemsRequested.Count]; | 95 | items = new InventoryItemBase[itemsRequested.Count]; |
79 | i = 0; | ||
80 | InventoryItemBase item = new InventoryItemBase(); | 96 | InventoryItemBase item = new InventoryItemBase(); |
81 | item.Owner = m_agentID; | ||
82 | foreach (UUID id in itemIDs) | 97 | foreach (UUID id in itemIDs) |
83 | { | 98 | { |
84 | item.ID = id; | 99 | item.ID = id; |
@@ -93,7 +108,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 | 108 | // 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. | 109 | // which will be the same for all items. |
95 | llsdReply.agent_id = item.Owner; | 110 | llsdReply.agent_id = item.Owner; |
96 | |||
97 | llsdReply.items.Array.Add(ConvertInventoryItem(item)); | 111 | llsdReply.items.Array.Add(ConvertInventoryItem(item)); |
98 | } | 112 | } |
99 | } | 113 | } |