Conflicts:
	indra/newview/app_settings/settings.xml
This commit is contained in:
Siana Gearz
2011-04-30 22:02:02 +02:00
62 changed files with 1447 additions and 821 deletions

View File

@@ -27,6 +27,7 @@ set(llcommon_SOURCE_FILES
llcriticaldamp.cpp llcriticaldamp.cpp
llcursortypes.cpp llcursortypes.cpp
lldate.cpp lldate.cpp
lldictionary.cpp
llerror.cpp llerror.cpp
llerrorthread.cpp llerrorthread.cpp
llevent.cpp llevent.cpp
@@ -106,6 +107,7 @@ set(llcommon_HEADER_FILES
lldate.h lldate.h
lldefs.h lldefs.h
lldepthstack.h lldepthstack.h
lldictionary.h
lldlinked.h lldlinked.h
lldqueueptr.h lldqueueptr.h
llendianswizzle.h llendianswizzle.h

View File

@@ -0,0 +1,54 @@
/**
* @file lldictionary.cpp
* @brief Lldictionary class header file
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
*/
#include "linden_common.h"
#include "lldictionary.h"
#include "llstring.h"
// Define in .cpp file to prevent header include of llstring.h
LLDictionaryEntry::LLDictionaryEntry(const std::string &name)
: mName(name)
{
mNameCapitalized = mName;
LLStringUtil::replaceChar(mNameCapitalized, '-', ' ');
LLStringUtil::replaceChar(mNameCapitalized, '_', ' ');
for (U32 i=0; i < mNameCapitalized.size(); i++)
{
if (i == 0 || mNameCapitalized[i-1] == ' ') // don't change ordering of this statement or crash
{
mNameCapitalized[i] = toupper(mNameCapitalized[i]);
}
}
}

View File

@@ -0,0 +1,103 @@
/**
* @file lldictionary.h
* @brief Lldictionary class header file
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
*/
#ifndef LL_LLDICTIONARY_H
#define LL_LLDICTIONARY_H
#include <map>
#include <string>
struct LL_COMMON_API LLDictionaryEntry
{
LLDictionaryEntry(const std::string &name);
virtual ~LLDictionaryEntry() {}
const std::string mName;
std::string mNameCapitalized;
};
template <class Index, class Entry>
class LLDictionary : public std::map<Index, Entry *>
{
public:
typedef std::map<Index, Entry *> map_t;
typedef typename map_t::iterator iterator_t;
typedef typename map_t::const_iterator const_iterator_t;
LLDictionary() {}
virtual ~LLDictionary()
{
for (iterator_t iter = map_t::begin(); iter != map_t::end(); ++iter)
delete (iter->second);
}
const Entry *lookup(Index index) const
{
const_iterator_t dictionary_iter = map_t::find(index);
if (dictionary_iter == map_t::end()) return NULL;
return dictionary_iter->second;
}
const Index lookup(const std::string &name) const
{
for (const_iterator_t dictionary_iter = map_t::begin();
dictionary_iter != map_t::end();
dictionary_iter++)
{
const Entry *entry = dictionary_iter->second;
if (entry->mName == name)
{
return dictionary_iter->first;
}
}
return notFound();
}
protected:
virtual Index notFound() const
{
// default is to assert
// don't assert -- makes it impossible to work on mesh-development and viewer-development simultaneously
// -- davep 2010.10.29
//llassert(false);
return Index(-1);
}
void addEntry(Index index, Entry *entry)
{
if (lookup(index))
{
llerrs << "Dictionary entry already added (attempted to add duplicate entry)" << llendl;
}
(*this)[index] = entry;
}
};
#endif // LL_LLDICTIONARY_H

View File

@@ -19,6 +19,7 @@ set(llinventory_SOURCE_FILES
llcategory.cpp llcategory.cpp
lleconomy.cpp lleconomy.cpp
llinventory.cpp llinventory.cpp
llinventorydefines.cpp
llinventorytype.cpp llinventorytype.cpp
lllandmark.cpp lllandmark.cpp
llnotecard.cpp llnotecard.cpp
@@ -35,6 +36,7 @@ set(llinventory_HEADER_FILES
llcategory.h llcategory.h
lleconomy.h lleconomy.h
llinventory.h llinventory.h
llinventorydefines.h
llinventorytype.h llinventorytype.h
lllandmark.h lllandmark.h
llnotecard.h llnotecard.h

View File

@@ -64,34 +64,27 @@ static const std::string INV_CREATION_DATE_LABEL("created_at");
// key used by agent-inventory-service // key used by agent-inventory-service
static const std::string INV_ASSET_TYPE_LABEL_WS("type_default"); static const std::string INV_ASSET_TYPE_LABEL_WS("type_default");
static const std::string INV_FOLDER_ID_LABEL_WS("category_id"); static const std::string INV_FOLDER_ID_LABEL_WS("category_id");
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs /// Local function declarations, constants, enums, and typedefs
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
const U8 TASK_INVENTORY_ITEM_KEY = 0;
const U8 TASK_INVENTORY_ASSET_KEY = 1;
const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Class LLInventoryObject /// Class LLInventoryObject
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLInventoryObject::LLInventoryObject( LLInventoryObject::LLInventoryObject(const LLUUID& uuid,
const LLUUID& uuid, const LLUUID& parent_uuid,
const LLUUID& parent_uuid, LLAssetType::EType type,
LLAssetType::EType type, const std::string& name) :
const std::string& name) :
mUUID(uuid), mUUID(uuid),
mParentUUID(parent_uuid), mParentUUID(parent_uuid),
mType(type), mType(type),
mName(name) mName(name)
{ {
LLStringUtil::replaceNonstandardASCII(mName, ' '); correctInventoryName(mName);
LLStringUtil::replaceChar(mName, '|', ' ');
LLStringUtil::trim(mName);
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
} }
LLInventoryObject::LLInventoryObject() : LLInventoryObject::LLInventoryObject() :
@@ -99,7 +92,7 @@ LLInventoryObject::LLInventoryObject() :
{ {
} }
LLInventoryObject::~LLInventoryObject( void ) LLInventoryObject::~LLInventoryObject()
{ {
} }
@@ -158,12 +151,8 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid)
void LLInventoryObject::rename(const std::string& n) void LLInventoryObject::rename(const std::string& n)
{ {
std::string new_name(n); std::string new_name(n);
LLStringUtil::replaceNonstandardASCII(new_name, ' '); correctInventoryName(new_name);
LLStringUtil::replaceChar(new_name, '|', ' '); if( !new_name.empty() && new_name != mName )
LLStringUtil::trim(new_name);
LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN);
if( new_name != mName )
{ {
mName = new_name; mName = new_name;
} }
@@ -224,10 +213,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
" %254s %254[^|]", " %254s %254[^|]",
keyword, valuestr); keyword, valuestr);
mName.assign(valuestr); mName.assign(valuestr);
LLStringUtil::replaceNonstandardASCII(mName, ' '); correctInventoryName(mName);
LLStringUtil::replaceChar(mName, '|', ' ');
LLStringUtil::trim(mName);
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN);
} }
else else
{ {
@@ -287,23 +273,31 @@ void LLInventoryObject::updateServer(BOOL) const
llwarns << "LLInventoryObject::updateServer() called. Doesn't do anything." << llendl; llwarns << "LLInventoryObject::updateServer() called. Doesn't do anything." << llendl;
} }
inline
void LLInventoryObject::correctInventoryName(std::string& name)
{
LLStringUtil::replaceNonstandardASCII(name, ' ');
LLStringUtil::replaceChar(name, '|', ' ');
LLStringUtil::trim(name);
LLStringUtil::truncate(name, DB_INV_ITEM_NAME_STR_LEN);
}
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Class LLInventoryItem /// Class LLInventoryItem
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLInventoryItem::LLInventoryItem( LLInventoryItem::LLInventoryItem(const LLUUID& uuid,
const LLUUID& uuid, const LLUUID& parent_uuid,
const LLUUID& parent_uuid, const LLPermissions& permissions,
const LLPermissions& permissions, const LLUUID& asset_uuid,
const LLUUID& asset_uuid, LLAssetType::EType type,
LLAssetType::EType type, LLInventoryType::EType inv_type,
LLInventoryType::EType inv_type, const std::string& name,
const std::string& name, const std::string& desc,
const std::string& desc, const LLSaleInfo& sale_info,
const LLSaleInfo& sale_info, U32 flags,
U32 flags, S32 creation_date_utc) :
S32 creation_date_utc) :
LLInventoryObject(uuid, parent_uuid, type, name), LLInventoryObject(uuid, parent_uuid, type, name),
mPermissions(permissions), mPermissions(permissions),
mAssetUUID(asset_uuid), mAssetUUID(asset_uuid),
@@ -315,6 +309,7 @@ LLInventoryItem::LLInventoryItem(
{ {
LLStringUtil::replaceNonstandardASCII(mDescription, ' '); LLStringUtil::replaceNonstandardASCII(mDescription, ' ');
LLStringUtil::replaceChar(mDescription, '|', ' '); LLStringUtil::replaceChar(mDescription, '|', ' ');
mPermissions.initMasks(inv_type);
} }
LLInventoryItem::LLInventoryItem() : LLInventoryItem::LLInventoryItem() :
@@ -446,6 +441,9 @@ void LLInventoryItem::setDescription(const std::string& d)
void LLInventoryItem::setPermissions(const LLPermissions& perm) void LLInventoryItem::setPermissions(const LLPermissions& perm)
{ {
mPermissions = perm; mPermissions = perm;
// Override permissions to unrestricted if this is a landmark
mPermissions.initMasks(mInventoryType);
} }
void LLInventoryItem::setInventoryType(LLInventoryType::EType inv_type) void LLInventoryItem::setInventoryType(LLInventoryType::EType inv_type)
@@ -463,6 +461,46 @@ void LLInventoryItem::setCreationDate(time_t creation_date_utc)
mCreationDate = creation_date_utc; mCreationDate = creation_date_utc;
} }
// Currently only used in the Viewer to handle calling cards
// where the creator is actually used to store the target.
void LLInventoryItem::setCreator(const LLUUID& creator)
{
mPermissions.setCreator(creator);
}
void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_item)
{
// Remove any pre-existing II_FLAGS_PERM_OVERWRITE_MASK flags
// because we now detect when they should be set.
setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItemFlags::II_FLAGS_PERM_OVERWRITE_MASK)) );
// Enforce the PERM_OVERWRITE flags for any masks that are different
// but only for AT_OBJECT's since that is the only asset type that can
// exist in-world (instead of only in-inventory or in-object-contents).
if (LLAssetType::AT_OBJECT == getType())
{
LLPermissions old_permissions = old_item.getPermissions();
U32 flags_to_be_set = 0;
if(old_permissions.getMaskNextOwner() != getPermissions().getMaskNextOwner())
{
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
}
if(old_permissions.getMaskEveryone() != getPermissions().getMaskEveryone())
{
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
}
if(old_permissions.getMaskGroup() != getPermissions().getMaskGroup())
{
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
}
LLSaleInfo old_sale_info = old_item.getSaleInfo();
if(old_sale_info != getSaleInfo())
{
flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
}
setFlags(getFlags() | flags_to_be_set);
}
}
const LLSaleInfo& LLInventoryItem::getSaleInfo() const const LLSaleInfo& LLInventoryItem::getSaleInfo() const
{ {
@@ -517,6 +555,7 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
mType = static_cast<LLAssetType::EType>(type); mType = static_cast<LLAssetType::EType>(type);
msg->getS8(block, "InvType", type, block_num); msg->getS8(block, "InvType", type, block_num);
mInventoryType = static_cast<LLInventoryType::EType>(type); mInventoryType = static_cast<LLInventoryType::EType>(type);
mPermissions.initMasks(mInventoryType);
msg->getU32Fast(block, _PREHASH_Flags, mFlags, block_num); msg->getU32Fast(block, _PREHASH_Flags, mFlags, block_num);
@@ -707,6 +746,9 @@ BOOL LLInventoryItem::importFile(LLFILE* fp)
lldebugs << "Resetting inventory type for " << mUUID << llendl; lldebugs << "Resetting inventory type for " << mUUID << llendl;
mInventoryType = LLInventoryType::defaultForAssetType(mType); mInventoryType = LLInventoryType::defaultForAssetType(mType);
} }
mPermissions.initMasks(mInventoryType);
return success; return success;
} }
@@ -746,8 +788,8 @@ BOOL LLInventoryItem::exportFile(LLFILE* fp, BOOL include_asset_key) const
fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\tasset_id\t%s\n", uuid_str.c_str());
} }
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
const char* inv_type_str = LLInventoryType::lookup(mInventoryType); const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
if(inv_type_str) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str); if(!inv_type_str.empty()) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str.c_str());
fprintf(fp, "\t\tflags\t%08x\n", mFlags); fprintf(fp, "\t\tflags\t%08x\n", mFlags);
mSaleInfo.exportFile(fp); mSaleInfo.exportFile(fp);
fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
@@ -910,6 +952,9 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
lldebugs << "Resetting inventory type for " << mUUID << llendl; lldebugs << "Resetting inventory type for " << mUUID << llendl;
mInventoryType = LLInventoryType::defaultForAssetType(mType); mInventoryType = LLInventoryType::defaultForAssetType(mType);
} }
mPermissions.initMasks(mInventoryType);
return success; return success;
} }
@@ -949,8 +994,8 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
output_stream << "\t\tasset_id\t" << uuid_str << "\n"; output_stream << "\t\tasset_id\t" << uuid_str << "\n";
} }
output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n"; output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n";
const char* inv_type_str = LLInventoryType::lookup(mInventoryType); const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
if(inv_type_str) if(!inv_type_str.empty())
output_stream << "\t\tinv_type\t" << inv_type_str << "\n"; output_stream << "\t\tinv_type\t" << inv_type_str << "\n";
std::string buffer; std::string buffer;
buffer = llformat( "\t\tflags\t%08x\n", mFlags); buffer = llformat( "\t\tflags\t%08x\n", mFlags);
@@ -966,6 +1011,12 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
LLSD LLInventoryItem::asLLSD() const LLSD LLInventoryItem::asLLSD() const
{ {
LLSD sd = LLSD(); LLSD sd = LLSD();
asLLSD(sd);
return sd;
}
void LLInventoryItem::asLLSD( LLSD& sd ) const
{
sd[INV_ITEM_ID_LABEL] = mUUID; sd[INV_ITEM_ID_LABEL] = mUUID;
sd[INV_PARENT_ID_LABEL] = mParentUUID; sd[INV_PARENT_ID_LABEL] = mParentUUID;
sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions); sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions);
@@ -986,8 +1037,8 @@ LLSD LLInventoryItem::asLLSD() const
} }
sd[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType); sd[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType);
sd[INV_INVENTORY_TYPE_LABEL] = mInventoryType; sd[INV_INVENTORY_TYPE_LABEL] = mInventoryType;
const char* inv_type_str = LLInventoryType::lookup(mInventoryType); const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
if(inv_type_str) if(!inv_type_str.empty())
{ {
sd[INV_INVENTORY_TYPE_LABEL] = inv_type_str; sd[INV_INVENTORY_TYPE_LABEL] = inv_type_str;
} }
@@ -997,11 +1048,9 @@ LLSD LLInventoryItem::asLLSD() const
sd[INV_NAME_LABEL] = mName; sd[INV_NAME_LABEL] = mName;
sd[INV_DESC_LABEL] = mDescription; sd[INV_DESC_LABEL] = mDescription;
sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate;
return sd;
} }
bool LLInventoryItem::fromLLSD(LLSD& sd) bool LLInventoryItem::fromLLSD(const LLSD& sd)
{ {
mInventoryType = LLInventoryType::IT_NONE; mInventoryType = LLInventoryType::IT_NONE;
mAssetUUID.setNull(); mAssetUUID.setNull();
@@ -1128,6 +1177,8 @@ bool LLInventoryItem::fromLLSD(LLSD& sd)
mInventoryType = LLInventoryType::defaultForAssetType(mType); mInventoryType = LLInventoryType::defaultForAssetType(mType);
} }
mPermissions.initMasks(mInventoryType);
return true; return true;
fail: fail:
return false; return false;
@@ -1294,23 +1345,19 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
// Early exit on an empty binary bucket. // Early exit on an empty binary bucket.
if (bin_bucket_size <= 1) return; if (bin_bucket_size <= 1) return;
// Convert the bin_bucket into a string. if (NULL == bin_bucket)
char* item_buffer = new char[bin_bucket_size+1];
if ((item_buffer != NULL) && (bin_bucket != NULL))
{ {
memcpy(item_buffer, bin_bucket, bin_bucket_size); /* Flawfinder: ignore */ llerrs << "unpackBinaryBucket failed. bin_bucket is NULL." << llendl;
}
else
{
llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
delete[] item_buffer;
return; return;
} }
item_buffer[bin_bucket_size] = '\0';
std::string str(item_buffer);
lldebugs << "item buffer: " << item_buffer << llendl; // Convert the bin_bucket into a string.
delete[] item_buffer; std::vector<char> item_buffer(bin_bucket_size+1);
memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
item_buffer[bin_bucket_size] = '\0';
std::string str(&item_buffer[0]);
lldebugs << "item buffer: " << str << llendl;
// Tokenize the string. // Tokenize the string.
typedef boost::tokenizer<boost::char_separator<char> > tokenizer; typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
@@ -1385,11 +1432,10 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b )
/// Class LLInventoryCategory /// Class LLInventoryCategory
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLInventoryCategory::LLInventoryCategory( LLInventoryCategory::LLInventoryCategory(const LLUUID& uuid,
const LLUUID& uuid, const LLUUID& parent_uuid,
const LLUUID& parent_uuid, LLAssetType::EType preferred_type,
LLAssetType::EType preferred_type, const std::string& name) :
const std::string& name) :
LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name), LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name),
mPreferredType(preferred_type) mPreferredType(preferred_type)
{ {
@@ -1451,7 +1497,7 @@ void LLInventoryCategory::packMessage(LLMessageSystem* msg) const
msg->addStringFast(_PREHASH_Name, mName); msg->addStringFast(_PREHASH_Name, mName);
} }
bool LLInventoryCategory::fromLLSD(LLSD& sd) bool LLInventoryCategory::fromLLSD(const LLSD& sd)
{ {
std::string w; std::string w;

View File

@@ -33,180 +33,107 @@
#ifndef LL_LLINVENTORY_H #ifndef LL_LLINVENTORY_H
#define LL_LLINVENTORY_H #define LL_LLINVENTORY_H
#include <functional>
#include "llassetstorage.h" #include "llassetstorage.h"
#include "lldarray.h" #include "lldarray.h"
#include "llinventorytype.h" #include "llinventorytype.h"
#include "llinventorydefines.h"
#include "llmemtype.h" #include "llmemtype.h"
#include "llpermissions.h" #include "llpermissions.h"
#include "llsaleinfo.h" #include "llsaleinfo.h"
#include "llsd.h" #include "llsd.h"
#include "lluuid.h" #include "lluuid.h"
#include "llxmlnode.h"
// consts for Key field in the task inventory update message
extern const U8 TASK_INVENTORY_ITEM_KEY;
extern const U8 TASK_INVENTORY_ASSET_KEY;
// anonymous enumeration to specify a max inventory buffer size for
// use in packBinaryBucket()
enum
{
MAX_INVENTORY_BUFFER_SIZE = 1024
};
class LLMessageSystem;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryObject // Class LLInventoryObject
// //
// This is the base class for inventory objects that handles the // Base class for anything in the user's inventory. Handles the common code
// common code between items and categories. The 'mParentUUID' member // between items and categories.
// means the parent category since all inventory objects except each
// user's root category are in some category. Each user's root
// category will have mParentUUID==LLUUID::null.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLMessageSystem;
class LLInventoryObject : public LLRefCount class LLInventoryObject : public LLRefCount
{ {
protected: public:
LLUUID mUUID; typedef std::list<LLPointer<LLInventoryObject> > object_list_t;
LLUUID mParentUUID;
LLAssetType::EType mType;
std::string mName;
protected: //--------------------------------------------------------------------
virtual ~LLInventoryObject( void ); // Initialization
//--------------------------------------------------------------------
public: public:
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid,
LLAssetType::EType type, const std::string& name);
LLInventoryObject(); LLInventoryObject();
LLInventoryObject(const LLUUID& uuid,
const LLUUID& parent_uuid,
LLAssetType::EType type,
const std::string& name);
void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy
protected:
virtual ~LLInventoryObject();
// accessors //--------------------------------------------------------------------
virtual const LLUUID& getUUID() const; // Accessors
//--------------------------------------------------------------------
public:
virtual const LLUUID& getUUID() const; // inventoryID that this item points to
virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID
const LLUUID& getParentUUID() const; const LLUUID& getParentUUID() const;
virtual const LLUUID& getLinkedUUID() const; // get the inventoryID that this item points to, else this item's inventoryID
virtual const std::string& getName() const; virtual const std::string& getName() const;
virtual LLAssetType::EType getType() const; virtual LLAssetType::EType getType() const;
LLAssetType::EType getActualType() const; // bypasses indirection for linked items LLAssetType::EType getActualType() const; // bypasses indirection for linked items
BOOL getIsLinkType() const; BOOL getIsLinkType() const;
// mutators - will not call updateServer();
//--------------------------------------------------------------------
// Mutators
// Will not call updateServer
//--------------------------------------------------------------------
public:
void setUUID(const LLUUID& new_uuid); void setUUID(const LLUUID& new_uuid);
virtual void rename(const std::string& new_name); virtual void rename(const std::string& new_name);
void setParent(const LLUUID& new_parent); void setParent(const LLUUID& new_parent);
void setType(LLAssetType::EType type); void setType(LLAssetType::EType type);
// file support - implemented here so that a minimal information private:
// set can be transmitted between simulator and viewer. // in place correction for inventory name string
// virtual BOOL importFile(LLFILE* fp); void correctInventoryName(std::string& name);
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
//--------------------------------------------------------------------
// File Support
// Implemented here so that a minimal information set can be transmitted
// between simulator and viewer.
//--------------------------------------------------------------------
public:
// virtual BOOL importFile(LLFILE* fp);
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
virtual BOOL importLegacyStream(std::istream& input_stream); virtual BOOL importLegacyStream(std::istream& input_stream);
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
// virtual methods
virtual void removeFromServer(); virtual void removeFromServer();
virtual void updateParentOnServer(BOOL) const; virtual void updateParentOnServer(BOOL) const;
virtual void updateServer(BOOL) const; virtual void updateServer(BOOL) const;
//--------------------------------------------------------------------
// Member Variables
//--------------------------------------------------------------------
protected:
LLUUID mUUID;
LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL.
LLAssetType::EType mType;
std::string mName;
}; };
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryItem // Class LLInventoryItem
// //
// An inventory item represents something that the current user has in // An item in the current user's inventory.
// their inventory.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryItem : public LLInventoryObject class LLInventoryItem : public LLInventoryObject
{ {
public: public:
typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t; typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t;
protected:
LLPermissions mPermissions;
LLUUID mAssetUUID;
std::string mDescription;
LLSaleInfo mSaleInfo;
LLInventoryType::EType mInventoryType;
U32 mFlags;
time_t mCreationDate; // seconds from 1/1/1970, UTC
public:
/**
* Anonymous enumeration for specifying the inventory item flags.
*/
enum
{
// The shared flags at the top are shared among all inventory
// types. After that section, all values of flags are type
// dependent. The shared flags will start at 2^30 and work
// down while item type specific flags will start at 2^0 and
// work up.
II_FLAGS_NONE = 0,
//
// Shared flags
//
//
// This value means that the asset has only one reference in
// the system. If the inventory item is deleted, or the asset
// id updated, then we can remove the old reference.
II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000,
//
// Landmark flags
//
II_FLAGS_LANDMARK_VISITED = 1,
//
// Object flags
//
// flag to indicate that object permissions should have next
// owner perm be more restrictive on rez. We bump this into
// the second byte of the flags since the low byte is used to
// track attachment points.
II_FLAGS_OBJECT_SLAM_PERM = 0x100,
// flag to indicate that the object sale information has been changed.
II_FLAGS_OBJECT_SLAM_SALE = 0x1000,
// These flags specify which permissions masks to overwrite
// upon rez. Normally, if no permissions slam (above) or
// overwrite flags are set, the asset's permissions are
// used and the inventory's permissions are ignored. If
// any of these flags are set, the inventory's permissions
// take precedence.
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000,
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000,
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000,
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000,
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000,
// flag to indicate whether an object that is returned is composed
// of muiltiple items or not.
II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000,
//
// wearables use the low order byte of flags to store the
// EWearableType enumeration found in newview/llwearable.h
//
II_FLAGS_WEARABLES_MASK = 0xff,
};
protected:
~LLInventoryItem(); // ref counted
//--------------------------------------------------------------------
// Initialization
//--------------------------------------------------------------------
public: public:
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
LLInventoryItem(const LLUUID& uuid, LLInventoryItem(const LLUUID& uuid,
@@ -226,13 +153,19 @@ public:
// is prohibited // is prohibited
LLInventoryItem(const LLInventoryItem* other); LLInventoryItem(const LLInventoryItem* other);
virtual void copyItem(const LLInventoryItem* other); // LLRefCount requires custom copy virtual void copyItem(const LLInventoryItem* other); // LLRefCount requires custom copy
void generateUUID() { mUUID.generate(); }
// As a constructor alternative, the clone() method works like a
// As a constructor alternative, the clone() method works like a
// copy constructor, but gens a new UUID. // copy constructor, but gens a new UUID.
// It is up to the caller to delete (unref) the item. // It is up to the caller to delete (unref) the item.
virtual void cloneItem(LLPointer<LLInventoryItem>& newitem) const; virtual void cloneItem(LLPointer<LLInventoryItem>& newitem) const;
protected:
~LLInventoryItem(); // ref counted
// accessors //--------------------------------------------------------------------
// Accessors
//--------------------------------------------------------------------
public:
virtual const LLUUID& getLinkedUUID() const; virtual const LLUUID& getLinkedUUID() const;
virtual const LLPermissions& getPermissions() const; virtual const LLPermissions& getPermissions() const;
virtual const LLUUID& getCreatorUUID() const; virtual const LLUUID& getCreatorUUID() const;
@@ -244,8 +177,12 @@ public:
virtual time_t getCreationDate() const; virtual time_t getCreationDate() const;
virtual U32 getCRC32() const; // really more of a checksum. virtual U32 getCRC32() const; // really more of a checksum.
// mutators - will not call updateServer(), and will never fail //--------------------------------------------------------------------
// (though it may correct to sane values) // Mutators
// Will not call updateServer and will never fail
// (though it may correct to sane values)
//--------------------------------------------------------------------
public:
void setAssetUUID(const LLUUID& asset_id); void setAssetUUID(const LLUUID& asset_id);
void setDescription(const std::string& new_desc); void setDescription(const std::string& new_desc);
void setSaleInfo(const LLSaleInfo& sale_info); void setSaleInfo(const LLSaleInfo& sale_info);
@@ -253,34 +190,56 @@ public:
void setInventoryType(LLInventoryType::EType inv_type); void setInventoryType(LLInventoryType::EType inv_type);
void setFlags(U32 flags); void setFlags(U32 flags);
void setCreationDate(time_t creation_date_utc); void setCreationDate(time_t creation_date_utc);
void setCreator(const LLUUID& creator); // only used for calling cards
// Put this inventory item onto the current outgoing mesage. It // Check for changes in permissions masks and sale info
// assumes you have already called nextBlock(). // and set the corresponding bits in mFlags.
void accumulatePermissionSlamBits(const LLInventoryItem& old_item);
// Put this inventory item onto the current outgoing mesage.
// Assumes you have already called nextBlock().
virtual void packMessage(LLMessageSystem* msg) const; virtual void packMessage(LLMessageSystem* msg) const;
// unpack returns TRUE if the inventory item came through the // unpack returns TRUE if the inventory item came through the
// network ok. It uses a simple crc check which is defeatable, but // network ok. It uses a simple crc check which is defeatable, but
// we want to detect network mangling somehow. // we want to detect network mangling somehow.
virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
// file support
//--------------------------------------------------------------------
// File Support
//--------------------------------------------------------------------
public:
virtual BOOL importFile(LLFILE* fp); virtual BOOL importFile(LLFILE* fp);
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const; virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
virtual BOOL importLegacyStream(std::istream& input_stream); virtual BOOL importLegacyStream(std::istream& input_stream);
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
virtual LLXMLNode *exportFileXML(BOOL include_asset_key = TRUE) const; virtual LLXMLNode *exportFileXML(BOOL include_asset_key = TRUE) const;
BOOL importXML(LLXMLNode* node); BOOL importXML(LLXMLNode* node);
// helper functions //--------------------------------------------------------------------
// Helper Functions
//--------------------------------------------------------------------
public:
// Pack all information needed to reconstruct this item into the given binary bucket.
// pack all information needed to reconstruct this item into the given binary bucket.
// perm_override is optional
S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const; S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const;
void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size); void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size);
LLSD asLLSD() const; LLSD asLLSD() const;
bool fromLLSD(LLSD& sd); void asLLSD( LLSD& sd ) const;
bool fromLLSD(const LLSD& sd);
//--------------------------------------------------------------------
// Member Variables
//--------------------------------------------------------------------
protected:
LLPermissions mPermissions;
LLUUID mAssetUUID;
std::string mDescription;
LLSaleInfo mSaleInfo;
LLInventoryType::EType mInventoryType;
U32 mFlags;
time_t mCreationDate; // seconds from 1/1/1970, UTC
}; };
BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b); BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b);
@@ -300,9 +259,9 @@ class LLInventoryCategory : public LLInventoryObject
public: public:
typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t; typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t;
protected: //--------------------------------------------------------------------
~LLInventoryCategory(); // Initialization
//--------------------------------------------------------------------
public: public:
MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
@@ -311,29 +270,39 @@ public:
LLInventoryCategory(); LLInventoryCategory();
LLInventoryCategory(const LLInventoryCategory* other); LLInventoryCategory(const LLInventoryCategory* other);
void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy
protected:
~LLInventoryCategory();
// accessors and mutators //--------------------------------------------------------------------
// Accessors And Mutators
//--------------------------------------------------------------------
public:
LLAssetType::EType getPreferredType() const; LLAssetType::EType getPreferredType() const;
void setPreferredType(LLAssetType::EType type); void setPreferredType(LLAssetType::EType type);
// For messaging system support LLSD asLLSD() const;
bool fromLLSD(const LLSD& sd);
//--------------------------------------------------------------------
// Messaging
//--------------------------------------------------------------------
public:
virtual void packMessage(LLMessageSystem* msg) const; virtual void packMessage(LLMessageSystem* msg) const;
virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
LLSD asLLSD() const; //--------------------------------------------------------------------
bool fromLLSD(LLSD& sd); // File Support
//--------------------------------------------------------------------
// file support public:
virtual BOOL importFile(LLFILE* fp); virtual BOOL importFile(LLFILE* fp);
virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const; virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
virtual BOOL importLegacyStream(std::istream& input_stream); virtual BOOL importLegacyStream(std::istream& input_stream);
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
//--------------------------------------------------------------------
// Member Variables
//--------------------------------------------------------------------
protected: protected:
// The type of asset that this category was "meant" to hold LLAssetType::EType mPreferredType; // Type that this category was "meant" to hold (although it may hold any type).
// (although it may in fact hold any type).
LLAssetType::EType mPreferredType;
}; };
@@ -404,8 +373,8 @@ struct SetNotForSale
if(LLAssetType::AT_OBJECT == item->getType()) if(LLAssetType::AT_OBJECT == item->getType())
{ {
U32 flags = item->getFlags(); U32 flags = item->getFlags();
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
item->setFlags(flags); item->setFlags(flags);
} }

