aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs
parentAdd a build script. (diff)
downloadopensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs')
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs33
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}