/** * Performs "give inventory" operations for provided avatars. * * Sends one requests to give all selected inventory items for each passed avatar. * Avatars are represent by two vectors: names and UUIDs which must be sychronized with each other. * * @param avatar_names - avatar names request to be sent. * @param avatar_uuids - avatar names request to be sent. */ static void give_inventory(const std::vector<std::string>& avatar_names, const uuid_vec_t& avatar_uuids) { llassert(avatar_names.size() == avatar_uuids.size()); LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); if (!active_panel) { active_panel = get_outfit_editor_inventory_panel(); if (!active_panel) return; } const uuid_set_t inventory_selected_uuids = active_panel->getRootFolder()->getSelectionList(); if (inventory_selected_uuids.empty()) { return; } std::string residents; build_residents_string(avatar_names, residents); std::string items; build_items_string(inventory_selected_uuids, items); LLSD substitutions; substitutions["RESIDENTS"] = residents; substitutions["ITEMS"] = items; LLShareInfo::instance().mAvatarNames = avatar_names; LLShareInfo::instance().mAvatarUuids = avatar_uuids; LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, LLSD(), &give_inventory_cb); }
/** * Performs "give inventory" operations for provided avatars. * * Sends one requests to give all selected inventory items for each passed avatar. * Avatars are represent by two vectors: names and UUIDs which must be sychronized with each other. * * @param avatar_names - avatar names request to be sent. * @param avatar_uuids - avatar names request to be sent. */ static void give_inventory(const uuid_vec_t& avatar_uuids, const std::vector<LLAvatarName> avatar_names) { llassert(avatar_names.size() == avatar_uuids.size()); const std::set<LLUUID> inventory_selected_uuids = LLAvatarActions::getInventorySelectedUUIDs(); if (inventory_selected_uuids.empty()) { return; } std::string residents; LLAvatarActions::buildResidentsString(avatar_names, residents); std::string items; build_items_string(inventory_selected_uuids, items); int folders_count = 0; std::set<LLUUID>::const_iterator it = inventory_selected_uuids.begin(); //traverse through selected inventory items and count folders among them for ( ; it != inventory_selected_uuids.end() && folders_count <=1 ; ++it) { LLViewerInventoryCategory* inv_cat = gInventory.getCategory(*it); if (NULL != inv_cat) { folders_count++; } } // EXP-1599 // In case of sharing multiple folders, make the confirmation // dialog contain a warning that only one folder can be shared at a time. std::string notification = (folders_count > 1) ? "ShareFolderConfirmation" : "ShareItemsConfirmation"; LLSD substitutions; substitutions["RESIDENTS"] = residents; substitutions["ITEMS"] = items; LLShareInfo::instance().mAvatarNames = avatar_names; LLShareInfo::instance().mAvatarUuids = avatar_uuids; LLNotificationsUtil::add(notification, substitutions, LLSD(), &give_inventory_cb); }