View File

@@ -0,0 +1,38 @@
/**
* @file llinventorydefines.cpp
* @brief Implementation of the inventory defines.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
*/
#include "linden_common.h"
#include "llinventorydefines.h"
const U8 TASK_INVENTORY_ITEM_KEY = 0;
const U8 TASK_INVENTORY_ASSET_KEY = 1;

View File

@@ -0,0 +1,107 @@
/**
* @file llinventorydefines.h
* @brief LLInventoryDefines
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
*/
#ifndef LL_LLINVENTORYDEFINES_H
#define LL_LLINVENTORYDEFINES_H
// Consts for "key" field in the task inventory update message
extern const U8 TASK_INVENTORY_ITEM_KEY;
extern const U8 TASK_INVENTORY_ASSET_KEY;
// Max inventory buffer size (for use in packBinaryBucket)
enum
{
MAX_INVENTORY_BUFFER_SIZE = 1024
};
//--------------------------------------------------------------------
// Inventory item flags enums
// The shared flags at the top are shared among all inventory
// types. After that section, all values of flags are type
// dependent. The shared flags will start at 2^30 and work
// down while item type specific flags will start at 2^0 and work up.
//--------------------------------------------------------------------
class LLInventoryItemFlags
{
public:
enum EType
{
II_FLAGS_NONE = 0,
II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000,
// The asset has only one reference in the system. If the
// inventory item is deleted, or the assetid updated, then we
// can remove the old reference.
II_FLAGS_LANDMARK_VISITED = 1,
II_FLAGS_OBJECT_SLAM_PERM = 0x100,
// Object permissions should have next owner perm be more
// restrictive on rez. We bump this into the second byte of the
// flags since the low byte is used to track attachment points.
II_FLAGS_OBJECT_SLAM_SALE = 0x1000,
// The object sale information has been changed.
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000,
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000,
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000,
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000,
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000,
// Specify which permissions masks to overwrite
// upon rez. Normally, if no permissions slam (above) or
// overwrite flags are set, the asset's permissions are
// used and the inventory's permissions are ignored. If
// any of these flags are set, the inventory's permissions
// take precedence.
II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000,
// Whether a returned object is composed of multiple items.
II_FLAGS_WEARABLES_MASK = 0xff,
// Wearables use the low order byte of flags to store the
// LLWearableType::EType enumeration found in newview/llwearable.h
II_FLAGS_PERM_OVERWRITE_MASK = (II_FLAGS_OBJECT_SLAM_PERM |
II_FLAGS_OBJECT_SLAM_SALE |
II_FLAGS_OBJECT_PERM_OVERWRITE_BASE |
II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER |
II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP |
II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE |
II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER),
// These bits need to be cleared whenever the asset_id is updated
// on a pre-existing inventory item (DEV-28098 and DEV-30997)
};
};
#endif // LL_LLINVENTORYDEFINES_H

View File

