// static void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent, const LLInventoryItem* item, const LLUUID& im_session_id) { if (!item) return; std::string name; LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); const S32 BUCKET_SIZE = sizeof(U8) + UUID_BYTES; U8 bucket[BUCKET_SIZE]; bucket[0] = (U8)item->getType(); memcpy(&bucket[1], &(item->getUUID().mData), UUID_BYTES); /* Flawfinder: ignore */ pack_instant_message( gMessageSystem, gAgentID, FALSE, gAgentSessionID, to_agent, name, item->getName(), IM_ONLINE, IM_INVENTORY_OFFERED, transaction_id, 0, LLUUID::null, gAgent.getPositionAgent(), NO_TIMESTAMP, bucket, BUCKET_SIZE); gAgent.sendReliableMessage(); // VEFFECT: giveInventory // <FS:Ansariel> Make the particle effect optional if (gSavedSettings.getBOOL("FSCreateGiveInventoryParticleEffect")) { LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); } gFloaterTools->dirty(); LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY); logInventoryOffer(to_agent, im_session_id); // add buddy to recent people list // LLRecentPeople::instance().add(to_agent); // [RLVa:KB] - Checked: 2010-04-21 (RLVa-1.2.2a) | Added: RLVa-1.2.0f // Block the recent activity update if this was an in-world drop on an avatar (as opposed to a drop on an IM session or on a profile) if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (im_session_id.notNull()) || (!RlvUtil::isNearbyAgent(to_agent)) || (RlvUIEnabler::hasOpenProfile(to_agent)) ) { LLRecentPeople::instance().add(to_agent); } // [/RLVa:KB] }
// static void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent, const LLInventoryItem* item, const LLUUID& im_session_id) { if (!item) return; std::string name; LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); const S32 BUCKET_SIZE = sizeof(U8) + UUID_BYTES; U8 bucket[BUCKET_SIZE]; bucket[0] = (U8)item->getType(); memcpy(&bucket[1], &(item->getUUID().mData), UUID_BYTES); /* Flawfinder: ignore */ pack_instant_message( gMessageSystem, gAgentID, FALSE, gAgentSessionID, to_agent, name, item->getName(), IM_ONLINE, IM_INVENTORY_OFFERED, transaction_id, 0, LLUUID::null, gAgent.getPositionAgent(), NO_TIMESTAMP, bucket, BUCKET_SIZE); gAgent.sendReliableMessage(); // <edit> if (gSavedSettings.getBOOL("BroadcastViewerEffects")) { // </edit> // VEFFECT: giveInventory LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); // <edit> } // </edit> gFloaterTools->dirty(); LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY); logInventoryOffer(to_agent, im_session_id); }
// static void LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, const LLInventoryCategory* cat, const LLUUID& im_session_id) { if(!cat) return; llinfos << "LLGiveInventory::commitGiveInventoryCategory() - " << cat->getUUID() << llendl; // Test out how many items are being given. LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLGiveable giveable; gInventory.collectDescendentsIf(cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, giveable); // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < // MTUBYTES or 18 * count < 1200 => count < 1200/18 => // 66. I've cut it down a bit from there to give some pad. S32 count = items.count() + cats.count(); if(count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); return; } else if(count == 0) { LLNotificationsUtil::add("NoItems"); return; } else { std::string name; LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1); U8* bucket = new U8[bucket_size]; U8* pos = bucket; U8 type = (U8)cat->getType(); memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); memcpy(pos, &(cat->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; S32 i; count = cats.count(); for(i = 0; i < count; ++i) { memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); memcpy(pos, &(cats.get(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; } count = items.count(); for(i = 0; i < count; ++i) { type = (U8)items.get(i)->getType(); memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); memcpy(pos, &(items.get(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; } pack_instant_message( gMessageSystem, gAgent.getID(), FALSE, gAgent.getSessionID(), to_agent, name, cat->getName(), IM_ONLINE, IM_INVENTORY_OFFERED, transaction_id, 0, LLUUID::null, gAgent.getPositionAgent(), NO_TIMESTAMP, bucket, bucket_size); gAgent.sendReliableMessage(); delete[] bucket; // <edit> if (gSavedSettings.getBOOL("BroadcastViewerEffects")) { // </edit> // VEFFECT: giveInventoryCategory LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); // <edit> } // </edit> gFloaterTools->dirty(); LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY); logInventoryOffer(to_agent, im_session_id); } }
// static bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, const LLInventoryCategory* cat, const LLUUID& im_session_id) { if (!cat) { return false; } llinfos << "LLGiveInventory::commitGiveInventoryCategory() - " << cat->getUUID() << llendl; // add buddy to recent people list // LLRecentPeople::instance().add(to_agent); // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.2a) | Added: RLVa-1.2.0f // Block the recent activity update if this was an in-world drop on an avatar (as opposed to a drop on an IM session or on a profile) if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (im_session_id.notNull()) || (!RlvUtil::isNearbyAgent(to_agent)) || (RlvUIEnabler::hasOpenProfile(to_agent)) ) { LLRecentPeople::instance().add(to_agent); } // [/RLVa:KB] // Test out how many items are being given. LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLGiveable giveable; gInventory.collectDescendentsIf (cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, giveable); bool give_successful = true; // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < // MTUBYTES or 18 * count < 1200 => count < 1200/18 => // 66. I've cut it down a bit from there to give some pad. S32 count = items.count() + cats.count(); if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); give_successful = false; } else if (count == 0) { LLNotificationsUtil::add("NoItems"); give_successful = false; } else { std::string name; LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1); U8* bucket = new U8[bucket_size]; U8* pos = bucket; U8 type = (U8)cat->getType(); memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); memcpy(pos, &(cat->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; S32 i; count = cats.count(); for(i = 0; i < count; ++i) { memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); memcpy(pos, &(cats.get(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; } count = items.count(); for(i = 0; i < count; ++i) { type = (U8)items.get(i)->getType(); memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); memcpy(pos, &(items.get(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; } pack_instant_message( gMessageSystem, gAgent.getID(), FALSE, gAgent.getSessionID(), to_agent, name, cat->getName(), IM_ONLINE, IM_INVENTORY_OFFERED, transaction_id, 0, LLUUID::null, gAgent.getPositionAgent(), NO_TIMESTAMP, bucket, bucket_size); gAgent.sendReliableMessage(); delete[] bucket; // VEFFECT: giveInventoryCategory // <FS:Ansariel> Make the particle effect optional if (gSavedSettings.getBOOL("FSCreateGiveInventoryParticleEffect")) { LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgentAvatarp); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); } gFloaterTools->dirty(); LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY); logInventoryOffer(to_agent, im_session_id); } return give_successful; }