public string FetchLibraryRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { // m_log.DebugFormat("[FETCH LIBRARY HANDLER]: Received FetchInventory capabilty request"); OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); OSDArray itemsRequested = (OSDArray)requestmap["items"]; string reply; LLSDFetchInventory llsdReply = new LLSDFetchInventory(); foreach (OSDMap osdItemId in itemsRequested) { UUID itemId = osdItemId["item_id"].AsUUID(); try { InventoryItemBase item = m_libraryFolder.FindItem(itemId); if (item != null) { llsdReply.agent_id = item.Owner; llsdReply.items.Array.Add(ConvertInventoryItem(item)); } } catch (Exception e) { m_log.ErrorFormat( "[CAPS/FETCH LIBRARY HANDLER] Could not retrieve requested library item {0} for {1}: {2}", itemId, m_Caps.AgentID, e); } } reply = LLSDHelpers.SerializeLLSDReply(llsdReply); return reply; }
public string FetchInventoryRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { // m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capabilty request"); OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); OSDArray itemsRequested = (OSDArray)requestmap["items"]; string reply; LLSDFetchInventory llsdReply = new LLSDFetchInventory(); llsdReply.agent_id = m_agentID; foreach (OSDMap osdItemId in itemsRequested) { UUID itemId = osdItemId["item_id"].AsUUID(); if (itemId == UUID.Zero) continue; // don't bother try { //see if we already know that this is a fail lock (m_BlacklistedItems) { TimestampedItem<int> val; if (m_BlacklistedItems.TryGetValue(itemId, out val)) { //expired? if (val.ElapsedSeconds > ITEM_FAIL_TRACKING_TIME) { m_BlacklistedItems.Remove(itemId); } else { if (val.Item >= MAX_ITEM_FAIL_COUNT) { //at the max fail count, don't even try to look this one up continue; } } } } InventoryItemBase item = m_checkedStorageProvider.GetItem(m_agentID, itemId, UUID.Zero); if (item != null) { llsdReply.items.Array.Add(ConvertInventoryItem(item)); } else { AccountItemFetchFailure(itemId); } } catch (Exception e) { m_log.ErrorFormat("[CAPS/FETCH INVENTORY HANDLER] Could not retrieve requested inventory item {0} for {1}: {2}", itemId, m_Caps.AgentID, e); AccountItemFetchFailure(itemId); } } reply = LLSDHelpers.SerializeLLSDReply(llsdReply); return reply; }