@@ -33,66 +33,64 @@
#include "linden_common.h" #include "linden_common.h"
#include "llinventorytype.h" #include "llinventorytype.h"
#include "lldictionary.h"
#include "llmemory.h"
static const std::string empty_string;
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Class LLInventoryType /// Class LLInventoryType
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
struct InventoryEntry : public LLDictionaryEntry
// Unlike asset type names, not limited to 8 characters. {
// Need not match asset type names. InventoryEntry(const std::string &name, // unlike asset type names, not limited to 8 characters; need not match asset type names
static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] = const std::string &human_name, // for decoding to human readable form; put any and as many printable characters you want in each one.
{ int num_asset_types = 0, ...)
"texture", // 0 :
"sound", LLDictionaryEntry(name),
"callcard", mHumanName(human_name)
"landmark", {
NULL, va_list argp;
NULL, // 5 va_start(argp, num_asset_types);
"object", // Read in local textures
"notecard", for (U8 i=0; i < num_asset_types; i++)
"category", {
"root", LLAssetType::EType t = (LLAssetType::EType)va_arg(argp,int);
"script", // 10 mAssetTypes.push_back(t);
NULL, }
NULL, }
NULL,
NULL, const std::string mHumanName;
"snapshot", // 15 typedef std::vector<LLAssetType::EType> asset_vec_t;
NULL, asset_vec_t mAssetTypes;
"attach",
"wearable",
"animation",
"gesture", // 20
}; };
// This table is meant for decoding to human readable form. Put any class LLInventoryDictionary : public LLSingleton<LLInventoryDictionary>,
// and as many printable characters you want in each one. public LLDictionary<LLInventoryType::EType, InventoryEntry>
// See also LLAssetType::mAssetTypeHumanNames {
static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] = public:
{ LLInventoryDictionary();
"texture", // 0
"sound",
"calling card",
"landmark",
NULL,
NULL, // 5
"object",
"note card",
"folder",
"root",
"script", // 10
NULL,
NULL,
NULL,
NULL,
"snapshot", // 15
NULL,
"attachment",
"wearable",
"animation",
"gesture", // 20
}; };
LLInventoryDictionary::LLInventoryDictionary()
{
addEntry(LLInventoryType::IT_TEXTURE, new InventoryEntry("texture", "texture", 1, LLAssetType::AT_TEXTURE));
addEntry(LLInventoryType::IT_SOUND, new InventoryEntry("sound", "sound", 1, LLAssetType::AT_SOUND));
addEntry(LLInventoryType::IT_CALLINGCARD, new InventoryEntry("callcard", "calling card", 1, LLAssetType::AT_CALLINGCARD));
addEntry(LLInventoryType::IT_LANDMARK, new InventoryEntry("landmark", "landmark", 1, LLAssetType::AT_LANDMARK));
addEntry(LLInventoryType::IT_OBJECT, new InventoryEntry("object", "object", 1, LLAssetType::AT_OBJECT));
addEntry(LLInventoryType::IT_NOTECARD, new InventoryEntry("notecard", "note card", 1, LLAssetType::AT_NOTECARD));
addEntry(LLInventoryType::IT_CATEGORY, new InventoryEntry("category", "folder" ));
addEntry(LLInventoryType::IT_ROOT_CATEGORY, new InventoryEntry("root", "root" ));
addEntry(LLInventoryType::IT_LSL, new InventoryEntry("script", "script", 2, LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE));
addEntry(LLInventoryType::IT_SNAPSHOT, new InventoryEntry("snapshot", "snapshot", 1, LLAssetType::AT_TEXTURE));
addEntry(LLInventoryType::IT_ATTACHMENT, new InventoryEntry("attach", "attachment", 1, LLAssetType::AT_OBJECT));
addEntry(LLInventoryType::IT_WEARABLE, new InventoryEntry("wearable", "wearable", 2, LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART));
addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION));
addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE));
}
// Maps asset types to the default inventory type for that kind of asset. // Maps asset types to the default inventory type for that kind of asset.
// Thus, "Lost and Found" is a "Category" // Thus, "Lost and Found" is a "Category"
static const LLInventoryType::EType static const LLInventoryType::EType
@@ -149,74 +147,28 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
LLInventoryType::IT_NONE // AT_MY_OUTFITS LLInventoryType::IT_NONE // AT_MY_OUTFITS
}; };
static const int MAX_POSSIBLE_ASSET_TYPES = 2;
static const LLAssetType::EType
INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
{
{ LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
{ LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
{ LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
{ LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
{ LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
{ LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
{ LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
{ LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
{ LLAssetType::AT_NONE, LLAssetType::AT_NONE },
{ LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
{ LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
{ LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
{ LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
};
// static // static
const char* LLInventoryType::lookup(EType type) const std::string &LLInventoryType::lookup(EType type)
{ {
if((type >= 0) && (type < IT_COUNT)) const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(type);
{ if (!entry) return empty_string;
return INVENTORY_TYPE_NAMES[S32(type)]; return entry->mName;
}
else
{
return NULL;
}
} }
// static // static
LLInventoryType::EType LLInventoryType::lookup(const std::string& name) LLInventoryType::EType LLInventoryType::lookup(const std::string& name)
{ {
for(S32 i = 0; i < IT_COUNT; ++i) return LLInventoryDictionary::getInstance()->lookup(name);
{
if((INVENTORY_TYPE_NAMES[i])
&& (name == INVENTORY_TYPE_NAMES[i]))
{
// match
return (EType)i;
}
}
return IT_NONE;
} }
// XUI:translate // XUI:translate
// translation from a type to a human readable form. // translation from a type to a human readable form.
// static // static
const char* LLInventoryType::lookupHumanReadable(EType type) const std::string &LLInventoryType::lookupHumanReadable(EType type)
{ {
if((type >= 0) && (type < IT_COUNT)) const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(type);
{ if (!entry) return empty_string;
return INVENTORY_TYPE_HUMAN_NAMES[S32(type)]; return entry->mHumanName;
}
else
{
return NULL;
}
} }
// return the default inventory for the given asset type. // return the default inventory for the given asset type.
@@ -233,21 +185,40 @@ LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType a
} }
} }
bool inventory_and_asset_types_match(
LLInventoryType::EType inventory_type, // add any types that we don't want the user to be able to change permissions on.
LLAssetType::EType asset_type) // static
bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type)
{ {
bool rv = false; switch(type)
if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
{ {
for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i) case IT_CALLINGCARD:
case IT_LANDMARK:
return true;
default:
return false;
}
}
bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
LLAssetType::EType asset_type)
{
// Links can be of any inventory type.
if (LLAssetType::lookupIsLinkType(asset_type))
return true;
const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(inventory_type);
if (!entry) return false;
for (InventoryEntry::asset_vec_t::const_iterator iter = entry->mAssetTypes.begin();
iter != entry->mAssetTypes.end();
iter++)
{
const LLAssetType::EType type = (*iter);
if(type == asset_type)
{ {
if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type) return true;
{
rv = true;
break;
}
} }
} }
return rv; return false;
} }

View File

@@ -74,14 +74,16 @@ public:
// machine transation between type and strings // machine transation between type and strings
static EType lookup(const std::string& name); static EType lookup(const std::string& name);
static const char* lookup(EType type); static const std::string &lookup(EType type);
// translation from a type to a human readable form. // translation from a type to a human readable form.
static const char* lookupHumanReadable(EType type); static const std::string &lookupHumanReadable(EType type);
// return the default inventory for the given asset type. // return the default inventory for the given asset type.
static EType defaultForAssetType(LLAssetType::EType asset_type); static EType defaultForAssetType(LLAssetType::EType asset_type);
// true if this type cannot have restricted permissions.
static bool cannotRestrictPermissions(EType type);
private: private:
// don't instantiate or derive one of these objects // don't instantiate or derive one of these objects
LLInventoryType( void ); LLInventoryType( void );
@@ -91,8 +93,7 @@ private:
// helper function which returns true if inventory type and asset type // helper function which returns true if inventory type and asset type
// are potentially compatible. For example, an attachment must be an // are potentially compatible. For example, an attachment must be an
// object, but a wearable can be a bodypart or clothing asset. // object, but a wearable can be a bodypart or clothing asset.
bool inventory_and_asset_types_match( bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
LLInventoryType::EType inventory_type, LLAssetType::EType asset_type);
LLAssetType::EType asset_type);
#endif #endif

View File

@@ -40,7 +40,7 @@
std::pair<LLUUID, U64> LLLandmark::mLocalRegion; std::pair<LLUUID, U64> LLLandmark::mLocalRegion;
LLLandmark::region_map_t LLLandmark::mRegions; LLLandmark::region_map_t LLLandmark::mRegions;
LLLandmark::region_callback_t LLLandmark::mRegionCallback; LLLandmark::region_callback_map_t LLLandmark::sRegionCallbackMap;
LLLandmark::LLLandmark() : LLLandmark::LLLandmark() :
mGlobalPositionKnown(false) mGlobalPositionKnown(false)
@@ -177,7 +177,7 @@ void LLLandmark::requestRegionHandle(
LLMessageSystem* msg, LLMessageSystem* msg,
const LLHost& upstream_host, const LLHost& upstream_host,
const LLUUID& region_id, const LLUUID& region_id,
LLRegionHandleCallback* callback) region_handle_callback_t callback)
{ {
if(region_id.isNull()) if(region_id.isNull())
{ {
@@ -186,7 +186,7 @@ void LLLandmark::requestRegionHandle(
if(callback) if(callback)
{ {
const U64 U64_ZERO = 0; const U64 U64_ZERO = 0;
callback->dataReady(region_id, U64_ZERO); callback(region_id, U64_ZERO);
} }
} }
else else
@@ -196,7 +196,7 @@ void LLLandmark::requestRegionHandle(
lldebugs << "requestRegionHandle: local" << llendl; lldebugs << "requestRegionHandle: local" << llendl;
if(callback) if(callback)
{ {
callback->dataReady(region_id, mLocalRegion.second); callback(region_id, mLocalRegion.second);
} }
} }
else else
@@ -207,8 +207,8 @@ void LLLandmark::requestRegionHandle(
lldebugs << "requestRegionHandle: upstream" << llendl; lldebugs << "requestRegionHandle: upstream" << llendl;
if(callback) if(callback)
{ {
region_callback_t::value_type vt(region_id, callback); region_callback_map_t::value_type vt(region_id, callback);
mRegionCallback.insert(vt); sRegionCallbackMap.insert(vt);
} }
lldebugs << "Landmark requesting information about: " lldebugs << "Landmark requesting information about: "
<< region_id << llendl; << region_id << llendl;
@@ -221,7 +221,7 @@ void LLLandmark::requestRegionHandle(
{ {
// we have the answer locally - just call the callack. // we have the answer locally - just call the callack.
lldebugs << "requestRegionHandle: ready" << llendl; lldebugs << "requestRegionHandle: ready" << llendl;
callback->dataReady(region_id, (*it).second.mRegionHandle); callback(region_id, (*it).second.mRegionHandle);
} }
} }
} }
@@ -259,11 +259,11 @@ void LLLandmark::processRegionIDAndHandle(LLMessageSystem* msg, void**)
#endif #endif
// make all the callbacks here. // make all the callbacks here.
region_callback_t::iterator it; region_callback_map_t::iterator it;
while((it = mRegionCallback.find(region_id)) != mRegionCallback.end()) while((it = sRegionCallbackMap.find(region_id)) != sRegionCallbackMap.end())
{ {
(*it).second->dataReady(region_id, info.mRegionHandle); (*it).second(region_id, info.mRegionHandle);
mRegionCallback.erase(it); sRegionCallbackMap.erase(it);
} }
} }

View File

@@ -35,6 +35,7 @@
#define LL_LLLANDMARK_H #define LL_LLLANDMARK_H
#include <map> #include <map>
#include <boost/function.hpp>
#include "llframetimer.h" #include "llframetimer.h"
#include "lluuid.h" #include "lluuid.h"
#include "v3dmath.h" #include "v3dmath.h"
@@ -42,24 +43,12 @@
class LLMessageSystem; class LLMessageSystem;
class LLHost; class LLHost;
// virutal base class used for calling back interested parties when a
// region handle comes back.
class LLRegionHandleCallback
{
public:
LLRegionHandleCallback() {}
virtual ~LLRegionHandleCallback() {}
virtual bool dataReady(
const LLUUID& region_id,
const U64& region_handle)
{
return true;
}
};
class LLLandmark class LLLandmark
{ {
public: public:
// for calling back interested parties when a region handle comes back.
typedef boost::function<void(const LLUUID& region_id, const U64& region_handle)> region_handle_callback_t;
~LLLandmark() {} ~LLLandmark() {}
// returns true if the position is known. // returns true if the position is known.
@@ -90,7 +79,7 @@ public:
LLMessageSystem* msg, LLMessageSystem* msg,
const LLHost& upstream_host, const LLHost& upstream_host,
const LLUUID& region_id, const LLUUID& region_id,
LLRegionHandleCallback* callback); region_handle_callback_t callback);
// Call this method to create a lookup for this region. This // Call this method to create a lookup for this region. This
// simplifies a lot of the code. // simplifies a lot of the code.
@@ -118,8 +107,8 @@ private:
static std::pair<LLUUID, U64> mLocalRegion; static std::pair<LLUUID, U64> mLocalRegion;
typedef std::map<LLUUID, CacheInfo> region_map_t; typedef std::map<LLUUID, CacheInfo> region_map_t;
static region_map_t mRegions; static region_map_t mRegions;
typedef std::multimap<LLUUID, LLRegionHandleCallback*> region_callback_t; typedef std::multimap<LLUUID, region_handle_callback_t> region_callback_map_t;
static region_callback_t mRegionCallback; static region_callback_map_t sRegionCallbackMap;
}; };
#endif #endif

View File

@@ -35,7 +35,9 @@
#include "llstreamtools.h" #include "llstreamtools.h"
LLNotecard::LLNotecard(S32 max_text) LLNotecard::LLNotecard(S32 max_text)
: mMaxText(max_text) : mMaxText(max_text),
mVersion(0),
mEmbeddedVersion(0)
{ {
} }
@@ -203,7 +205,7 @@ bool LLNotecard::importStream(std::istream& str)
return FALSE; return FALSE;
} }
if(text_len < 0 || text_len > mMaxText) if(text_len > mMaxText || text_len < 0)
{ {
llwarns << "Invalid Linden text length: " << text_len << llendl; llwarns << "Invalid Linden text length: " << text_len << llendl;
return FALSE; return FALSE;

View File

@@ -79,23 +79,25 @@ static const std::string PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] =
"shopping", "shopping",
"stage", "stage",
"other", "other",
"rental"
}; };
static const std::string PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = static const std::string PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] =
{ {
"None", "None",
"Linden Location", "Linden Location",
"Adult", "Adult",
"Arts & Culture", "Arts and Culture",
"Business", "Business",
"Educational", "Educational",
"Gaming", "Gaming",
"Hangout", "Hangout",
"Newcomer Friendly", "Newcomer Friendly",
"Parks & Nature", "Parks and Nature",
"Residential", "Residential",
"Shopping", "Shopping",
"Stage", "Stage",
"Other", "Other",
"Rental",
"Any", // valid string for parcel searches "Any", // valid string for parcel searches
}; };
@@ -690,8 +692,8 @@ void LLParcel::packMessage(LLSD& msg)
msg["auto_scale"] = getMediaAutoScale(); msg["auto_scale"] = getMediaAutoScale();
msg["media_loop"] = getMediaLoop(); msg["media_loop"] = getMediaLoop();
msg["media_current_url"] = getMediaCurrentURL(); msg["media_current_url"] = getMediaCurrentURL();
msg["obscure_media"] = FALSE; // OBSOLETE - no longer used msg["obscure_media"] = false; // OBSOLETE - no longer used
msg["obscure_music"] = FALSE; // OBSOLETE - no longer used msg["obscure_music"] = false; // OBSOLETE - no longer used
msg["media_id"] = getMediaID(); msg["media_id"] = getMediaID();
msg["media_allow_navigate"] = getMediaAllowNavigate(); msg["media_allow_navigate"] = getMediaAllowNavigate();
msg["media_prevent_camera_zoom"] = getMediaPreventCameraZoom(); msg["media_prevent_camera_zoom"] = getMediaPreventCameraZoom();

View File

@@ -170,6 +170,7 @@ public:
C_SHOPPING, C_SHOPPING,
C_STAGE, C_STAGE,
C_OTHER, C_OTHER,
C_RENTAL,
C_COUNT, C_COUNT,
C_ANY = -1 // only useful in queries C_ANY = -1 // only useful in queries
}; };
@@ -534,7 +535,7 @@ public:
static bool isAgentBlockedFromParcel(LLParcel* parcelp, static bool isAgentBlockedFromParcel(LLParcel* parcelp,
const LLUUID& agent_id, const LLUUID& agent_id,
const std::vector<LLUUID>& group_ids, const uuid_vec_t& group_ids,
const BOOL is_agent_identified, const BOOL is_agent_identified,
const BOOL is_agent_transacted, const BOOL is_agent_transacted,
const BOOL is_agent_ageverified); const BOOL is_agent_ageverified);

View File

