Missing utility functions added to LLViewerInventoryItem, and cleaned up a few things.
This commit is contained in:
@@ -362,22 +362,6 @@ void LLViewerInventoryItem::updateParentOnServer(BOOL restamp) const
|
|||||||
// return mClones;
|
// return mClones;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3a) | Added: RLVa-1.1.3a
|
|
||||||
bool LLViewerInventoryItem::isWearableType() const
|
|
||||||
{
|
|
||||||
return (getInventoryType() == LLInventoryType::IT_WEARABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLWearableType::EType LLViewerInventoryItem::getWearableType() const
|
|
||||||
{
|
|
||||||
if (!isWearableType())
|
|
||||||
{
|
|
||||||
return LLWearableType::WT_INVALID;
|
|
||||||
}
|
|
||||||
return LLWearableType::EType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
|
|
||||||
}
|
|
||||||
// [/RLVa:KB]
|
|
||||||
|
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
/// Class LLViewerInventoryCategory
|
/// Class LLViewerInventoryCategory
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
@@ -443,7 +427,8 @@ void LLViewerInventoryCategory::updateParentOnServer(BOOL restamp) const
|
|||||||
void LLViewerInventoryCategory::updateServer(BOOL is_new) const
|
void LLViewerInventoryCategory::updateServer(BOOL is_new) const
|
||||||
{
|
{
|
||||||
// communicate that change with the server.
|
// communicate that change with the server.
|
||||||
if ( (LLFolderType::FT_NONE != mPreferredType) && (LLFolderType::FT_OUTFIT != mPreferredType) )
|
|
||||||
|
if (LLFolderType::lookupIsProtectedType(mPreferredType))
|
||||||
{
|
{
|
||||||
LLNotificationsUtil::add("CannotModifyProtectedCategories");
|
LLNotificationsUtil::add("CannotModifyProtectedCategories");
|
||||||
return;
|
return;
|
||||||
@@ -467,7 +452,7 @@ void LLViewerInventoryCategory::removeFromServer( void )
|
|||||||
llinfos << "Removing inventory category " << mUUID << " from server."
|
llinfos << "Removing inventory category " << mUUID << " from server."
|
||||||
<< llendl;
|
<< llendl;
|
||||||
// communicate that change with the server.
|
// communicate that change with the server.
|
||||||
if ( (LLFolderType::FT_NONE != mPreferredType) && (LLFolderType::FT_OUTFIT != mPreferredType) )
|
if(LLFolderType::lookupIsProtectedType(mPreferredType))
|
||||||
{
|
{
|
||||||
LLNotificationsUtil::add("CannotRemoveProtectedCategories");
|
LLNotificationsUtil::add("CannotRemoveProtectedCategories");
|
||||||
return;
|
return;
|
||||||
@@ -586,7 +571,7 @@ bool LLViewerInventoryCategory::importFileLocal(LLFILE* fp)
|
|||||||
}
|
}
|
||||||
else if(0 == strcmp("pref_type", keyword))
|
else if(0 == strcmp("pref_type", keyword))
|
||||||
{
|
{
|
||||||
mPreferredType = LLFolderType::assetTypeToFolderType(LLAssetType::lookup(valuestr));
|
mPreferredType = LLFolderType::lookup(valuestr);
|
||||||
}
|
}
|
||||||
else if(0 == strcmp("name", keyword))
|
else if(0 == strcmp("name", keyword))
|
||||||
{
|
{
|
||||||
@@ -907,15 +892,19 @@ public:
|
|||||||
|
|
||||||
void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id)
|
void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id)
|
||||||
{
|
{
|
||||||
LLSD body;
|
if (NULL == src)
|
||||||
LLViewerRegion* viewer_region = NULL;
|
|
||||||
if(object_id.notNull())
|
|
||||||
{
|
{
|
||||||
LLViewerObject* vo = gObjectList.findObject(object_id);
|
LL_WARNS("copy_inventory_from_notecard") << "Null pointer to item was passed for object_id "
|
||||||
if(vo)
|
<< object_id << " and notecard_inv_id "
|
||||||
{
|
<< notecard_inv_id << LL_ENDL;
|
||||||
viewer_region = vo->getRegion();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLViewerRegion* viewer_region = NULL;
|
||||||
|
LLViewerObject* vo = NULL;
|
||||||
|
if (object_id.notNull() && (vo = gObjectList.findObject(object_id)) != NULL)
|
||||||
|
{
|
||||||
|
viewer_region = vo->getRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to the agents region if for some reason the
|
// Fallback to the agents region if for some reason the
|
||||||
@@ -925,20 +914,32 @@ void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecar
|
|||||||
viewer_region = gAgent.getRegion();
|
viewer_region = gAgent.getRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(viewer_region)
|
if (! viewer_region)
|
||||||
{
|
{
|
||||||
std::string url = viewer_region->getCapability("CopyInventoryFromNotecard");
|
LL_WARNS("copy_inventory_from_notecard") << "Can't find region from object_id "
|
||||||
if (!url.empty())
|
<< object_id << " or gAgent"
|
||||||
{
|
<< LL_ENDL;
|
||||||
body["notecard-id"] = notecard_inv_id;
|
return;
|
||||||
body["object-id"] = object_id;
|
}
|
||||||
body["item-id"] = src->getUUID();
|
|
||||||
body["folder-id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
|
|
||||||
body["callback-id"] = (LLSD::Integer)callback_id;
|
|
||||||
|
|
||||||
LLHTTPClient::post(url, body, new LLCopyInventoryFromNotecardResponder());
|
// check capability to prevent a crash while LL_ERRS in LLCapabilityListener::capListener. See EXT-8459.
|
||||||
}
|
std::string url = viewer_region->getCapability("CopyInventoryFromNotecard");
|
||||||
|
if (url.empty())
|
||||||
|
{
|
||||||
|
LL_WARNS("copy_inventory_from_notecard") << "There is no 'CopyInventoryFromNotecard' capability"
|
||||||
|
<< " for region: " << viewer_region->getName()
|
||||||
|
<< LL_ENDL;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLSD request, body;
|
||||||
|
body["notecard-id"] = notecard_inv_id;
|
||||||
|
body["object-id"] = object_id;
|
||||||
|
body["item-id"] = src->getUUID();
|
||||||
|
body["folder-id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
|
||||||
|
body["callback-id"] = (LLSD::Integer)callback_id;
|
||||||
|
|
||||||
|
LLHTTPClient::post(url, body, new LLCopyInventoryFromNotecardResponder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -965,6 +966,22 @@ const LLUUID& LLViewerInventoryItem::getAssetUUID() const
|
|||||||
return LLInventoryItem::getAssetUUID();
|
return LLInventoryItem::getAssetUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const bool LLViewerInventoryItem::getIsFullPerm() const
|
||||||
|
{
|
||||||
|
LLPermissions item_permissions = getPermissions();
|
||||||
|
|
||||||
|
// modify-ok & copy-ok & transfer-ok
|
||||||
|
return ( item_permissions.allowOperationBy(PERM_MODIFY,
|
||||||
|
gAgent.getID(),
|
||||||
|
gAgent.getGroupID()) &&
|
||||||
|
item_permissions.allowOperationBy(PERM_COPY,
|
||||||
|
gAgent.getID(),
|
||||||
|
gAgent.getGroupID()) &&
|
||||||
|
item_permissions.allowOperationBy(PERM_TRANSFER,
|
||||||
|
gAgent.getID(),
|
||||||
|
gAgent.getGroupID()) );
|
||||||
|
}
|
||||||
const std::string& LLViewerInventoryItem::getName() const
|
const std::string& LLViewerInventoryItem::getName() const
|
||||||
{
|
{
|
||||||
if (const LLViewerInventoryItem *linked_item = getLinkedItem())
|
if (const LLViewerInventoryItem *linked_item = getLinkedItem())
|
||||||
@@ -1041,6 +1058,30 @@ U32 LLViewerInventoryItem::getFlags() const
|
|||||||
return LLInventoryItem::getFlags();
|
return LLInventoryItem::getFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LLViewerInventoryItem::isWearableType() const
|
||||||
|
{
|
||||||
|
return (getInventoryType() == LLInventoryType::IT_WEARABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLWearableType::EType LLViewerInventoryItem::getWearableType() const
|
||||||
|
{
|
||||||
|
if (!isWearableType())
|
||||||
|
{
|
||||||
|
return LLWearableType::WT_INVALID;
|
||||||
|
}
|
||||||
|
return LLWearableType::EType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time_t LLViewerInventoryItem::getCreationDate() const
|
||||||
|
{
|
||||||
|
return LLInventoryItem::getCreationDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLViewerInventoryItem::getCRC32() const
|
||||||
|
{
|
||||||
|
return LLInventoryItem::getCRC32();
|
||||||
|
}
|
||||||
|
|
||||||
// This returns true if the item that this item points to
|
// This returns true if the item that this item points to
|
||||||
// doesn't exist in memory (i.e. LLInventoryModel). The baseitem
|
// doesn't exist in memory (i.e. LLInventoryModel). The baseitem
|
||||||
@@ -1077,6 +1118,42 @@ LLViewerInventoryCategory *LLViewerInventoryItem::getLinkedCategory() const
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LLViewerInventoryItem::checkPermissionsSet(PermissionMask mask) const
|
||||||
|
{
|
||||||
|
const LLPermissions& perm = getPermissions();
|
||||||
|
PermissionMask curr_mask = PERM_NONE;
|
||||||
|
if(perm.getOwner() == gAgent.getID())
|
||||||
|
{
|
||||||
|
curr_mask = perm.getMaskBase();
|
||||||
|
}
|
||||||
|
else if(gAgent.isInGroup(perm.getGroup()))
|
||||||
|
{
|
||||||
|
curr_mask = perm.getMaskGroup();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curr_mask = perm.getMaskEveryone();
|
||||||
|
}
|
||||||
|
return ((curr_mask & mask) == mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
PermissionMask LLViewerInventoryItem::getPermissionMask() const
|
||||||
|
{
|
||||||
|
const LLPermissions& permissions = getPermissions();
|
||||||
|
|
||||||
|
BOOL copy = permissions.allowCopyBy(gAgent.getID());
|
||||||
|
BOOL mod = permissions.allowModifyBy(gAgent.getID());
|
||||||
|
BOOL xfer = permissions.allowOperationBy(PERM_TRANSFER, gAgent.getID());
|
||||||
|
PermissionMask perm_mask = 0;
|
||||||
|
if (copy) perm_mask |= PERM_COPY;
|
||||||
|
if (mod) perm_mask |= PERM_MODIFY;
|
||||||
|
if (xfer) perm_mask |= PERM_TRANSFER;
|
||||||
|
return perm_mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------
|
||||||
|
|
||||||
void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group)
|
void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group)
|
||||||
{
|
{
|
||||||
rename(name);
|
rename(name);
|
||||||
|
|||||||
@@ -59,11 +59,16 @@ public:
|
|||||||
virtual const LLUUID& getAssetUUID() const;
|
virtual const LLUUID& getAssetUUID() const;
|
||||||
virtual const std::string& getName() const;
|
virtual const std::string& getName() const;
|
||||||
virtual const LLPermissions& getPermissions() const;
|
virtual const LLPermissions& getPermissions() const;
|
||||||
|
virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied
|
||||||
virtual const LLUUID& getCreatorUUID() const;
|
virtual const LLUUID& getCreatorUUID() const;
|
||||||
virtual const std::string& getDescription() const;
|
virtual const std::string& getDescription() const;
|
||||||
virtual const LLSaleInfo& getSaleInfo() const;
|
virtual const LLSaleInfo& getSaleInfo() const;
|
||||||
virtual LLInventoryType::EType getInventoryType() const;
|
virtual LLInventoryType::EType getInventoryType() const;
|
||||||
|
virtual bool isWearableType() const;
|
||||||
|
virtual LLWearableType::EType getWearableType() const;
|
||||||
virtual U32 getFlags() const;
|
virtual U32 getFlags() const;
|
||||||
|
virtual time_t getCreationDate() const;
|
||||||
|
virtual U32 getCRC32() const; // really more of a checksum.
|
||||||
|
|
||||||
// construct a complete viewer inventory item
|
// construct a complete viewer inventory item
|
||||||
LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid,
|
LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid,
|
||||||
@@ -123,12 +128,9 @@ public:
|
|||||||
|
|
||||||
// new methods
|
// new methods
|
||||||
BOOL isComplete() const { return mIsComplete; }
|
BOOL isComplete() const { return mIsComplete; }
|
||||||
|
BOOL isFinished() const { return mIsComplete; }
|
||||||
void setComplete(BOOL complete) { mIsComplete = complete; }
|
void setComplete(BOOL complete) { mIsComplete = complete; }
|
||||||
//void updateAssetOnServer() const;
|
//void updateAssetOnServer() const;
|
||||||
// [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3a) | Added: RLVa-1.1.3a
|
|
||||||
virtual bool isWearableType() const;
|
|
||||||
virtual LLWearableType::EType getWearableType() const;
|
|
||||||
// [/RLVa:KB]
|
|
||||||
|
|
||||||
virtual void packMessage(LLMessageSystem* msg) const;
|
virtual void packMessage(LLMessageSystem* msg) const;
|
||||||
virtual void setTransactionID(const LLTransactionID& transaction_id);
|
virtual void setTransactionID(const LLTransactionID& transaction_id);
|
||||||
@@ -144,6 +146,10 @@ public:
|
|||||||
bool getIsBrokenLink() const; // true if the baseitem this points to doesn't exist in memory.
|
bool getIsBrokenLink() const; // true if the baseitem this points to doesn't exist in memory.
|
||||||
LLViewerInventoryItem *getLinkedItem() const;
|
LLViewerInventoryItem *getLinkedItem() const;
|
||||||
LLViewerInventoryCategory *getLinkedCategory() const;
|
LLViewerInventoryCategory *getLinkedCategory() const;
|
||||||
|
|
||||||
|
// Checks the items permissions (for owner, group, or everyone) and returns true if all mask bits are set.
|
||||||
|
bool checkPermissionsSet(PermissionMask mask) const;
|
||||||
|
PermissionMask getPermissionMask() const;
|
||||||
|
|
||||||
// callback
|
// callback
|
||||||
void onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group);
|
void onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group);
|
||||||
@@ -265,7 +271,8 @@ public:
|
|||||||
void fire(U32 callback_id, const LLUUID& item_id);
|
void fire(U32 callback_id, const LLUUID& item_id);
|
||||||
U32 registerCB(LLPointer<LLInventoryCallback> cb);
|
U32 registerCB(LLPointer<LLInventoryCallback> cb);
|
||||||
private:
|
private:
|
||||||
std::map<U32, LLPointer<LLInventoryCallback> > mMap;
|
typedef std::map<U32, LLPointer<LLInventoryCallback> > callback_map_t;
|
||||||
|
callback_map_t mMap;
|
||||||
U32 mLastCallback;
|
U32 mLastCallback;
|
||||||
static LLInventoryCallbackManager *sInstance;
|
static LLInventoryCallbackManager *sInstance;
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user