void fetch_items_from_llsd(const LLSD& items_llsd) { if (!items_llsd.size()) return; LLSD body; body[0]["cap_name"] = "FetchInventory"; body[1]["cap_name"] = "FetchLib"; for (S32 i=0; i<items_llsd.size();i++) { if (items_llsd[i]["owner_id"].asString() == gAgent.getID().asString()) { body[0]["items"].append(items_llsd[i]); continue; } if (items_llsd[i]["owner_id"].asString() == ALEXANDRIA_LINDEN_ID.asString()) { body[1]["items"].append(items_llsd[i]); continue; } } for (S32 i=0; i<body.size(); i++) { if (0 >= body[i].size()) continue; std::string url = gAgent.getRegion()->getCapability(body[i]["cap_name"].asString()); if (!url.empty()) { body[i]["agent_id"] = gAgent.getID(); LLHTTPClient::post(url, body[i], new LLInventoryModel::fetchInventoryResponder(body[i])); break; } LLMessageSystem* msg = gMessageSystem; BOOL start_new_message = TRUE; for (S32 j=0; j<body[i]["items"].size(); j++) { LLSD item_entry = body[i]["items"][j]; if(start_new_message) { start_new_message = FALSE; msg->newMessageFast(_PREHASH_FetchInventory); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); } msg->nextBlockFast(_PREHASH_InventoryData); msg->addUUIDFast(_PREHASH_OwnerID, item_entry["owner_id"].asUUID()); msg->addUUIDFast(_PREHASH_ItemID, item_entry["item_id"].asUUID()); if(msg->isSendFull(NULL)) { start_new_message = TRUE; gAgent.sendReliableMessage(); } } if(!start_new_message) { gAgent.sendReliableMessage(); } } }