@@ -83,6 +83,17 @@ void LLPermissions::initMasks(PermissionMask base, PermissionMask owner,
fix(); fix();
} }
// ! BACKWARDS COMPATIBILITY ! Override masks for inventory types that
// no longer can have restricted permissions. This takes care of previous
// version landmarks that could have had no copy/mod/transfer bits set.
void LLPermissions::initMasks(LLInventoryType::EType type)
{
if (LLInventoryType::cannotRestrictPermissions(type))
{
initMasks(PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL);
}
}
BOOL LLPermissions::getOwnership(LLUUID& owner_id, BOOL& is_group_owned) const BOOL LLPermissions::getOwnership(LLUUID& owner_id, BOOL& is_group_owned) const
{ {
if(mOwner.notNull()) if(mOwner.notNull())
@@ -277,6 +288,17 @@ BOOL LLPermissions::setOwnerAndGroup(
return allowed; return allowed;
} }
//Fix for DEV-33917, last owner isn't used much and has little impact on
//permissions so it's reasonably safe to do this, however, for now,
//limiting the functionality of this routine to objects which are
//group owned.
void LLPermissions::setLastOwner(const LLUUID& last_owner)
{
if (isGroupOwned())
mLastOwner = last_owner;
}
// only call this if you know what you're doing // only call this if you know what you're doing
// there are usually perm-bit consequences when the // there are usually perm-bit consequences when the
// ownerhsip changes // ownerhsip changes
@@ -457,7 +479,7 @@ BOOL LLPermissions::setNextOwnerBits(const LLUUID& agent, const LLUUID& group, B
return ownership; return ownership;
} }
BOOL LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const bool LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const
{ {
if(requester.isNull()) if(requester.isNull())
{ {

View File

@@ -38,6 +38,7 @@
#include "lluuid.h" #include "lluuid.h"
#include "llxmlnode.h" #include "llxmlnode.h"
#include "reflective.h" #include "reflective.h"
#include "llinventorytype.h"
// prototypes // prototypes
class LLMessageSystem; class LLMessageSystem;
@@ -129,6 +130,8 @@ public:
void initMasks(PermissionMask base, PermissionMask owner, void initMasks(PermissionMask base, PermissionMask owner,
PermissionMask everyone, PermissionMask group, PermissionMask everyone, PermissionMask group,
PermissionMask next); PermissionMask next);
// adjust permissions based on inventory type.
void initMasks(LLInventoryType::EType type);
// //
// ACCESSORS // ACCESSORS
@@ -229,6 +232,9 @@ public:
// ownerhsip changes // ownerhsip changes
void yesReallySetOwner(const LLUUID& owner, bool group_owned); void yesReallySetOwner(const LLUUID& owner, bool group_owned);
// Last owner doesn't have much in the way of permissions so it's
//not too dangerous to do this.
void setLastOwner(const LLUUID& last_owner);
// saves last owner, sets owner to uuid null, sets group // saves last owner, sets owner to uuid null, sets group
// owned. group_id must be the group of the object (that's who it // owned. group_id must be the group of the object (that's who it
// is being deeded to) and the object must be group // is being deeded to) and the object must be group
@@ -249,7 +255,11 @@ public:
BOOL setGroupBits( const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits); BOOL setGroupBits( const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
BOOL setEveryoneBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits); BOOL setEveryoneBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
BOOL setNextOwnerBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits); BOOL setNextOwnerBits(const LLUUID& agent, const LLUUID& group, BOOL set, PermissionMask bits);
// This is currently only used in the Viewer to handle calling cards
// where the creator is actually used to store the target. Use with care.
void setCreator(const LLUUID& creator) { mCreator = creator; }
// //
// METHODS // METHODS
// //
@@ -261,18 +271,18 @@ public:
// They also return true if the object isn't owned, or the // They also return true if the object isn't owned, or the
// requesting agent is a system agent. See llpermissionsflags.h // requesting agent is a system agent. See llpermissionsflags.h
// for bits. // for bits.
BOOL allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const; bool allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const;
inline BOOL allowModifyBy(const LLUUID &agent_id) const; inline bool allowModifyBy(const LLUUID &agent_id) const;
inline BOOL allowCopyBy(const LLUUID& agent_id) const; inline bool allowCopyBy(const LLUUID& agent_id) const;
inline BOOL allowMoveBy(const LLUUID& agent_id) const; inline bool allowMoveBy(const LLUUID& agent_id) const;
inline BOOL allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const; inline bool allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const;
inline BOOL allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const; inline bool allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const;
inline BOOL allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const; inline bool allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const;
// This somewhat specialized function is meant for testing if the // This somewhat specialized function is meant for testing if the
// current owner is allowed to transfer to the specified agent id. // current owner is allowed to transfer to the specified agent id.
inline BOOL allowTransferTo(const LLUUID &agent_id) const; inline bool allowTransferTo(const LLUUID &agent_id) const;
// //
// DEPRECATED. // DEPRECATED.
@@ -328,38 +338,38 @@ public:
}; };
// Inlines // Inlines
BOOL LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const bool LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const
{ {
return allowOperationBy(PERM_MODIFY, agent, group); return allowOperationBy(PERM_MODIFY, agent, group);
} }
BOOL LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const bool LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const
{ {
return allowOperationBy(PERM_COPY, agent, group); return allowOperationBy(PERM_COPY, agent, group);
} }
BOOL LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const bool LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const
{ {
return allowOperationBy(PERM_MOVE, agent, group); return allowOperationBy(PERM_MOVE, agent, group);
} }
BOOL LLPermissions::allowModifyBy(const LLUUID& agent) const bool LLPermissions::allowModifyBy(const LLUUID& agent) const
{ {
return allowOperationBy(PERM_MODIFY, agent, LLUUID::null); return allowOperationBy(PERM_MODIFY, agent, LLUUID::null);
} }
BOOL LLPermissions::allowCopyBy(const LLUUID& agent) const bool LLPermissions::allowCopyBy(const LLUUID& agent) const
{ {
return allowOperationBy(PERM_COPY, agent, LLUUID::null); return allowOperationBy(PERM_COPY, agent, LLUUID::null);
} }
BOOL LLPermissions::allowMoveBy(const LLUUID& agent) const bool LLPermissions::allowMoveBy(const LLUUID& agent) const
{ {
return allowOperationBy(PERM_MOVE, agent, LLUUID::null); return allowOperationBy(PERM_MOVE, agent, LLUUID::null);
} }
BOOL LLPermissions::allowTransferTo(const LLUUID &agent_id) const bool LLPermissions::allowTransferTo(const LLUUID &agent_id) const
{ {
if (mIsGroupOwned) if (mIsGroupOwned)
{ {

View File

@@ -111,7 +111,7 @@ LLSD LLSaleInfo::asLLSD() const
return sd; return sd;
} }
bool LLSaleInfo::fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask) bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
{ {
const char *w; const char *w;

View File

@@ -98,7 +98,7 @@ public:
BOOL exportLegacyStream(std::ostream& output_stream) const; BOOL exportLegacyStream(std::ostream& output_stream) const;
LLSD asLLSD() const; LLSD asLLSD() const;
operator LLSD() const { return asLLSD(); } operator LLSD() const { return asLLSD(); }
bool fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask); bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask); BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask);
LLXMLNode *exportFileXML() const; LLXMLNode *exportFileXML() const;

View File

@@ -45,6 +45,7 @@
// Money transaction failure codes // Money transaction failure codes
const U8 TRANS_FAIL_SIMULATOR_TIMEOUT = 1; const U8 TRANS_FAIL_SIMULATOR_TIMEOUT = 1;
const U8 TRANS_FAIL_DATASERVER_TIMEOUT = 2; const U8 TRANS_FAIL_DATASERVER_TIMEOUT = 2;
const U8 TRANS_FAIL_APPLICATION = 3;
// Codes up to 999 for error conditions // Codes up to 999 for error conditions
const S32 TRANS_NULL = 0; const S32 TRANS_NULL = 0;
@@ -68,6 +69,11 @@ const S32 TRANS_PARCEL_DIR_FEE = 2003;
const S32 TRANS_GROUP_TAX = 2004; // Taxes incurred as part of group membership const S32 TRANS_GROUP_TAX = 2004; // Taxes incurred as part of group membership
const S32 TRANS_CLASSIFIED_RENEW = 2005; const S32 TRANS_CLASSIFIED_RENEW = 2005;
// Codes 2100-2999 reserved for recurring billing services
// New codes can be created through an admin interface so may not
// automatically end up in the list below :-(
// So make sure you check the transaction_description table
const S32 TRANS_RECURRING_GENERIC = 2100;
// Codes 3000-3999 reserved for inventory transactions // Codes 3000-3999 reserved for inventory transactions
const S32 TRANS_GIVE_INVENTORY = 3000; const S32 TRANS_GIVE_INVENTORY = 3000;
@@ -83,6 +89,12 @@ const S32 TRANS_DWELL_BONUS = 5007;
const S32 TRANS_PAY_OBJECT = 5008; const S32 TRANS_PAY_OBJECT = 5008;
const S32 TRANS_OBJECT_PAYS = 5009; const S32 TRANS_OBJECT_PAYS = 5009;
// Codes 5100-5999 reserved for recurring billing transfers between users
// New codes can be created through an admin interface so may not
// automatically end up in the list below :-(
// So make sure you check the transaction_description table
const S32 TRANS_RECURRING_GENERIC_USER = 5100;
// Codes 6000-6999 reserved for group transactions // Codes 6000-6999 reserved for group transactions
//const S32 TRANS_GROUP_JOIN = 6000; //reserved for future use //const S32 TRANS_GROUP_JOIN = 6000; //reserved for future use
const S32 TRANS_GROUP_LAND_DEED = 6001; const S32 TRANS_GROUP_LAND_DEED = 6001;

View File

@@ -562,14 +562,13 @@ void LLAvatarNameCache::idle()
bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id) bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id)
{ {
const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0; const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0;
F64 now = LLFrameTimer::getTotalSeconds();
F64 expire_time = now - PENDING_TIMEOUT_SECS;
pending_queue_t::const_iterator it = sPendingQueue.find(agent_id); pending_queue_t::const_iterator it = sPendingQueue.find(agent_id);
if (it != sPendingQueue.end()) if (it != sPendingQueue.end())
{ {
bool request_expired = (it->second < expire_time); // in the list of requests in flight, retry if too old
return !request_expired; F64 expire_time = LLFrameTimer::getTotalSeconds() - PENDING_TIMEOUT_SECS;
return it->second > expire_time;
} }
return false; return false;
} }
@@ -578,14 +577,12 @@ void LLAvatarNameCache::eraseExpired()
{ {
F64 now = LLFrameTimer::getTotalSeconds(); F64 now = LLFrameTimer::getTotalSeconds();
cache_t::iterator it = sCache.begin(); cache_t::iterator it = sCache.begin();
while (it != sCache.end()) for (cache_t::iterator it = sCache.begin(); it != sCache.end(); ++it)
{ {
cache_t::iterator cur = it; const LLAvatarName& av_name = it->second;
++it;
const LLAvatarName& av_name = cur->second;
if (av_name.mExpires < now) if (av_name.mExpires < now)
{ {
sCache.erase(cur); sCache.erase(it);
} }
} }
} }

View File

@@ -9,7 +9,6 @@
<string>settings_rlv.xml</string> <string>settings_rlv.xml</string>
</array> </array>
<key>SpellDownloadURL</key> <key>SpellDownloadURL</key>
<map> <map>
<key>Comment</key> <key>Comment</key>
@@ -55,6 +54,17 @@
<string>English (United States of America)</string> <string>English (United States of America)</string>
</map> </map>
<key>ScriptsCanShowUI</key>
<map>
<key>Comment</key>
<string>Allow LSL calls (such as LLMapDestination) to spawn viewer UI</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FloaterObjectBackuptRect</key> <key>FloaterObjectBackuptRect</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@@ -80,5 +80,93 @@
<real>1.0</real> <real>1.0</real>
</map> </map>
</map> <key>SGBlockGeneralSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic general spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>SGBlockCardSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic calling card spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>SGBlockChatSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic chat spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>SGBlockDialogSpam</key>
<map>
<key>Comment</key>
<string>Enable automatic dialog spam blocking</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>SGSpamTime</key>
<map>
<key>Comment</key>
<string>Time of Evalulating spam. (Default: 1.000)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>SGSpamCount</key>
<map>
<key>Comment</key>
<string>Number of items spammed per time period in SGSpamTime. (Default: 4)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<real>4</real>
</map>
<key>SGChatSpamTime</key>
<map>
<key>Comment</key>
<string>Time of Evalulating spam. (Default: 1.000)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>SGChatSpamCount</key>
<map>
<key>Comment</key>
<string>Number of items spammed per time set in SGSpamTime. (Default: 10)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<real>10.0</real>
</map>
</map>
</llsd> </llsd>

View File

@@ -279,7 +279,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
mPostData["name"].asString(), mPostData["name"].asString(),
mPostData["description"].asString(), mPostData["description"].asString(),
LLSaleInfo::DEFAULT, LLSaleInfo::DEFAULT,
LLInventoryItem::II_FLAGS_NONE, LLInventoryItemFlags::II_FLAGS_NONE,
creation_date_now); creation_date_now);
gInventory.updateItem(item); gInventory.updateItem(item);
gInventory.notifyObservers(); gInventory.notifyObservers();

View File

@@ -144,7 +144,7 @@ LLFloaterScriptQueue* LLFloaterScriptQueue::findInstance(const LLUUID& id)
// worked on. // worked on.
// NOT static, virtual! // NOT static, virtual!
void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object, void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32, S32,
void* q_id) void* q_id)
{ {
@@ -353,7 +353,7 @@ LLFloaterCompileQueue::~LLFloaterCompileQueue()
} }
void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
InventoryObjectList* inv) LLInventoryObject::object_list_t* inv)
{ {
// find all of the lsl, leaving off duplicates. We'll remove // find all of the lsl, leaving off duplicates. We'll remove
// all matching asset uuids on compilation success. // all matching asset uuids on compilation success.
@@ -361,8 +361,8 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
typedef std::multimap<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map; typedef std::multimap<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map;
uuid_item_map asset_item_map; uuid_item_map asset_item_map;
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if((*it)->getType() == LLAssetType::AT_LSL_TEXT) if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
@@ -678,14 +678,14 @@ LLFloaterResetQueue::~LLFloaterResetQueue()
} }
void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv) LLInventoryObject::object_list_t* inv)
{ {
// find all of the lsl, leaving off duplicates. We'll remove // find all of the lsl, leaving off duplicates. We'll remove
// all matching asset uuids on compilation success. // all matching asset uuids on compilation success.
LLDynamicArray<const char*> names; LLDynamicArray<const char*> names;
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if((*it)->getType() == LLAssetType::AT_LSL_TEXT) if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
@@ -740,14 +740,14 @@ LLFloaterRunQueue::~LLFloaterRunQueue()
} }
void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv) LLInventoryObject::object_list_t* inv)
{ {
// find all of the lsl, leaving off duplicates. We'll remove // find all of the lsl, leaving off duplicates. We'll remove
// all matching asset uuids on compilation success. // all matching asset uuids on compilation success.
LLDynamicArray<const char*> names; LLDynamicArray<const char*> names;
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if((*it)->getType() == LLAssetType::AT_LSL_TEXT) if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
@@ -804,14 +804,14 @@ LLFloaterNotRunQueue::~LLFloaterNotRunQueue()
} }
void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv) LLInventoryObject::object_list_t* inv)
{ {
// find all of the lsl, leaving off duplicates. We'll remove // find all of the lsl, leaving off duplicates. We'll remove
// all matching asset uuids on compilation success. // all matching asset uuids on compilation success.
LLDynamicArray<const char*> names; LLDynamicArray<const char*> names;
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if((*it)->getType() == LLAssetType::AT_LSL_TEXT) if((*it)->getType() == LLAssetType::AT_LSL_TEXT)

View File

@@ -76,13 +76,13 @@ protected:
// This is the callback method for the viewer object currently // This is the callback method for the viewer object currently
// being worked on. // being worked on.
/*virtual*/ void inventoryChanged(LLViewerObject* obj, /*virtual*/ void inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* queue); void* queue);
// This is called by inventoryChanged // This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj, virtual void handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv) = 0; LLInventoryObject::object_list_t* inv) = 0;
static void onCloseBtn(void* user_data); static void onCloseBtn(void* user_data);
@@ -149,7 +149,7 @@ protected:
// This is called by inventoryChanged // This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj, virtual void handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv); LLInventoryObject::object_list_t* inv);
// This is the callback for when each script arrives // This is the callback for when each script arrives
static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id, static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
@@ -201,7 +201,7 @@ protected:
// This is called by inventoryChanged // This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj, virtual void handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv); LLInventoryObject::object_list_t* inv);
protected: protected:
}; };
@@ -225,7 +225,7 @@ protected:
// This is called by inventoryChanged // This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj, virtual void handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv); LLInventoryObject::object_list_t* inv);
protected: protected:
}; };
@@ -249,7 +249,7 @@ protected:
// This is called by inventoryChanged // This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj, virtual void handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv); LLInventoryObject::object_list_t* inv);
protected: protected:
}; };

View File

@@ -110,7 +110,7 @@ void LLFloaterBulkPermission::doApply()
// worked on. // worked on.
// NOT static, virtual! // NOT static, virtual!
void LLFloaterBulkPermission::inventoryChanged(LLViewerObject* viewer_object, void LLFloaterBulkPermission::inventoryChanged(LLViewerObject* viewer_object,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32, S32,
void* q_id) void* q_id)
{ {
@@ -253,12 +253,12 @@ void LLFloaterBulkPermission::doCheckUncheckAll(BOOL check)
} }
void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv) void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv)
{ {
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
LLAssetType::EType asstype = (*it)->getType(); LLAssetType::EType asstype = (*it)->getType();
@@ -292,7 +292,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, Invent
if((perm.getMaskNextOwner() != desired_next_owner_perms) if((perm.getMaskNextOwner() != desired_next_owner_perms)
&& (new_item->getType() == LLAssetType::AT_OBJECT)) && (new_item->getType() == LLAssetType::AT_OBJECT))
{ {
flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
} }
// If everyone permissions have changed (and this is an object) // If everyone permissions have changed (and this is an object)
// then set the overwrite everyone permissions flag so they // then set the overwrite everyone permissions flag so they
@@ -300,7 +300,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, Invent
if ((perm.getMaskEveryone() != desired_everyone_perms) if ((perm.getMaskEveryone() != desired_everyone_perms)
&& (new_item->getType() == LLAssetType::AT_OBJECT)) && (new_item->getType() == LLAssetType::AT_OBJECT))
{ {
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
} }
// If group permissions have changed (and this is an object) // If group permissions have changed (and this is an object)
// then set the overwrite group permissions flag so they // then set the overwrite group permissions flag so they
@@ -308,7 +308,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, Invent
if ((perm.getMaskGroup() != desired_group_perms) if ((perm.getMaskGroup() != desired_group_perms)
&& (new_item->getType() == LLAssetType::AT_OBJECT)) && (new_item->getType() == LLAssetType::AT_OBJECT))
{ {
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
} }
// chomp the inventory name so it fits in the scroll window nicely // chomp the inventory name so it fits in the scroll window nicely

View File

@@ -62,13 +62,13 @@ private:
// This is the callback method for the viewer object currently // This is the callback method for the viewer object currently
// being worked on. // being worked on.
/*virtual*/ void inventoryChanged(LLViewerObject* obj, /*virtual*/ void inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* queue); void* queue);
// This is called by inventoryChanged // This is called by inventoryChanged
void handleInventory(LLViewerObject* viewer_obj, void handleInventory(LLViewerObject* viewer_obj,
InventoryObjectList* inv); LLInventoryObject::object_list_t* inv);
void updateInventory(LLViewerObject* object, void updateInventory(LLViewerObject* object,

View File

@@ -199,7 +199,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
} }
void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* data) void* data)
{ {
@@ -224,8 +224,8 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
return; return;
} }
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it ) for ( ; it != end; ++it )
{ {
LLInventoryObject* obj = (LLInventoryObject*)(*it); LLInventoryObject* obj = (LLInventoryObject*)(*it);
@@ -254,7 +254,7 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
// Compute icon for this item // Compute icon for this item
BOOL item_is_multi = FALSE; BOOL item_is_multi = FALSE;
if ( inv_item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED ) if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED )
{ {
item_is_multi = TRUE; item_is_multi = TRUE;
} }

View File

@@ -63,7 +63,7 @@ protected:
void requestObjectInventories(); void requestObjectInventories();
/*virtual*/ void inventoryChanged(LLViewerObject* obj, /*virtual*/ void inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* data); void* data);

