diff options
| author | Steven Bennetts <steve@lindenlab.com> | 2009-08-05 01:05:39 +0000 |
|---|---|---|
| committer | Steven Bennetts <steve@lindenlab.com> | 2009-08-05 01:05:39 +0000 |
| commit | 85f940092705281f1040081ca5ebc207c3cb4a5b (patch) | |
| tree | c3ba20351cd7ce83dcf09d65b5a8c5998625d2cc /indra/newview/llinventorymodel.cpp | |
| parent | 7447454e7e733699f57f545bac13f46a72b916b7 (diff) | |
EXT-316 Enable the Viewer to generate calling cards for any agent
Added code to store agent ID in the description field of calling cards so that we can use them to store user generated contacts.
Currently enabled as a context menu for avatars (just for initial testing).
reviewed by richard
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
| -rw-r--r-- | indra/newview/llinventorymodel.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index bba0c9a90d..b4bd312cc0 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -565,9 +565,11 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) } LLViewerInventoryItem* old_item = getItem(item->getUUID()); + LLPointer<LLViewerInventoryItem> new_item; if(old_item) { // We already have an old item, modify its values + new_item = old_item; LLUUID old_parent_id = old_item->getParentUUID(); LLUUID new_parent_id = item->getParentUUID(); if(old_parent_id != new_parent_id) @@ -596,7 +598,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) else { // Simply add this item - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); + new_item = new LLViewerInventoryItem(item); addItem(new_item); if(item->getParentUUID().isNull()) @@ -656,11 +658,24 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) } mask |= LLInventoryObserver::ADD; } - if(item->getType() == LLAssetType::AT_CALLINGCARD) + if(new_item->getType() == LLAssetType::AT_CALLINGCARD) { mask |= LLInventoryObserver::CALLING_CARD; + // Handle user created calling cards. + // Target ID is stored in the description field of the card. + LLUUID id; + std::string desc = new_item->getDescription(); + BOOL isId = desc.empty() ? FALSE : id.set(desc, FALSE); + if (isId) + { + // Valid UUID; set the item UUID and rename it + new_item->setCreator(id); + std::string avatar_name; + // Fetch the currect name + gCacheName->get(id, FALSE, boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(), _1, _2, _3)); + } } - addChangedMask(mask, item->getUUID()); + addChangedMask(mask, new_item->getUUID()); return mask; } |
