FIRE-7176: "AutoAcceptNewInventory" bypasses give-to-RLV functionality

-> quick-fix, needs proper integrating into the RLVa branch
Kitty Barnett 2012-11-28 16:33:07 +01:00
parent 40df5014c8
commit ea1c856d33
3 changed files with 32 additions and 1 deletions

View File

@ -2019,8 +2019,13 @@ void inventory_offer_handler(LLOfferInfo* info)
// && (info->mType == LLAssetType::AT_NOTECARD
// || info->mType == LLAssetType::AT_LANDMARK
// || info->mType == LLAssetType::AT_TEXTURE))
if (gSavedSettings.getBOOL("AutoAcceptNewInventory"))
// if (gSavedSettings.getBOOL("AutoAcceptNewInventory"))
// </FS:Ansariel> Auto-accept any kind of inventory (FIRE-4128)
// [RLVa:KB]
// Don't auto-accept give-to-RLV inventory offers
if ( (gSavedSettings.getBOOL("AutoAcceptNewInventory")) &&
( (!rlv_handler_t::isEnabled()) || (!RlvInventory::instance().isGiveToRLVOffer(*info)) ) )
// [/RLVa:KB]
{
// For certain types, just accept the items into the inventory,
// and possibly open them on receipt depending upon "ShowNewInventory".

View File

@ -20,6 +20,7 @@
#include "llinventoryobserver.h"
#include "llstartup.h"
#include "llviewerfoldertype.h"
#include "llviewermessage.h"
#include "llviewerobject.h"
#include "llvoavatarself.h"
@ -379,6 +380,27 @@ S32 RlvInventory::getDirectDescendentsItemCount(const LLInventoryCategory* pFold
return cntType;
}
// Checked: 2012-11-28 (RLVa-1.4.8)
bool RlvInventory::isGiveToRLVOffer(const LLOfferInfo& offerInfo)
{
if ( (!RlvSettings::getForbidGiveToRLV()) && (RlvInventory::instance().getSharedRoot()) )
{
if (offerInfo.mFromObject)
{
return
(IM_TASK_INVENTORY_OFFERED == offerInfo.mIM) &&
(LLAssetType::AT_CATEGORY == offerInfo.mType) && (offerInfo.mDesc.find(RLV_PUTINV_PREFIX) == 1);
}
else
{
return
(IM_INVENTORY_OFFERED == offerInfo.mIM) &&
(LLAssetType::AT_CATEGORY == offerInfo.mType) && (offerInfo.mDesc.find(RLV_PUTINV_PREFIX) == 0);
}
}
return false;
}
// ============================================================================
// RlvRenameOnWearObserver member functions
//

View File

@ -26,6 +26,8 @@
#include "rlvhelper.h"
#include "rlvlocks.h"
class LLOfferInfo;
// ============================================================================
// RlvInventory class declaration
//
@ -61,6 +63,8 @@ public:
std::string getSharedPath(const LLViewerInventoryCategory* pFolder) const;
// Returns TRUE if the supplied folder is a descendent of the #RLV folder
bool isSharedFolder(const LLUUID& idFolder);
// Returns TRUE if the inventory offer is a "give to #RLV" offer
bool isGiveToRLVOffer(const LLOfferInfo& offerInfo);
/*
* Inventory fetching