View File

@@ -145,7 +145,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* data) void* data)
{ {
@@ -179,8 +179,8 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
LLInventoryType::EType inv_type; LLInventoryType::EType inv_type;
S32 wearable_count = 0; S32 wearable_count = 0;
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it ) for ( ; it != end; ++it )
{ {
@@ -222,7 +222,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
LLSD row; LLSD row;
BOOL item_is_multi = FALSE; BOOL item_is_multi = FALSE;
if ( inv_item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED ) if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED )
{ {
item_is_multi = TRUE; item_is_multi = TRUE;
} }

View File

@@ -58,7 +58,7 @@ protected:
void requestObjectInventories(); void requestObjectInventories();
/*virtual*/ void inventoryChanged(LLViewerObject* obj, /*virtual*/ void inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* data); void* data);

View File

@@ -327,7 +327,7 @@ void LLFloaterInspect::refresh()
} }
// <edit> // <edit>
void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object, void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32, S32,
void* q_id) void* q_id)
{ {
@@ -335,8 +335,8 @@ void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object,
std::vector<LLUUID>::iterator iter = std::find(mQueue.begin(),mQueue.end(),viewer_object->getID()); std::vector<LLUUID>::iterator iter = std::find(mQueue.begin(),mQueue.end(),viewer_object->getID());
if (viewer_object && inv && iter != mQueue.end() ) if (viewer_object && inv && iter != mQueue.end() )
{ {
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if((*it)->getType() == LLAssetType::AT_LSL_TEXT) if((*it)->getType() == LLAssetType::AT_LSL_TEXT)

View File

@@ -66,7 +66,7 @@ protected:
bool mDirty; bool mDirty;
// <edit> // <edit>
/*virtual*/ void inventoryChanged(LLViewerObject* obj, /*virtual*/ void inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* queue); void* queue);

View File

@@ -478,9 +478,9 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
if (item->getType() == LLAssetType::AT_OBJECT) if (item->getType() == LLAssetType::AT_OBJECT)
{ {
U32 flags = item->getFlags(); U32 flags = item->getFlags();
slam_perm = flags & LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; slam_perm = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
overwrite_everyone = flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; overwrite_everyone = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
overwrite_group = flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; overwrite_group = flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
} }
std::string perm_string; std::string perm_string;
@@ -805,7 +805,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner()) if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner())
&& (item->getType() == LLAssetType::AT_OBJECT)) && (item->getType() == LLAssetType::AT_OBJECT))
{ {
flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
} }
// If everyone permissions have changed (and this is an object) // If everyone permissions have changed (and this is an object)
// then set the overwrite everyone permissions flag so they // then set the overwrite everyone permissions flag so they
@@ -813,7 +813,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone()) if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone())
&& (item->getType() == LLAssetType::AT_OBJECT)) && (item->getType() == LLAssetType::AT_OBJECT))
{ {
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
} }
// If group permissions have changed (and this is an object) // If group permissions have changed (and this is an object)
// then set the overwrite group permissions flag so they // then set the overwrite group permissions flag so they
@@ -821,7 +821,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup()) if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup())
&& (item->getType() == LLAssetType::AT_OBJECT)) && (item->getType() == LLAssetType::AT_OBJECT))
{ {
flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
} }
new_item->setFlags(flags); new_item->setFlags(flags);
if(self->mObjectID.isNull()) if(self->mObjectID.isNull())
@@ -939,7 +939,7 @@ void LLFloaterProperties::updateSaleInfo()
if (item->getType() == LLAssetType::AT_OBJECT) if (item->getType() == LLAssetType::AT_OBJECT)
{ {
U32 flags = new_item->getFlags(); U32 flags = new_item->getFlags();
flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_SALE; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
new_item->setFlags(flags); new_item->setFlags(flags);
} }

View File

@@ -879,13 +879,13 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
} }
const char* safe_inv_type_lookup(LLInventoryType::EType inv_type) const std::string &safe_inv_type_lookup(LLInventoryType::EType inv_type)
{ {
const char* rv = LLInventoryType::lookup(inv_type); const std::string &rv = LLInventoryType::lookup(inv_type);
if(!rv) if(rv.empty())
{ {
const char* INVALID_TYPE = "<invalid>"; static const std::string INVALID_TYPE("<invalid>");
rv = INVALID_TYPE; return INVALID_TYPE;
} }
return rv; return rv;
} }
@@ -5452,7 +5452,7 @@ LLUIImagePtr LLLinkItemBridge::getIcon() const
if (LLViewerInventoryItem *item = getItem()) if (LLViewerInventoryItem *item = getItem())
{ {
U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags
bool is_multi = LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags(); bool is_multi = LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags();
return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi); return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi);
} }

View File

