diff options
Part 2 of fixing inventory for client 1.19.1 (RC), inventory items should now show up.
Most likely still some problems and most like needs some more work (and still a couple of things to finish off).
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities/Caps.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 53cb955..d38af7c 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -52,6 +52,9 @@ namespace OpenSim.Region.Capabilities | |||
52 | public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, | 52 | public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, |
53 | bool isScriptRunning, byte[] data); | 53 | bool isScriptRunning, byte[] data); |
54 | 54 | ||
55 | public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, | ||
56 | bool fetchFolders, bool fetchItems, int sortOrder); | ||
57 | |||
55 | public class Caps | 58 | public class Caps |
56 | { | 59 | { |
57 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 60 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
@@ -81,6 +84,9 @@ namespace OpenSim.Region.Capabilities | |||
81 | public NewInventoryItem AddNewInventoryItem = null; | 84 | public NewInventoryItem AddNewInventoryItem = null; |
82 | public ItemUpdatedCallback ItemUpdatedCall = null; | 85 | public ItemUpdatedCallback ItemUpdatedCall = null; |
83 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | 86 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; |
87 | // | ||
88 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | ||
89 | |||
84 | 90 | ||
85 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 91 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, |
86 | LLUUID agent, bool dumpAssetsToFile) | 92 | LLUUID agent, bool dumpAssetsToFile) |
@@ -191,14 +197,56 @@ namespace OpenSim.Region.Capabilities | |||
191 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | 197 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); |
192 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | 198 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); |
193 | contents.agent___id = m_agentID; | 199 | contents.agent___id = m_agentID; |
194 | contents.owner___id = m_agentID; | 200 | contents.owner___id = invFetch.owner_id; |
195 | contents.folder___id = invFetch.folder_id; | 201 | contents.folder___id = invFetch.folder_id; |
196 | contents.version = 1; | 202 | contents.version = 1; //FixMe |
197 | contents.descendents = 0; | 203 | contents.descendents = 0; |
198 | reply.folders.Array.Add(contents); | 204 | reply.folders.Array.Add(contents); |
205 | List<InventoryItemBase> itemList = null; | ||
206 | if (CAPSFetchInventoryDescendents != null) | ||
207 | { | ||
208 | itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); | ||
209 | } | ||
210 | if (itemList != null) | ||
211 | { | ||
212 | foreach (InventoryItemBase invItem in itemList) | ||
213 | { | ||
214 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | ||
215 | } | ||
216 | } | ||
217 | contents.descendents = contents.items.Array.Count; | ||
199 | return reply; | 218 | return reply; |
200 | } | 219 | } |
201 | 220 | ||
221 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) | ||
222 | { | ||
223 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); | ||
224 | llsdItem.asset_id = invItem.assetID; | ||
225 | llsdItem.created_at = 1000; | ||
226 | llsdItem.desc = invItem.inventoryDescription; | ||
227 | llsdItem.flags = 0; | ||
228 | llsdItem.item_id = invItem.inventoryID; | ||
229 | llsdItem.name = invItem.inventoryName; | ||
230 | llsdItem.parent_id = invItem.parentFolderID; | ||
231 | llsdItem.type = Enum.GetName(typeof(AssetType), invItem.assetType).ToLower(); | ||
232 | llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.invType).ToLower(); | ||
233 | llsdItem.permissions = new LLSDPermissions(); | ||
234 | llsdItem.permissions.creator_id = invItem.creatorsID; | ||
235 | llsdItem.permissions.base_mask = (int)invItem.inventoryBasePermissions; | ||
236 | llsdItem.permissions.everyone_mask = (int)invItem.inventoryEveryOnePermissions; | ||
237 | llsdItem.permissions.group_id = LLUUID.Zero; | ||
238 | llsdItem.permissions.group_mask = 0; | ||
239 | llsdItem.permissions.is_owner_group = false; | ||
240 | llsdItem.permissions.next_owner_mask = (int)invItem.inventoryNextPermissions; | ||
241 | llsdItem.permissions.owner_id = m_agentID; // FixMe | ||
242 | llsdItem.permissions.owner_mask = (int)invItem.inventoryCurrentPermissions; | ||
243 | llsdItem.sale_info = new LLSDSaleInfo(); | ||
244 | llsdItem.sale_info.sale_price = 10; | ||
245 | llsdItem.sale_info.sale_type = "not"; | ||
246 | |||
247 | return llsdItem; | ||
248 | } | ||
249 | |||
202 | /// <summary> | 250 | /// <summary> |
203 | /// | 251 | /// |
204 | /// </summary> | 252 | /// </summary> |