@@ -454,7 +454,7 @@ protected:
LLItemBridge(inventory, uuid) LLItemBridge(inventory, uuid)
{ {
mVisited = FALSE; mVisited = FALSE;
if (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED) if (flags & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
{ {
mVisited = TRUE; mVisited = TRUE;
} }
@@ -593,7 +593,7 @@ protected:
{ {
mAttachPt = (flags & 0xff); // low bye of inventory flags mAttachPt = (flags & 0xff); // low bye of inventory flags
mIsMultiObject = ( flags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE; mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE;
} }
protected: protected:

View File

@@ -239,7 +239,7 @@ LLInventoryModel::~LLInventoryModel()
// chain up to the category specified by UUID. // chain up to the category specified by UUID.
BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id, BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id,
const LLUUID& cat_id, const LLUUID& cat_id,
const BOOL break_on_recursion) const BOOL break_on_recursion) const
{ {
LLInventoryObject* obj = getObject(obj_id); LLInventoryObject* obj = getObject(obj_id);
int depthCounter = 0; int depthCounter = 0;
@@ -375,7 +375,7 @@ void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id)
// specifies 'type' as what it defaults to containing. The category is // specifies 'type' as what it defaults to containing. The category is
// not necessarily only for that type. *NOTE: This will create a new // not necessarily only for that type. *NOTE: This will create a new
// inventory category on the fly if one does not exist. // inventory category on the fly if one does not exist.
LLUUID LLInventoryModel::findCategoryUUIDForType(LLAssetType::EType t, bool create_folder) const LLUUID LLInventoryModel::findCategoryUUIDForType(LLAssetType::EType t, bool create_folder)
{ {
LLUUID rv = findCatUUID(t); LLUUID rv = findCatUUID(t);
if(rv.isNull() && isInventoryUsable() && create_folder) if(rv.isNull() && isInventoryUsable() && create_folder)
@@ -750,7 +750,7 @@ void LLInventoryModel::appendPath(const LLUUID& id, std::string& path)
path.append(temp); path.append(temp);
} }
bool LLInventoryModel::isInventoryUsable() bool LLInventoryModel::isInventoryUsable() const
{ {
bool result = false; bool result = false;
if(gAgent.getInventoryRootID().notNull() && mIsAgentInvUsable) if(gAgent.getInventoryRootID().notNull() && mIsAgentInvUsable)
@@ -1230,7 +1230,7 @@ void LLInventoryModel::removeObserver(LLInventoryObserver* observer)
mObservers.erase(observer); mObservers.erase(observer);
} }
BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) const
{ {
return mObservers.find(observer) != mObservers.end(); return mObservers.find(observer) != mObservers.end();
} }
@@ -1381,14 +1381,14 @@ void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::str
gInventory.notifyObservers("fetchinventory"); gInventory.notifyObservers("fetchinventory");
} }
void LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const
{ {
LLViewerInventoryCategory* cat = getCategory(folder_id); LLViewerInventoryCategory* cat = getCategory(folder_id);
if(!cat) if(!cat)
{ {
llwarns << "Asked to fetch descendents of non-existent folder: " llwarns << "Asked to fetch descendents of non-existent folder: "
<< folder_id << llendl; << folder_id << llendl;
return; return false;
} }
//S32 known_descendents = 0; //S32 known_descendents = 0;
///cat_array_t* categories = get_ptr_in_map(mParentChildCategoryTree, folder_id); ///cat_array_t* categories = get_ptr_in_map(mParentChildCategoryTree, folder_id);
@@ -1401,10 +1401,7 @@ void LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
//{ //{
// known_descendents += items->count(); // known_descendents += items->count();
//} //}
if(!cat->fetchDescendents()) return cat->fetchDescendents();
{
//llinfos << "Not fetching descendents" << llendl;
}
} }
//Initialize statics. //Initialize statics.
@@ -1999,7 +1996,7 @@ void LLInventoryModel::empty()
//mInventory.clear(); //mInventory.clear();
} }
void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
{ {
LLViewerInventoryCategory* cat = getCategory(update.mCategoryID); LLViewerInventoryCategory* cat = getCategory(update.mCategoryID);
if(cat) if(cat)
@@ -3799,11 +3796,11 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
} }
// *NOTE: DEBUG functionality // *NOTE: DEBUG functionality
void LLInventoryModel::dumpInventory() void LLInventoryModel::dumpInventory() const
{ {
LL_DEBUGS("Inventory") << "\nBegin Inventory Dump\n**********************:" << LL_ENDL; LL_DEBUGS("Inventory") << "\nBegin Inventory Dump\n**********************:" << LL_ENDL;
LL_DEBUGS("Inventory") << "mCategroy[] contains " << mCategoryMap.size() << " items." << LL_ENDL; LL_DEBUGS("Inventory") << "mCategroy[] contains " << mCategoryMap.size() << " items." << LL_ENDL;
for(cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
{ {
LLViewerInventoryCategory* cat = cit->second; LLViewerInventoryCategory* cat = cit->second;
if(cat) if(cat)
@@ -3818,7 +3815,7 @@ void LLInventoryModel::dumpInventory()
} }
} }
LL_DEBUGS("Inventory") << "mItemMap[] contains " << mItemMap.size() << " items." << LL_ENDL; LL_DEBUGS("Inventory") << "mItemMap[] contains " << mItemMap.size() << " items." << LL_ENDL;
for(item_map_t::iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit) for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit)
{ {
LLViewerInventoryItem* item = iit->second; LLViewerInventoryItem* item = iit->second;
if(item) if(item)

View File

@@ -72,18 +72,6 @@ public:
virtual void changed(U32 mask) = 0; virtual void changed(U32 mask) = 0;
std::string mMessageName; // used by Agent Inventory Service only. [DEV-20328] std::string mMessageName; // used by Agent Inventory Service only. [DEV-20328]
}; };
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLInventoryModel
//
// This class represents a collection of inventory, and provides
// efficient ways to access that information. This class could in
// theory be used for any place where you need inventory, though it
// optimizes for time efficiency - not space efficiency, probably
// making it inappropriate for use on tasks.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryObject; class LLInventoryObject;
class LLInventoryItem; class LLInventoryItem;
class LLInventoryCategory; class LLInventoryCategory;
@@ -94,159 +82,255 @@ class LLViewerInventoryCategory;
class LLMessageSystem; class LLMessageSystem;
class LLInventoryCollectFunctor; class LLInventoryCollectFunctor;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLInventoryModel
//
// Represents a collection of inventory, and provides efficient ways to access
// that information.
// NOTE: This class could in theory be used for any place where you need
// inventory, though it optimizes for time efficiency - not space efficiency,
// probably making it inappropriate for use on tasks.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLInventoryModel class LLInventoryModel
{ {
public: public:
typedef enum e_has_children enum EHasChildren
{ {
CHILDREN_NO, CHILDREN_NO,
CHILDREN_YES, CHILDREN_YES,
CHILDREN_MAYBE CHILDREN_MAYBE
}EHasChildren; };
// These are used a lot...
typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t; typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t; typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
// construction & destruction typedef std::set<LLUUID> changed_items_t;
LLInventoryModel();
~LLInventoryModel();
class fetchInventoryResponder: public LLHTTPClient::Responder class fetchInventoryResponder : public LLHTTPClient::Responder
{ {
public: public:
fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
void result(const LLSD& content); void result(const LLSD& content);
void error(U32 status, const std::string& reason); void error(U32 status, const std::string& reason);
public: public:
typedef std::vector<LLViewerInventoryCategory*> folder_ref_t; typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
protected: protected:
LLSD mRequestSD; LLSD mRequestSD;
}; };
// /********************************************************************************
// Accessors ** **
// ** INITIALIZATION/SETUP
**/
// This is a convenience function to check if one object has a //--------------------------------------------------------------------
// parent chain up to the category specified by UUID. // Constructors / Destructors
BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id, const BOOL break_on_recursion=FALSE); //--------------------------------------------------------------------
public:
LLInventoryModel();
~LLInventoryModel();
//<edit>
//protected:
//</edit>
void empty(); // empty the entire contents
// Get the object by id. Returns NULL if not found. //--------------------------------------------------------------------
// * WARNING: use the pointer returned for read operations - do // Initialization
// not modify the object values in place or you will break stuff. //--------------------------------------------------------------------
LLInventoryObject* getObject(const LLUUID& id) const; public:
// The inventory model usage is sensitive to the initial construction of the model
bool isInventoryUsable() const;
private:
bool mIsAgentInvUsable; // used to handle an invalid inventory state
// Get the item by id. Returns NULL if not found. //--------------------------------------------------------------------
// * WARNING: use the pointer for read operations - use the // Structure
// updateItem() method to actually modify values. //--------------------------------------------------------------------
LLViewerInventoryItem* getItem(const LLUUID& id) const; public:
// Methods to load up inventory skeleton & meat. These are used
// during authentication. Returns true if everything parsed.
bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
void buildParentChildMap(); // brute force method to rebuild the entire parent-child relations
// Call on logout to save a terse representation.
void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
private:
// Information for tracking the actual inventory. We index this
// information in a lot of different ways so we can access
// the inventory using several different identifiers.
// mInventory member data is the 'master' list of inventory, and
// mCategoryMap and mItemMap store uuid->object mappings.
typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
cat_map_t mCategoryMap;
item_map_t mItemMap;
// This last set of indices is used to map parents to children.
typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
parent_cat_map_t mParentChildCategoryTree;
parent_item_map_t mParentChildItemTree;
// Get the category by id. Returns NULL if not found. //--------------------------------------------------------------------
// * WARNING: use the pointer for read operations - use the // Login
// updateCategory() method to actually modify values. //--------------------------------------------------------------------
LLViewerInventoryCategory* getCategory(const LLUUID& id) const; const static S32 sCurrentInvCacheVersion; // expected inventory cache version
// Return the number of items or categories /** Initialization/Setup
S32 getItemCount() const; ** **
S32 getCategoryCount() const; *******************************************************************************/
/********************************************************************************
** **
** ACCESSORS
**/
//--------------------------------------------------------------------
// Descendents
//--------------------------------------------------------------------
public:
// Make sure we have the descendents in the structure. Returns true
// if a fetch was performed.
bool fetchDescendentsOf(const LLUUID& folder_id) const;
// Return the direct descendents of the id provided.Set passed // Return the direct descendents of the id provided.Set passed
// in values to NULL if the call fails. // in values to NULL if the call fails.
// *WARNING: The array provided points straight into the guts of // NOTE: The array provided points straight into the guts of
// this object, and should only be used for read operations, since // this object, and should only be used for read operations, since
// modifications may invalidate the internal state of the // modifications may invalidate the internal state of the inventory.
// inventory.
void getDirectDescendentsOf(const LLUUID& cat_id, void getDirectDescendentsOf(const LLUUID& cat_id,
cat_array_t*& categories, cat_array_t*& categories,
item_array_t*& items) const; item_array_t*& items) const;
// SJB: Added version to lock the arrays to catch potential logic bugs // Starting with the object specified, add its descendents to the
void lockDirectDescendentArrays(const LLUUID& cat_id,
cat_array_t*& categories,
item_array_t*& items);
void unlockDirectDescendentArrays(const LLUUID& cat_id);
// Starting with the object specified, add it's descendents to the
// array provided, but do not add the inventory object specified // array provided, but do not add the inventory object specified
// by id. There is no guaranteed order. Neither array will be // by id. There is no guaranteed order.
// erased before adding objects to it. Do not store a copy of the // NOTE: Neither array will be erased before adding objects to it.
// pointers collected - use them, and collect them again later if // Do not store a copy of the pointers collected - use them, and
// you need to reference the same objects. // collect them again later if you need to reference the same objects.
enum { EXCLUDE_TRASH = FALSE, INCLUDE_TRASH = TRUE }; enum {
EXCLUDE_TRASH = FALSE,
INCLUDE_TRASH = TRUE
};
void collectDescendents(const LLUUID& id, void collectDescendents(const LLUUID& id,
cat_array_t& categories, cat_array_t& categories,
item_array_t& items, item_array_t& items,
BOOL include_trash); BOOL include_trash);
void collectDescendentsIf(const LLUUID& id, void collectDescendentsIf(const LLUUID& id,
cat_array_t& categories, cat_array_t& categories,
item_array_t& items, item_array_t& items,
BOOL include_trash, BOOL include_trash,
LLInventoryCollectFunctor& add, LLInventoryCollectFunctor& add,
BOOL follow_folder_links = FALSE); BOOL follow_folder_links = FALSE);
// Collect all items in inventory that are linked to item_id. // Collect all items in inventory that are linked to item_id.
// Assumes item_id is itself not a linked item. // Assumes item_id is itself not a linked item.
item_array_t collectLinkedItems(const LLUUID& item_id, item_array_t collectLinkedItems(const LLUUID& item_id,
const LLUUID& start_folder_id = LLUUID::null); const LLUUID& start_folder_id = LLUUID::null);
// Get the inventoryID that this item points to, else just return item_id // Check if one object has a parent chain up to the category specified by UUID.
BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id, const BOOL break_on_recursion=FALSE) const;
//--------------------------------------------------------------------
// Find
//--------------------------------------------------------------------
public:
// Returns the uuid of the category that specifies 'type' as what it
// defaults to containing. The category is not necessarily only for that type.
// NOTE: If create_folder is true, this will create a new inventory category
// on the fly if one does not exist. *NOTE: if find_in_library is true it
// will search in the user's library folder instead of "My Inventory"
const LLUUID findCategoryUUIDForType(LLAssetType::EType preferred_type,
bool create_folder = true
/*,bool find_in_library = false*/);
// Get whatever special folder this object is a child of, if any.
const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
// Get the object by id. Returns NULL if not found.
// NOTE: Use the pointer returned for read operations - do
// not modify the object values in place or you will break stuff.
LLInventoryObject* getObject(const LLUUID& id) const;
// Get the item by id. Returns NULL if not found.
// NOTE: Use the pointer for read operations - use the
// updateItem() method to actually modify values.
LLViewerInventoryItem* getItem(const LLUUID& id) const;
// Get the category by id. Returns NULL if not found.
// NOTE: Use the pointer for read operations - use the
// updateCategory() method to actually modify values.
LLViewerInventoryCategory* getCategory(const LLUUID& id) const;
// Get the inventoryID or item that this item points to, else just return object_id
const LLUUID& getLinkedItemID(const LLUUID& object_id) const; const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const; LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const;
LLUUID findCategoryByName(std::string name);
private:
mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups
// This method will return false if this inventory model is in an usabel state. //--------------------------------------------------------------------
// The inventory model usage is sensitive to the initial construction of the // Count
// model. //--------------------------------------------------------------------
bool isInventoryUsable(); public:
// Return the number of items or categories
S32 getItemCount() const;
S32 getCategoryCount() const;
// /** Accessors
// Mutators ** **
// *******************************************************************************/
// Calling this method with an inventory item will either change /********************************************************************************
// an existing item with a matching item_id, or will add the item ** **
** MUTATORS
**/
public:
// Change an existing item with a matching item_id or add the item
// to the current inventory. Returns the change mask generated by // to the current inventory. Returns the change mask generated by
// the update. No notifcation will be sent to observers. This // the update. No notification will be sent to observers. This
// method will only generate network traffic if the item had to be // method will only generate network traffic if the item had to be
// reparented. // reparented.
// *NOTE: In usage, you will want to perform cache accounting // NOTE: In usage, you will want to perform cache accounting
// operations in LLInventoryModel::accountForUpdate() or // operations in LLInventoryModel::accountForUpdate() or
// LLViewerInventoryItem::updateServer() before calling this // LLViewerInventoryItem::updateServer() before calling this method.
// method.
U32 updateItem(const LLViewerInventoryItem* item); U32 updateItem(const LLViewerInventoryItem* item);
// Calling this method with an inventory category will either // Change an existing item with the matching id or add
// change an existing item with the matching id, or it will add
// the category. No notifcation will be sent to observers. This // the category. No notifcation will be sent to observers. This
// method will only generate network traffic if the item had to be // method will only generate network traffic if the item had to be
// reparented. // reparented.
// *NOTE: In usage, you will want to perform cache accounting // NOTE: In usage, you will want to perform cache accounting
// operations in LLInventoryModel::accountForUpdate() or // operations in accountForUpdate() or LLViewerInventoryCategory::
// LLViewerInventoryCategory::updateServer() before calling this // updateServer() before calling this method.
// method.
void updateCategory(const LLViewerInventoryCategory* cat); void updateCategory(const LLViewerInventoryCategory* cat);
// This method will move the specified object id to the specified // Move the specified object id to the specified category and
// category, update the internal structures. No cache accounting, // update the internal structures. No cache accounting,
// observer notification, or server update is performed. // observer notification, or server update is performed.
void moveObject(const LLUUID& object_id, const LLUUID& cat_id); void moveObject(const LLUUID& object_id, const LLUUID& cat_id);
// delete a particular inventory object by ID. This will purge one //--------------------------------------------------------------------
// object from the internal data structures maintaining a // Delete
// cosistent internal state. No cache accounting, observer //--------------------------------------------------------------------
public:
// Delete a particular inventory object by ID. Will purge one
// object from the internal data structures, maintaining a
// consistent internal state. No cache accounting, observer
// notification, or server update is performed. // notification, or server update is performed.
void deleteObject(const LLUUID& id); void deleteObject(const LLUUID& id);
// Delete a particular inventory object by ID, and delete it from // Delete a particular inventory object by ID, and delete it from
// the server. Also updates linked items. // the server. Also updates linked items.
void purgeObject(const LLUUID& id); void purgeObject(const LLUUID& id);
// This is a method which collects the descendents of the id // Collects and purges the descendants of the id
// provided. If the category is not found, no action is // provided. If the category is not found, no action is
// taken. This method goes through the long winded process of // taken. This method goes through the long winded process of
// removing server representation of folders and items while doing // removing server representation of folders and items while doing
// cache accounting in a fairly efficient manner. This method does // cache accounting in a fairly efficient manner. This method does
// not notify observers (though maybe it shouldd...) // not notify observers (though maybe it should...)
void purgeDescendentsOf(const LLUUID& id); void purgeDescendentsOf(const LLUUID& id);
// This method optimally removes the referenced categories and // This method optimally removes the referenced categories and
@@ -256,51 +340,15 @@ public:
void deleteFromServer(LLDynamicArray<LLUUID>& category_ids, void deleteFromServer(LLDynamicArray<LLUUID>& category_ids,
LLDynamicArray<LLUUID>& item_ids); LLDynamicArray<LLUUID>& item_ids);
// Add/remove an observer. If the observer is destroyed, be sure
// to remove it.
void addObserver(LLInventoryObserver* observer);
void removeObserver(LLInventoryObserver* observer);
BOOL containsObserver(LLInventoryObserver* observer);
// //
// Misc Methods // Misc Methods
// //
// findCategoryUUIDForType() returns the uuid of the category that
// specifies 'type' as what it defaults to containing. The
// category is not necessarily only for that type. *NOTE: This
// will create a new inventory category on the fly if one does not
// exist.
// SDK: Added flag to specify whether the folder should be created if not found. This fixes the horrible
// multiple trash can bug.
LLUUID findCategoryUUIDForType(LLAssetType::EType preferred_type, bool create_folder = true);
// Get whatever special folder this object is a child of, if any.
const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;
// Call this method when it's time to update everyone on a new
// state, by default, the inventory model will not update
// observers automatically.
// The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328]
void notifyObservers(const std::string service_name="");
// This allows outsiders to tell the inventory if something has
// been changed 'under the hood', but outside the control of the
// inventory. For example, if we grant someone modify permissions,
// then that changes the data structures for LLAvatarTracker, but
// potentially affects inventory observers. This API makes sure
// that the next notify will include that notification.
void addChangedMask(U32 mask, const LLUUID& referent);
const std::set<LLUUID>& getChangedIDs() { return mChangedItemIDs; }
// This method to prepares a set of mock inventory which provides // This method to prepares a set of mock inventory which provides
// minimal functionality before the actual arrival of inventory. // minimal functionality before the actual arrival of inventory.
//void mock(const LLUUID& root_id); //void mock(const LLUUID& root_id);
// make sure we have the descendents in the structure.
void fetchDescendentsOf(const LLUUID& folder_id);
// Add categories to a list to be fetched in bulk. // Add categories to a list to be fetched in bulk.
static void bulkFetch(std::string url); static void bulkFetch(std::string url);
@@ -308,27 +356,27 @@ public:
// call this method to request the inventory. // call this method to request the inventory.
//void requestFromServer(const LLUUID& agent_id); //void requestFromServer(const LLUUID& agent_id);
// call this method on logout to save a terse representation
void cache(const LLUUID& parent_folder_id, const LLUUID& agent_id);
// Generates a string containing the path to the item specified by // Generates a string containing the path to the item specified by
// item_id. // item_id.
void appendPath(const LLUUID& id, std::string& path); void appendPath(const LLUUID& id, std::string& path);
// message handling functionality //--------------------------------------------------------------------
static void registerCallbacks(LLMessageSystem* msg); // Creation
//--------------------------------------------------------------------
// Convenience function to create a new category. You could call public:
// updateCatgory() with a newly generated UUID category, but this // Returns the UUID of the new category. If you want to use the default
// version will take care of details like what the name should be // name based on type, pass in a NULL to the 'name' parameter.
// based on preferred type. Returns the UUID of the new
// category. If you want to use the default name based on type,
// pass in a NULL to the 'name parameter.
LLUUID createNewCategory(const LLUUID& parent_id, LLUUID createNewCategory(const LLUUID& parent_id,
LLAssetType::EType preferred_type, LLAssetType::EType preferred_type,
const std::string& name); const std::string& name);
LLUUID findCategoryByName(std::string name); // Internal methods that add inventory and make sure that all of
// the internal data structures are consistent. These methods
// should be passed pointers of newly created objects, and the
// instance will take over the memory management from there.
void addCategory(LLViewerInventoryCategory* category);
void addItem(LLViewerInventoryItem* item);
// methods to load up inventory skeleton & meat. These are used // methods to load up inventory skeleton & meat. These are used
// during authentication. return true if everything parsed. // during authentication. return true if everything parsed.
@@ -339,19 +387,19 @@ public:
//... we do inventory queries on should be examined, and the usage of //... we do inventory queries on should be examined, and the usage of
//... the skeleton in querying the wearables needs to be examined as well. //... the skeleton in querying the wearables needs to be examined as well.
bool loadSkeleton(const options_t& options, const LLUUID& owner_id); bool loadSkeleton(const options_t& options, const LLUUID& owner_id);
bool loadSkeleton(const LLSD& options, const LLUUID& owner_id);
bool loadMeat(const options_t& options, const LLUUID& owner_id); bool loadMeat(const options_t& options, const LLUUID& owner_id);
// This is a brute force method to rebuild the entire parent-child /** Mutators
// relations. ** **
void buildParentChildMap(); *******************************************************************************/
// /********************************************************************************
// Category accounting. ** **
// ** CATEGORY ACCOUNTING
**/
// This structure represents the number of items added or removed public:
// from a category. // Represents the number of items added or removed from a category.
struct LLCategoryUpdate struct LLCategoryUpdate
{ {
LLCategoryUpdate() : mDescendentDelta(0) {} LLCategoryUpdate() : mDescendentDelta(0) {}
@@ -363,8 +411,7 @@ public:
}; };
typedef std::vector<LLCategoryUpdate> update_list_t; typedef std::vector<LLCategoryUpdate> update_list_t;
// This structure eixts to make it easier to account for deltas in // This exists to make it easier to account for deltas in a map.
// a map.
struct LLInitializedS32 struct LLInitializedS32
{ {
LLInitializedS32() : mValue(0) {} LLInitializedS32() : mValue(0) {}
@@ -375,21 +422,59 @@ public:
}; };
typedef std::map<LLUUID, LLInitializedS32> update_map_t; typedef std::map<LLUUID, LLInitializedS32> update_map_t;
// Call these methods when there are category updates, but call // Call when there are category updates. Call them *before* the
// them *before* the actual update so the method can do descendent // actual update so the method can do descendent accounting correctly.
// accounting correctly. void accountForUpdate(const LLCategoryUpdate& update) const;
void accountForUpdate(const LLCategoryUpdate& update);
void accountForUpdate(const update_list_t& updates); void accountForUpdate(const update_list_t& updates);
void accountForUpdate(const update_map_t& updates); void accountForUpdate(const update_map_t& updates);
// Return child status of category children. yes/no/maybe // Return (yes/no/maybe) child status of category children.
EHasChildren categoryHasChildren(const LLUUID& cat_id) const; EHasChildren categoryHasChildren(const LLUUID& cat_id) const;
// returns true iff category version is known and theoretical // Returns true iff category version is known and theoretical
// descendents == actual descendents. // descendents == actual descendents.
bool isCategoryComplete(const LLUUID& cat_id) const; bool isCategoryComplete(const LLUUID& cat_id) const;
/** Category Accounting
** **
*******************************************************************************/
// start and stop background breadth-first fetching of inventory contents /********************************************************************************
** **
** NOTIFICATIONS
**/
public:
// Call to explicitly update everyone on a new state. The optional argument
// 'service_name' is used by Agent Inventory Service [DEV-20328]
void notifyObservers(const std::string service_name="");
// Allows outsiders to tell the inventory if something has
// been changed 'under the hood', but outside the control of the
// inventory. The next notify will include that notification.
void addChangedMask(U32 mask, const LLUUID& referent);
const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
protected:
// Updates all linked items pointing to this id.
void addChangedMaskForLinks(const LLUUID& object_id, U32 mask);
private:
// Variables used to track what has changed since the last notify.
U32 mModifyMask;
changed_items_t mChangedItemIDs;
//--------------------------------------------------------------------
// Observers
//--------------------------------------------------------------------
public:
// If the observer is destroyed, be sure to remove it.
void addObserver(LLInventoryObserver* observer);
void removeObserver(LLInventoryObserver* observer);
BOOL containsObserver(LLInventoryObserver* observer) const;
private:
typedef std::set<LLInventoryObserver*> observer_list_t;
observer_list_t mObservers;
public:
// this gets triggered when performing a filter-search // this gets triggered when performing a filter-search
static void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null); // start fetch process static void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null); // start fetch process
static void findLostItems(); static void findLostItems();
@@ -404,20 +489,12 @@ protected:
// should be passed pointers of newly created objects, and the // should be passed pointers of newly created objects, and the
// instance will take over the memory management from there. // instance will take over the memory management from there.
// <edit> // <edit>
public:
// </edit>
void addCategory(LLViewerInventoryCategory* category);
void addItem(LLViewerInventoryItem* item);
// <edit>
//protected:
// </edit>
// Internal method which looks for a category with the specified // Internal method which looks for a category with the specified
// preferred type. Returns LLUUID::null if not found // preferred type. Returns LLUUID::null if not found
LLUUID findCatUUID(LLAssetType::EType preferred_type); LLUUID findCatUUID(LLAssetType::EType preferred_type);
// Empty the entire contents // Empty the entire contents
void empty();
// Given the current state of the inventory items, figure out the // Given the current state of the inventory items, figure out the
// clone information. *FIX: This is sub-optimal, since we can // clone information. *FIX: This is sub-optimal, since we can
@@ -427,8 +504,27 @@ public:
// file import/export. // file import/export.
// <edit> // <edit>
/** Notifications
** **
*******************************************************************************/
/********************************************************************************
** **
** MISCELLANEOUS
**/
//--------------------------------------------------------------------
// Callbacks
//--------------------------------------------------------------------
public: public:
// </edit> static void registerCallbacks(LLMessageSystem* msg);
//--------------------------------------------------------------------
// File I/O
//--------------------------------------------------------------------
protected:
friend class LLLocalInventory;
static bool loadFromFile(const std::string& filename, static bool loadFromFile(const std::string& filename,
cat_array_t& categories, cat_array_t& categories,
item_array_t& items, item_array_t& items,
@@ -436,65 +532,37 @@ public:
static bool saveToFile(const std::string& filename, static bool saveToFile(const std::string& filename,
const cat_array_t& categories, const cat_array_t& categories,
const item_array_t& items); const item_array_t& items);
// <edit>
protected:
// </edit>
// message handling functionality //--------------------------------------------------------------------
//static void processUseCachedInventory(LLMessageSystem* msg, void**); // Message handling functionality
//--------------------------------------------------------------------
public:
static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**); static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**);
static void processRemoveInventoryItem(LLMessageSystem* msg, void**); static void processRemoveInventoryItem(LLMessageSystem* msg, void**);
static void processUpdateInventoryFolder(LLMessageSystem* msg, void**); static void processUpdateInventoryFolder(LLMessageSystem* msg, void**);
static void processRemoveInventoryFolder(LLMessageSystem* msg, void**); static void processRemoveInventoryFolder(LLMessageSystem* msg, void**);
//static void processExchangeCallingcard(LLMessageSystem* msg, void**);
//static void processAddCallingcard(LLMessageSystem* msg, void**);
//static void processDeclineCallingcard(LLMessageSystem* msg, void**);
static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**); static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**);
static void processBulkUpdateInventory(LLMessageSystem* msg, void**); static void processBulkUpdateInventory(LLMessageSystem* msg, void**);
static void processInventoryDescendents(LLMessageSystem* msg, void**); static void processInventoryDescendents(LLMessageSystem* msg, void**);
static void processMoveInventoryItem(LLMessageSystem* msg, void**); static void processMoveInventoryItem(LLMessageSystem* msg, void**);
static void processFetchInventoryReply(LLMessageSystem* msg, void**); static void processFetchInventoryReply(LLMessageSystem* msg, void**);
protected:
bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting); bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting);
// Updates all linked items pointing to this id. //--------------------------------------------------------------------
void addChangedMaskForLinks(const LLUUID& object_id, U32 mask); // Locks
//--------------------------------------------------------------------
public:
void lockDirectDescendentArrays(const LLUUID& cat_id,
cat_array_t*& categories,
item_array_t*& items);
void unlockDirectDescendentArrays(const LLUUID& cat_id);
protected: protected:
cat_array_t* getUnlockedCatArray(const LLUUID& id); cat_array_t* getUnlockedCatArray(const LLUUID& id);
item_array_t* getUnlockedItemArray(const LLUUID& id); item_array_t* getUnlockedItemArray(const LLUUID& id);
private:
protected:
// Varaibles used to track what has changed since the last notify.
U32 mModifyMask;
typedef std::set<LLUUID> changed_items_t;
changed_items_t mChangedItemIDs;
// Information for tracking the actual inventory. We index this
// information in a lot of different ways so we can access
// the inventory using several different identifiers.
// mInventory member data is the 'master' list of inventory, and
// mCategoryMap and mItemMap store uuid->object mappings.
typedef std::map<LLUUID, LLPointer<LLViewerInventoryCategory> > cat_map_t;
typedef std::map<LLUUID, LLPointer<LLViewerInventoryItem> > item_map_t;
//inv_map_t mInventory;
cat_map_t mCategoryMap;
item_map_t mItemMap;
std::map<LLUUID, bool> mCategoryLock; std::map<LLUUID, bool> mCategoryLock;
std::map<LLUUID, bool> mItemLock; std::map<LLUUID, bool> mItemLock;
// cache recent lookups
mutable LLPointer<LLViewerInventoryItem> mLastItem;
// This last set of indices is used to map parents to children.
typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
parent_cat_map_t mParentChildCategoryTree;
parent_item_map_t mParentChildItemTree;
typedef std::set<LLInventoryObserver*> observer_list_t;
observer_list_t mObservers;
// completing the fetch once per session should be sufficient // completing the fetch once per session should be sufficient
static BOOL sBackgroundFetchActive; static BOOL sBackgroundFetchActive;
@@ -505,20 +573,19 @@ protected:
static F32 sMaxTimeBetweenFetches; static F32 sMaxTimeBetweenFetches;
static S16 sBulkFetchCount; static S16 sBulkFetchCount;
// This flag is used to handle an invalid inventory state.
bool mIsAgentInvUsable;
private:
const static S32 sCurrentInvCacheVersion; // expected inventory cache version
public: public:
// *NOTE: DEBUG functionality // *NOTE: DEBUG functionality
void dumpInventory(); void dumpInventory() const;
static bool isBulkFetchProcessingComplete(); static bool isBulkFetchProcessingComplete();
static void stopBackgroundFetch(); // stop fetch process static void stopBackgroundFetch(); // stop fetch process
static BOOL sFullFetchStarted; static BOOL sFullFetchStarted;
static BOOL sAllFoldersFetched; static BOOL sAllFoldersFetched;
/** Miscellaneous
** **
*******************************************************************************/
}; };
// a special inventory model for the agent // a special inventory model for the agent

View File

@@ -1474,7 +1474,7 @@ std::string get_item_icon_name(LLAssetType::EType asset_type,
{ {
idx = BODYPART_ICON_NAME; idx = BODYPART_ICON_NAME;
} }
switch(LLInventoryItem::II_FLAGS_WEARABLES_MASK & attachment_point) switch(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & attachment_point)
{ {
case WT_SHAPE: case WT_SHAPE:
idx = BODYPART_SHAPE_ICON_NAME; idx = BODYPART_SHAPE_ICON_NAME;

View File

@@ -212,7 +212,7 @@ void LLPanelContents::onClickNewScript(void *userdata)
std::string("New Script"), std::string("New Script"),
desc, desc,
LLSaleInfo::DEFAULT, LLSaleInfo::DEFAULT,
LLViewerInventoryItem::II_FLAGS_NONE, LLInventoryItemFlags::II_FLAGS_NONE,
time_corrected()); time_corrected());
object->saveScript(new_item, TRUE, true); object->saveScript(new_item, TRUE, true);

View File

@@ -305,7 +305,7 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
mInventoryItem = inv_item; mInventoryItem = inv_item;
BOOL item_is_multi = FALSE; BOOL item_is_multi = FALSE;
if ( inv_item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
{ {
item_is_multi = TRUE; item_is_multi = TRUE;
}; };

View File

@@ -353,7 +353,7 @@ time_t LLTaskInvFVBridge::getCreationDate() const
LLUIImagePtr LLTaskInvFVBridge::getIcon() const LLUIImagePtr LLTaskInvFVBridge::getIcon() const
{ {
BOOL item_is_multi = FALSE; BOOL item_is_multi = FALSE;
if ( mFlags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
{ {
item_is_multi = TRUE; item_is_multi = TRUE;
} }
@@ -1372,7 +1372,7 @@ LLTaskObjectBridge::LLTaskObjectBridge(
LLUIImagePtr LLTaskObjectBridge::getIcon() const LLUIImagePtr LLTaskObjectBridge::getIcon() const
{ {
BOOL item_is_multi = FALSE; BOOL item_is_multi = FALSE;
if ( mFlags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
{ {
item_is_multi = TRUE; item_is_multi = TRUE;
} }
@@ -1787,7 +1787,7 @@ void LLPanelInventory::reset()
} }
void LLPanelInventory::inventoryChanged(LLViewerObject* object, void LLPanelInventory::inventoryChanged(LLViewerObject* object,
InventoryObjectList* inventory, LLInventoryObject::object_list_t* inventory,
S32 serial_num, S32 serial_num,
void* data) void* data)
{ {
@@ -1810,8 +1810,8 @@ void LLPanelInventory::inventoryChanged(LLViewerObject* object,
LLFloaterProperties* floater = NULL; LLFloaterProperties* floater = NULL;
LLDynamicArray<LLFloaterProperties*> refresh; LLDynamicArray<LLFloaterProperties*> refresh;
InventoryObjectList::const_iterator it = inventory->begin(); LLInventoryObject::object_list_t::const_iterator it = inventory->begin();
InventoryObjectList::const_iterator end = inventory->end(); LLInventoryObject::object_list_t::const_iterator end = inventory->end();
for( ; it != end; ++it) for( ; it != end; ++it)
{ {
floater = LLFloaterProperties::find((*it)->getUUID(), floater = LLFloaterProperties::find((*it)->getUUID(),
@@ -1927,7 +1927,7 @@ void LLPanelInventory::createFolderViews(LLInventoryObject* inventory_root, Inve
typedef std::pair<LLInventoryObject*, LLFolderViewFolder*> obj_folder_pair; typedef std::pair<LLInventoryObject*, LLFolderViewFolder*> obj_folder_pair;
void LLPanelInventory::createViewsForCategory(InventoryObjectList* inventory, void LLPanelInventory::createViewsForCategory(LLInventoryObject::object_list_t* inventory,
LLInventoryObject* parent, LLInventoryObject* parent,
LLFolderViewFolder* folder) LLFolderViewFolder* folder)
{ {

View File

@@ -78,12 +78,12 @@ protected:
protected: protected:
void reset(); void reset();
/*virtual*/ void inventoryChanged(LLViewerObject* object, /*virtual*/ void inventoryChanged(LLViewerObject* object,
InventoryObjectList* inventory, LLInventoryObject::object_list_t* inventory,
S32 serial_num, S32 serial_num,
void* user_data); void* user_data);
void updateInventory(); void updateInventory();
void createFolderViews(LLInventoryObject* inventory_root, InventoryObjectList& contents); void createFolderViews(LLInventoryObject* inventory_root, InventoryObjectList& contents);
void createViewsForCategory(InventoryObjectList* inventory, void createViewsForCategory(LLInventoryObject::object_list_t* inventory,
LLInventoryObject* parent, LLInventoryObject* parent,
LLFolderViewFolder* folder); LLFolderViewFolder* folder);

View File

@@ -1686,38 +1686,38 @@ void LLPreviewLSL::reshape(S32 width, S32 height, BOOL called_from_parent)
gSavedSettings.setRect("PreviewScriptRect", getRect()); gSavedSettings.setRect("PreviewScriptRect", getRect());
} }
} }
// <edit> // <edit>
// virtual // virtual
BOOL LLPreviewLSL::canSaveAs() const BOOL LLPreviewLSL::canSaveAs() const
{ {
return TRUE; return TRUE;
} }
// virtual // virtual
void LLPreviewLSL::saveAs() void LLPreviewLSL::saveAs()
{ {
std::string default_filename("untitled.lsl"); std::string default_filename("untitled.lsl");
const LLInventoryItem *item = getItem(); const LLInventoryItem *item = getItem();
if(item) if(item)
{ {
default_filename = LLDir::getScrubbedFileName(item->getName()); default_filename = LLDir::getScrubbedFileName(item->getName());
} }
LLFilePicker& file_picker = LLFilePicker::instance(); LLFilePicker& file_picker = LLFilePicker::instance();
if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_LSL, default_filename ) ) if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_LSL, default_filename ) )
{ {
// User canceled or we failed to acquire save file. // User canceled or we failed to acquire save file.
return; return;
} }
// remember the user-approved/edited file name. // remember the user-approved/edited file name.
std::string filename = file_picker.getFirstFile(); std::string filename = file_picker.getFirstFile();
std::string utf8text = mScriptEd->mEditor->getText(); std::string utf8text = mScriptEd->mEditor->getText();
LLFILE* fp = LLFile::fopen(filename, "wb"); LLFILE* fp = LLFile::fopen(filename, "wb");
fputs(utf8text.c_str(), fp); fputs(utf8text.c_str(), fp);
fclose(fp); fclose(fp);
fp = NULL; fp = NULL;
} }
// </edit> // </edit>
/// --------------------------------------------------------------------------- /// ---------------------------------------------------------------------------
/// LLLiveLSLEditor /// LLLiveLSLEditor
@@ -1962,7 +1962,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
DEFAULT_SCRIPT_NAME, DEFAULT_SCRIPT_NAME,
DEFAULT_SCRIPT_DESC, DEFAULT_SCRIPT_DESC,
LLSaleInfo::DEFAULT, LLSaleInfo::DEFAULT,
LLInventoryItem::II_FLAGS_NONE, LLInventoryItemFlags::II_FLAGS_NONE,
time_corrected()); time_corrected());
mAssetStatus = PREVIEW_ASSET_LOADED; mAssetStatus = PREVIEW_ASSET_LOADED;
} }
@@ -2637,36 +2637,36 @@ BOOL LLLiveLSLEditor::monoChecked() const
return FALSE; return FALSE;
} }
// <edit> // <edit>
// virtual // virtual
BOOL LLLiveLSLEditor::canSaveAs() const BOOL LLLiveLSLEditor::canSaveAs() const
{ {
return TRUE; return TRUE;
} }
// virtual // virtual
void LLLiveLSLEditor::saveAs() void LLLiveLSLEditor::saveAs()
{ {
std::string default_filename("untitled.lsl"); std::string default_filename("untitled.lsl");
const LLInventoryItem *item = getItem(); const LLInventoryItem *item = getItem();
if(item) if(item)
{ {
default_filename = LLDir::getScrubbedFileName(item->getName()); default_filename = LLDir::getScrubbedFileName(item->getName());
} }
LLFilePicker& file_picker = LLFilePicker::instance(); LLFilePicker& file_picker = LLFilePicker::instance();
if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_LSL, default_filename ) ) if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_LSL, default_filename ) )
{ {
// User canceled or we failed to acquire save file. // User canceled or we failed to acquire save file.
return; return;
} }
// remember the user-approved/edited file name. // remember the user-approved/edited file name.
std::string filename = file_picker.getFirstFile(); std::string filename = file_picker.getFirstFile();
std::string utf8text = mScriptEd->mEditor->getText(); std::string utf8text = mScriptEd->mEditor->getText();
LLFILE* fp = LLFile::fopen(filename, "wb"); LLFILE* fp = LLFile::fopen(filename, "wb");
fputs(utf8text.c_str(), fp); fputs(utf8text.c_str(), fp);
fclose(fp); fclose(fp);
fp = NULL; fp = NULL;
} }
// </edit> // </edit>

View File

@@ -752,10 +752,10 @@ void LLTracker::setLandmarkVisited()
LLInventoryItem* i = gInventory.getItem( mTrackedLandmarkItemID ); LLInventoryItem* i = gInventory.getItem( mTrackedLandmarkItemID );
LLViewerInventoryItem* item = (LLViewerInventoryItem*)i; LLViewerInventoryItem* item = (LLViewerInventoryItem*)i;
if ( item if ( item
&& !(item->getFlags()&LLInventoryItem::II_FLAGS_LANDMARK_VISITED)) && !(item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED))
{ {
U32 flags = item->getFlags(); U32 flags = item->getFlags();
flags |= LLInventoryItem::II_FLAGS_LANDMARK_VISITED; flags |= LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED;
item->setFlags(flags); item->setFlags(flags);
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessage("ChangeInventoryItemFlags"); msg->newMessage("ChangeInventoryItemFlags");
@@ -808,7 +808,7 @@ void LLTracker::cacheLandmarkPosition()
mLandmarkHasBeenVisited = FALSE; mLandmarkHasBeenVisited = FALSE;
LLInventoryItem* item = gInventory.getItem(mTrackedLandmarkItemID); LLInventoryItem* item = gInventory.getItem(mTrackedLandmarkItemID);
if ( item if ( item
&& item->getFlags()&LLInventoryItem::II_FLAGS_LANDMARK_VISITED) && item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
{ {
mLandmarkHasBeenVisited = TRUE; mLandmarkHasBeenVisited = TRUE;
} }

View File

@@ -324,8 +324,8 @@ bool LLViewerInventoryItem::exportFileLocal(LLFILE* fp) const
fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str());
mPermissions.exportFile(fp); mPermissions.exportFile(fp);
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
const char* inv_type_str = LLInventoryType::lookup(mInventoryType); const std::string& inv_type_str = LLInventoryType::lookup(mInventoryType);
if(inv_type_str) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str); if(!inv_type_str.empty()) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str.c_str());
fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
fprintf(fp, "\t\tcreation_date\t%d\n", (S32) mCreationDate); fprintf(fp, "\t\tcreation_date\t%d\n", (S32) mCreationDate);
fprintf(fp,"\t}\n"); fprintf(fp,"\t}\n");
@@ -372,7 +372,7 @@ EWearableType LLViewerInventoryItem::getWearableType() const
{ {
return WT_INVALID; return WT_INVALID;
} }
return EWearableType(getFlags() & II_FLAGS_WEARABLES_MASK); return EWearableType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
} }
// [/RLVa:KB] // [/RLVa:KB]

View File

@@ -8467,7 +8467,7 @@ void handle_grab_texture(void* data)
name, name,
LLStringUtil::null, LLStringUtil::null,
LLSaleInfo::DEFAULT, LLSaleInfo::DEFAULT,
LLInventoryItem::II_FLAGS_NONE, LLInventoryItemFlags::II_FLAGS_NONE,
creation_date_now); creation_date_now);
item->updateServer(TRUE); item->updateServer(TRUE);

View File

@@ -232,6 +232,75 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] =
FALSE // ControlYourCamera FALSE // ControlYourCamera
}; };
template <typename T>
class SH_SpamHandler
{
public:
SH_SpamHandler(const char *pToggleCtrl, const char *pDurCtrl, const char *pFreqCtrl) :
mDuration(pDurCtrl, 1.f),
mFrequency(pFreqCtrl, 5),
mEnabled(false)
{
gSavedSettings.getControl(pToggleCtrl)->getSignal()->connect(boost::bind(&SH_SpamHandler::CtrlToggle, this, _1));
CtrlToggle(gSavedSettings.getBOOL(pToggleCtrl));
}
bool CtrlToggle(const LLSD& newvalue)
{
bool on = newvalue.asBoolean();
if(on == mEnabled)
return true;
mEnabled = on;
mTimer.stop();
mActiveList.clear();
mBlockedList.clear();
return true;
}
bool isBlocked(const T &owner, const LLUUID &source_id, const char *pNotification, LLSD &args=LLSD())
{
if(!mEnabled || isAgent(owner))
return false;
if(mBlockedList.find(owner) != mBlockedList.end())
return true;
if(mTimer.getStarted() && mTimer.getElapsedTimeF32() < mDuration)
{
std::map<const T,U32>::iterator it = mActiveList.insert(std::pair<const T, U32>(owner,0)).first;
if(++(it->second)>=mFrequency)
{
mBlockedList.insert(owner);
if(pNotification)
{
args["OWNER"] = owner;
args["SOURCE"] = source_id;
LLNotifications::getInstance()->add(pNotification,args);
}
return true;
}
}
else
{
mActiveList.clear();
mTimer.start();
}
return false;
}
private:
//Owner is either a key, or a name. Do not look up perms since object may be unknown.
bool isAgent(const T &owner) const;
bool mEnabled;
LLFrameTimer mTimer;
const LLCachedControl<F32> mDuration;
const LLCachedControl<U32> mFrequency;
std::map<const T,U32> mActiveList;
std::set<const T> mBlockedList;
};
template<> bool SH_SpamHandler<LLUUID>::isAgent(const LLUUID &owner) const { return gAgent.getID() == owner; }
template<> bool SH_SpamHandler<std::string>::isAgent(const std::string &owner) const
{
std::string str;
gAgent.getName(str);
return str == owner;
}
bool friendship_offer_callback(const LLSD& notification, const LLSD& response) bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
{ {
S32 option = LLNotification::getSelectedOption(notification, response); S32 option = LLNotification::getSelectedOption(notification, response);
@@ -1631,6 +1700,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
chat.mFromID = from_id; chat.mFromID = from_id;
chat.mFromName = name; chat.mFromName = name;
chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT;
if(chat.mSourceType == CHAT_SOURCE_AGENT)
{
LLSD args;
args["FULL_NAME"] = name;
static SH_SpamHandler<LLUUID> avatar_spam_check("SGBlockGeneralSpam","SGSpamTime","SGSpamCount");
static SH_SpamHandler<LLUUID> object_spam_check("SGBlockGeneralSpam","SGSpamTime","SGSpamCount");
if(d==IM_FROM_TASK||d==IM_GOTO_URL||d==IM_FROM_TASK_AS_ALERT||d==IM_TASK_INVENTORY_OFFERED||d==IM_TASK_INVENTORY_ACCEPTED||d==IM_TASK_INVENTORY_DECLINED)
{
if(object_spam_check.isBlocked(from_id,session_id,"BlockedGeneralObjects"),args)
return;
}
else if(avatar_spam_check.isBlocked(from_id,from_id,"BlockedGeneralAvatar"),args)
return;
}
LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing.
if (source) if (source)
@@ -2812,6 +2896,9 @@ void process_offer_callingcard(LLMessageSystem* msg, void**)
} }
else else
{ {
static SH_SpamHandler<LLUUID> spam_check("SGBlockCardSpam","SHSpamTime","SGSpamCount");
if(spam_check.isBlocked(source_id,source_id,"BlockedCards",args))
return;
LLNotifications::instance().add("OfferCallingCard", args, payload); LLNotifications::instance().add("OfferCallingCard", args, payload);
} }
} }
@@ -2985,6 +3072,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
// </edit> // </edit>
if (chatter) if (chatter)
{ {
LLSD args;
args["FULL_NAME"] = from_name;
static SH_SpamHandler<LLUUID> avatar_spam_check("SGBlockChatSpam","SGChatSpamTime","SGChatSpamCount");
static SH_SpamHandler<LLUUID> object_spam_check("SGBlockChatSpam","SGChatSpamTime","SGChatSpamCount");
if( (chatter->isAvatar() && avatar_spam_check.isBlocked(from_id,from_id,"BlockedChatterAvatar",args)) ||
(!chatter->isAvatar() && object_spam_check.isBlocked(owner_id,from_id,"BlockedChatterObjects",args)) )
return;
chat.mPosAgent = chatter->getPositionAgent(); chat.mPosAgent = chatter->getPositionAgent();
// Make swirly things only for talking objects. (not script debug messages, though) // Make swirly things only for talking objects. (not script debug messages, though)
@@ -5835,7 +5930,7 @@ void process_derez_container(LLMessageSystem *msg, void**)
} }
void container_inventory_arrived(LLViewerObject* object, void container_inventory_arrived(LLViewerObject* object,
InventoryObjectList* inventory, LLInventoryObject::object_list_t* inventory,
S32 serial_num, S32 serial_num,
void* data) void* data)
{ {
@@ -5855,8 +5950,8 @@ void container_inventory_arrived(LLViewerObject* object,
LLAssetType::AT_NONE, LLAssetType::AT_NONE,
std::string("Acquired Items")); //TODO: Translate std::string("Acquired Items")); //TODO: Translate
InventoryObjectList::const_iterator it = inventory->begin(); LLInventoryObject::object_list_t::const_iterator it = inventory->begin();
InventoryObjectList::const_iterator end = inventory->end(); LLInventoryObject::object_list_t::const_iterator end = inventory->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if ((*it)->getType() != LLAssetType::AT_CATEGORY && if ((*it)->getType() != LLAssetType::AT_CATEGORY &&
@@ -6366,17 +6461,22 @@ static LLNotificationFunctorRegistration callback_script_dialog_reg_2("ScriptDia
void process_script_dialog(LLMessageSystem* msg, void**) void process_script_dialog(LLMessageSystem* msg, void**)
{ {
S32 i; S32 i;
LLSD payload; LLSD payload;
LLUUID object_id;
msg->getUUID("Data", "ObjectID", object_id);
if (LLMuteList::getInstance()->isMuted(object_id))
{
return;
}
std::string message; std::string message;
std::string first_name; std::string first_name;
std::string last_name; std::string last_name;
std::string title; std::string title;
LLUUID object_id;
S32 chat_channel; S32 chat_channel;
msg->getUUID("Data", "ObjectID", object_id);
msg->getString("Data", "FirstName", first_name); msg->getString("Data", "FirstName", first_name);
msg->getString("Data", "LastName", last_name); msg->getString("Data", "LastName", last_name);
msg->getString("Data", "ObjectName", title); msg->getString("Data", "ObjectName", title);
@@ -6437,6 +6537,10 @@ void process_script_dialog(LLMessageSystem* msg, void**)
args["FIRST"] = first_name; args["FIRST"] = first_name;
args["LAST"] = last_name; args["LAST"] = last_name;
static SH_SpamHandler<std::string> spam_check("SGBlockDialogSpam","SGSpamTime","SGSpamCount");
if(spam_check.isBlocked(first_name + " " + last_name,object_id,"BlockedDialogs",args))
return;
if (is_text_box) if (is_text_box)
{ {
args["DEFAULT"] = default_text; args["DEFAULT"] = default_text;
@@ -6601,6 +6705,8 @@ void process_initiate_download(LLMessageSystem* msg, void**)
void process_script_teleport_request(LLMessageSystem* msg, void**) void process_script_teleport_request(LLMessageSystem* msg, void**)
{ {
if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return;
std::string object_name; std::string object_name;
std::string sim_name; std::string sim_name;
LLVector3 pos; LLVector3 pos;

View File

@@ -2221,8 +2221,8 @@ void LLViewerObject::deleteInventoryItem(const LLUUID& item_id)
{ {
if(mInventory) if(mInventory)
{ {
InventoryObjectList::iterator it = mInventory->begin(); LLInventoryObject::object_list_t::iterator it = mInventory->begin();
InventoryObjectList::iterator end = mInventory->end(); LLInventoryObject::object_list_t::iterator end = mInventory->end();
for( ; it != end; ++it ) for( ; it != end; ++it )
{ {
if((*it)->getUUID() == item_id) if((*it)->getUUID() == item_id)
@@ -2532,7 +2532,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data)
} }
else else
{ {
object->mInventory = new InventoryObjectList(); object->mInventory = new LLInventoryObject::object_list_t();
} }
LLPointer<LLInventoryObject> obj; LLPointer<LLInventoryObject> obj;
obj = new LLInventoryObject(object->mID, LLUUID::null, obj = new LLInventoryObject(object->mID, LLUUID::null,
@@ -2588,7 +2588,7 @@ void LLViewerObject::loadTaskInvFile(const std::string& filename)
} }
else else
{ {
mInventory = new InventoryObjectList; mInventory = new LLInventoryObject::object_list_t;
} }
while(ifs.good()) while(ifs.good())
{ {
@@ -2725,8 +2725,8 @@ LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
LLInventoryObject* rv = NULL; LLInventoryObject* rv = NULL;
if(mInventory) if(mInventory)
{ {
InventoryObjectList::iterator it = mInventory->begin(); LLInventoryObject::object_list_t::iterator it = mInventory->begin();
InventoryObjectList::iterator end = mInventory->end(); LLInventoryObject::object_list_t::iterator end = mInventory->end();
for ( ; it != end; ++it) for ( ; it != end; ++it)
{ {
if((*it)->getUUID() == item_id) if((*it)->getUUID() == item_id)
@@ -2739,12 +2739,12 @@ LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
return rv; return rv;
} }
void LLViewerObject::getInventoryContents(InventoryObjectList& objects) void LLViewerObject::getInventoryContents(LLInventoryObject::object_list_t& objects)
{ {
if(mInventory) if(mInventory)
{ {
InventoryObjectList::iterator it = mInventory->begin(); LLInventoryObject::object_list_t::iterator it = mInventory->begin();
InventoryObjectList::iterator end = mInventory->end(); LLInventoryObject::object_list_t::iterator end = mInventory->end();
for( ; it != end; ++it) for( ; it != end; ++it)
{ {
if ((*it)->getType() != LLAssetType::AT_CATEGORY) if ((*it)->getType() != LLAssetType::AT_CATEGORY)
@@ -2774,8 +2774,8 @@ LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& ass
{ {
LLViewerInventoryItem* item = NULL; LLViewerInventoryItem* item = NULL;
InventoryObjectList::iterator it = mInventory->begin(); LLInventoryObject::object_list_t::iterator it = mInventory->begin();
InventoryObjectList::iterator end = mInventory->end(); LLInventoryObject::object_list_t::iterator end = mInventory->end();
for( ; it != end; ++it) for( ; it != end; ++it)
{ {
LLInventoryObject* obj = *it; LLInventoryObject* obj = *it;
@@ -4138,8 +4138,8 @@ S32 LLViewerObject::countInventoryContents(LLAssetType::EType type)
S32 count = 0; S32 count = 0;
if( mInventory ) if( mInventory )
{ {
InventoryObjectList::const_iterator it = mInventory->begin(); LLInventoryObject::object_list_t::const_iterator it = mInventory->begin();
InventoryObjectList::const_iterator end = mInventory->end(); LLInventoryObject::object_list_t::const_iterator end = mInventory->end();
for( ; it != end ; ++it ) for( ; it != end ; ++it )
{ {
if( (*it)->getType() == type ) if( (*it)->getType() == type )

View File

@@ -86,7 +86,7 @@ typedef enum e_object_update_type
// callback typedef for inventory // callback typedef for inventory
typedef void (*inventory_callback)(LLViewerObject*, typedef void (*inventory_callback)(LLViewerObject*,
InventoryObjectList*, LLInventoryObject::object_list_t*,
S32 serial_num, S32 serial_num,
void*); void*);
@@ -622,7 +622,7 @@ protected:
F32 mPixelArea; // Apparent area in pixels F32 mPixelArea; // Apparent area in pixels
// This is the object's inventory from the viewer's perspective. // This is the object's inventory from the viewer's perspective.
InventoryObjectList* mInventory; LLInventoryObject::object_list_t* mInventory;
class LLInventoryCallbackInfo class LLInventoryCallbackInfo
{ {
public: public:

View File

@@ -147,7 +147,7 @@ public:
mPostData["name"].asString(), mPostData["name"].asString(),
mPostData["description"].asString(), mPostData["description"].asString(),
LLSaleInfo::DEFAULT, LLSaleInfo::DEFAULT,
LLInventoryItem::II_FLAGS_NONE, LLInventoryItemFlags::II_FLAGS_NONE,
creation_date_now); creation_date_now);
gInventory.updateItem(item); gInventory.updateItem(item);
gInventory.notifyObservers(); gInventory.notifyObservers();

View File

@@ -417,7 +417,7 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const
break; break;
case LLAssetType::AT_SOUND: img_name = "inv_item_sound.tga"; break; case LLAssetType::AT_SOUND: img_name = "inv_item_sound.tga"; break;
case LLAssetType::AT_LANDMARK: case LLAssetType::AT_LANDMARK:
if (item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED) if (item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
{ {
img_name = "inv_item_landmark_visited.tga"; img_name = "inv_item_landmark_visited.tga";
} }
@@ -428,7 +428,7 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const
break; break;
case LLAssetType::AT_CLOTHING: img_name = "inv_item_clothing.tga"; break; case LLAssetType::AT_CLOTHING: img_name = "inv_item_clothing.tga"; break;
case LLAssetType::AT_OBJECT: case LLAssetType::AT_OBJECT:
if (item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) if (item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
{ {
img_name = "inv_item_object_multi.tga"; img_name = "inv_item_object_multi.tga";
} }

View File

@@ -42,7 +42,7 @@ class LLVOInventoryListener
{ {
public: public:
virtual void inventoryChanged(LLViewerObject* object, virtual void inventoryChanged(LLViewerObject* object,
InventoryObjectList* inventory, LLInventoryObject::object_list_t* inventory,
S32 serial_num, S32 serial_num,
void* user_data) = 0; void* user_data) = 0;

View File

@@ -835,7 +835,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
case LLAssetType::AT_CLOTHING: case LLAssetType::AT_CLOTHING:
{ {
// NOTE: without its asset we don't know what type the wearable is so we need to look at the item's flags instead // NOTE: without its asset we don't know what type the wearable is so we need to look at the item's flags instead
EWearableType wtType = (EWearableType)(pItem->getFlags() & LLInventoryItem::II_FLAGS_WEARABLES_MASK); EWearableType wtType = (EWearableType)(pItem->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
LLViewerInventoryCategory* pFolder; LLViewerInventoryCategory* pFolder;
if ( (!isWearable(wtType)) || if ( (!isWearable(wtType)) ||
( (gAgent.getWearable(wtType)) && (!isRemovable(wtType)) ) || ( (gAgent.getWearable(wtType)) && (!isRemovable(wtType)) ) ||

View File

@@ -357,7 +357,7 @@ void ScriptCounter::completechk()
} }
void ScriptCounter::inventoryChanged(LLViewerObject* obj, void ScriptCounter::inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* user_data) void* user_data)
{ {
@@ -371,8 +371,8 @@ void ScriptCounter::inventoryChanged(LLViewerObject* obj,
{ {
if(inv) if(inv)
{ {
InventoryObjectList::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator it = inv->begin();
InventoryObjectList::const_iterator end = inv->end(); LLInventoryObject::object_list_t::const_iterator end = inv->end();
for( ; it != end; ++it) for( ; it != end; ++it)
{ {
LLInventoryObject* asset = (*it); LLInventoryObject* asset = (*it);

View File

@@ -48,7 +48,7 @@ public:
static void processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data); static void processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data);
static void processObjectProperties(LLMessageSystem* msg, void** user_data); static void processObjectProperties(LLMessageSystem* msg, void** user_data);
void inventoryChanged(LLViewerObject* obj, void inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv, LLInventoryObject::object_list_t* inv,
S32 serial_num, S32 serial_num,
void* data); void* data);

View File

@@ -653,7 +653,7 @@ Only large parcels can be listed in search.
Adult Adult
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Arts and Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -671,7 +671,7 @@ Only large parcels can be listed in search.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -682,6 +682,9 @@ Only large parcels can be listed in search.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<!-- The following combo box is identical to the previous one, except for the <!-- The following combo box is identical to the previous one, except for the
fact that the Adult item is missing. This seems to be the only way to safely fact that the Adult item is missing. This seems to be the only way to safely
@@ -697,7 +700,7 @@ Only large parcels can be listed in search.
Linden Location Linden Location
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Arts and Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -715,7 +718,7 @@ Only large parcels can be listed in search.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -726,6 +729,9 @@ Only large parcels can be listed in search.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<button bottom="-140" enabled="true" follows="left|top" font="SansSerif" <button bottom="-140" enabled="true" follows="left|top" font="SansSerif"
halign="center" height="18" label="?" label_selected="?" left="400" halign="center" height="18" label="?" label_selected="?" left="400"

View File

@@ -477,7 +477,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Linden Location Linden Location
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Arts and Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -495,7 +495,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -506,6 +506,9 @@ To buy direct, visit the land and click on the place name in the title bar.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<!-- This is used only during the AO transition and can be deleted once the AO transition is <!-- This is used only during the AO transition and can be deleted once the AO transition is
complete. It is identical to the combo box above except that it has the Adult category. complete. It is identical to the combo box above except that it has the Adult category.
@@ -522,7 +525,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Adult Adult
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Arts and Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -540,7 +543,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -551,6 +554,9 @@ To buy direct, visit the land and click on the place name in the title bar.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<button bottom="-48" follows="right|top" font="SansSerif" halign="center" height="20" <button bottom="-48" follows="right|top" font="SansSerif" halign="center" height="20"
label="Search" label_selected="Search" left="121" mouse_opaque="true" label="Search" label_selected="Search" left="121" mouse_opaque="true"

View File

@@ -419,7 +419,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Official Location Official Location
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Artsand Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -437,7 +437,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -448,6 +448,9 @@ To buy direct, visit the land and click on the place name in the title bar.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<!-- This is used only during the AO transition and can be deleted once the AO transition is <!-- This is used only during the AO transition and can be deleted once the AO transition is
complete. It is identical to the combo box above except that it has the Adult category. complete. It is identical to the combo box above except that it has the Adult category.
@@ -464,7 +467,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Adult Adult
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Arts and Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -482,7 +485,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -493,6 +496,9 @@ To buy direct, visit the land and click on the place name in the title bar.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<button bottom="-48" follows="right|top" font="SansSerif" halign="center" height="20" <button bottom="-48" follows="right|top" font="SansSerif" halign="center" height="20"
label="Search" label_selected="Search" left="121" mouse_opaque="true" label="Search" label_selected="Search" left="121" mouse_opaque="true"

View File

@@ -535,7 +535,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Official Location Official Location
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Arts and Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -553,7 +553,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -564,6 +564,9 @@ To buy direct, visit the land and click on the place name in the title bar.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<!-- This is used only during the AO transition and can be deleted once the AO transition is <!-- This is used only during the AO transition and can be deleted once the AO transition is
complete. It is identical to the combo box above except that it has the Adult category. complete. It is identical to the combo box above except that it has the Adult category.
@@ -580,7 +583,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Adult Adult
</combo_item> </combo_item>
<combo_item name="Arts&amp;Culture" value="arts"> <combo_item name="Arts&amp;Culture" value="arts">
Arts &amp; Culture Arts and Culture
</combo_item> </combo_item>
<combo_item name="Business" value="store"> <combo_item name="Business" value="store">
Business Business
@@ -598,7 +601,7 @@ To buy direct, visit the land and click on the place name in the title bar.
Newcomer Friendly Newcomer Friendly
</combo_item> </combo_item>
<combo_item name="Parks&amp;Nature" value="park"> <combo_item name="Parks&amp;Nature" value="park">
Parks &amp; Nature Parks and Nature
</combo_item> </combo_item>
<combo_item name="Residential" value="home"> <combo_item name="Residential" value="home">
Residential Residential
@@ -609,6 +612,9 @@ To buy direct, visit the land and click on the place name in the title bar.
<combo_item name="Other" value="other"> <combo_item name="Other" value="other">
Other Other
</combo_item> </combo_item>
<combo_item name="Rental" value="rental">
Rental
</combo_item>
</combo_box> </combo_box>
<button bottom="-48" follows="right|top" font="SansSerif" halign="center" height="20" <button bottom="-48" follows="right|top" font="SansSerif" halign="center" height="20"
label="Search" label_selected="Search" left="121" mouse_opaque="true" label="Search" label_selected="Search" left="121" mouse_opaque="true"

View File

@@ -6933,6 +6933,12 @@ No
For instructions, make a new template in the AO. Use the toolbar to toggle the AO on/off. For instructions, make a new template in the AO. Use the toolbar to toggle the AO on/off.
</notification> </notification>
<notification icon="notifytip.tga" name="BlockedCards" type="notifytip">Blocked calling cards from [FIRST] [LAST] ([SOURCE])</notification>
<notification icon="notifytip.tga" name="BlockedDialogs" type="notifytip">Blocking all dialogs from [FIRST] [LAST]'s objects. (Origin: [SOURCE])</notification>
<notification icon="notifytip.tga" name="BlockedGeneralAvatar" type="notifytip">Blocked spam from avatar [FULL_NAME] ([SOURCE])</notification>
<notification icon="notifytip.tga" name="BlockedGeneralObjects" type="notifytip">Blocked spam from objects owned by [OWNER] ([SOURCE])</notification>
<notification icon="notifytip.tga" name="BlockedChatterAvatar" type="notifytip">Blocked chat-spam from avatar [FULL_NAME] ([SOURCE])</notification>
<notification icon="notifytip.tga" name="BlockedChatterObjects" type="notifytip">Blocked chat-spam from objects owned by [OWNER] ([SOURCE])</notification>
</notifications> </notifications>