diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llconversationmodel.cpp | 129 | ||||
-rwxr-xr-x | indra/newview/llconversationmodel.h | 20 | ||||
-rw-r--r-- | indra/newview/llfloaterimcontainer.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 17 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_container.xml | 30 |
6 files changed, 121 insertions, 104 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0243fb1c97..a8da4908ce 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -47,7 +47,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } @@ -58,7 +59,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } @@ -69,10 +71,21 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } +LLConversationItem::~LLConversationItem() +{ + // Disconnect any previous avatar name cache connection to ensure + // that the callback method is not called after destruction + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } +} + void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant) { LLUUID session_id = (session ? session->getUUID() : LLUUID()); @@ -142,6 +155,37 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32 } } +// method does subscription to changes in avatar name cache for current session/participant conversation item. +void LLConversationItem::fetchAvatarName(bool isParticipant /*= true*/) +{ + LLUUID item_id = getUUID(); + + // item should not be null for participants + if (isParticipant) + { + llassert(item_id.notNull()); + } + + // disconnect any previous avatar name cache connection + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + // exclude nearby chat item + if (item_id.notNull()) + { + // for P2P session item, override it as item of called agent + if (CONV_SESSION_1_ON_1 == getType()) + { + item_id = LLIMModel::getInstance()->getOtherParticipantID(item_id); + } + + // subscribe on avatar name cache changes for participant and session items + mAvatarNameCacheConnection = LLAvatarNameCache::get(item_id, boost::bind(&LLConversationItem::onAvatarNameCache, this, _2)); + } +} + // // LLConversationItemSession // @@ -169,11 +213,11 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa addChild(participant); mIsLoaded = true; mNeedsRefresh = true; - updateParticipantName(participant); + updateName(participant); postEvent("add_participant", this, participant); } -void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) +void LLConversationItemSession::updateName(LLConversationItemParticipant* participant) { EConversationType conversation_type = getType(); // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do) @@ -181,11 +225,13 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip { return; } + // Avoid changing the default name if no participant present yet if (mChildren.size() == 0) { return; } + uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string if (conversation_type == CONV_SESSION_AD_HOC) { @@ -210,12 +256,14 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip } else if (conversation_type == CONV_SESSION_1_ON_1) { - // In the case of a P2P conversersation, we need to grab the name of the other participant in the session instance itself + // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself // as we do not create participants for such a session. - LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(mUUID); - LLUUID participantID = conversationFloater->getOtherParticipantUUID(); - temp_uuids.push_back(participantID); + if (gAgentID != participant->getUUID()) + { + temp_uuids.push_back(participant->getUUID()); + } } + if (temp_uuids.size() != 0) { std::string new_session_name; @@ -229,7 +277,7 @@ void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* { removeChild(participant); mNeedsRefresh = true; - updateParticipantName(participant); + updateName(participant); postEvent("remove_participant", this, participant); } @@ -393,6 +441,18 @@ void LLConversationItemSession::dumpDebugData(bool dump_children) } } +// should be invoked only for P2P sessions +void LLConversationItemSession::onAvatarNameCache(const LLAvatarName& av_name) +{ + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + renameItem(av_name.getDisplayName()); + postEvent("update_session", this, NULL); +} + // // LLConversationItemParticipant // @@ -401,8 +461,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0), - mAvatarNameCacheConnection() + mDistToAgent(-1.0) { mDisplayName = display_name; mConvType = CONV_PARTICIPANT; @@ -412,38 +471,12 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLConversationItem(uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0), - mAvatarNameCacheConnection() + mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; } -LLConversationItemParticipant::~LLConversationItemParticipant() -{ - // Disconnect any previous avatar name cache connection to ensure - // that the callback method is not called after destruction - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } -} - -void LLConversationItemParticipant::fetchAvatarName() -{ - // Request the avatar name from the cache - llassert(getUUID().notNull()); - if (getUUID().notNull()) - { - // Disconnect any previous avatar name cache connection - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } - mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2)); - } -} - -void LLConversationItemParticipant::updateAvatarName() +void LLConversationItemParticipant::updateName() { llassert(getUUID().notNull()); if (getUUID().notNull()) @@ -451,29 +484,33 @@ void LLConversationItemParticipant::updateAvatarName() LLAvatarName av_name; if (LLAvatarNameCache::get(getUUID(),&av_name)) { - updateAvatarName(av_name); + updateName(av_name); } } } void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mAvatarNameCacheConnection.disconnect(); - updateAvatarName(av_name); + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + updateName(av_name); } -void LLConversationItemParticipant::updateAvatarName(const LLAvatarName& av_name) +void LLConversationItemParticipant::updateName(const LLAvatarName& av_name) { mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); - mNeedsRefresh = true; + renameItem(mDisplayName); if (mParent != NULL) { LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent); if (parent_session != NULL) { parent_session->requestSort(); - parent_session->updateParticipantName(this); + parent_session->updateName(this); postEvent("update_participant", parent_session, this); } } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 01b3850f5e..6aaea041e4 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -64,7 +64,7 @@ public: LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItem(LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItem() {} + virtual ~LLConversationItem(); // Stub those things we won't really be using in this conversation context virtual const std::string& getName() const { return mName; } @@ -132,27 +132,31 @@ public: void buildParticipantMenuOptions(menuentry_vec_t& items, U32 flags); + void fetchAvatarName(bool isParticipant = true); // fetch and update the avatar name + protected: + virtual void onAvatarNameCache(const LLAvatarName& av_name) {} + std::string mName; // Name of the session or the participant LLUUID mUUID; // UUID of the session or the participant EConversationType mConvType; // Type of conversation item bool mNeedsRefresh; // Flag signaling to the view that something changed for this item F64 mLastActiveTime; bool mDisplayModeratorOptions; -}; + boost::signals2::connection mAvatarNameCacheConnection; +}; class LLConversationItemSession : public LLConversationItem { public: LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItemSession() {} /*virtual*/ bool hasChildren() const; LLPointer<LLUIImage> getIcon() const { return NULL; } void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; } void addParticipant(LLConversationItemParticipant* participant); - void updateParticipantName(LLConversationItemParticipant* participant); + void updateName(LLConversationItemParticipant* participant); void removeParticipant(LLConversationItemParticipant* participant); void removeParticipant(const LLUUID& participant_id); void clearParticipants(); @@ -172,6 +176,8 @@ public: void dumpDebugData(bool dump_children = false); private: + /*virtual*/ void onAvatarNameCache(const LLAvatarName& av_name); + bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise }; @@ -180,7 +186,6 @@ class LLConversationItemParticipant : public LLConversationItem public: LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItemParticipant(); virtual const std::string& getDisplayName() const { return mDisplayName; } @@ -195,8 +200,7 @@ public: virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); } - void fetchAvatarName(); // fetch and update the avatar name - void updateAvatarName(); // get from the cache (do *not* fetch) and update the avatar name + void updateName(); // get from the cache (do *not* fetch) and update the avatar name LLConversationItemSession* getParentSession(); void dumpDebugData(); @@ -204,7 +208,7 @@ public: private: void onAvatarNameCache(const LLAvatarName& av_name); // callback used by fetchAvatarName - void updateAvatarName(const LLAvatarName& av_name); + void updateName(const LLAvatarName& av_name); bool mIsMuted; // default is false bool mIsModerator; // default is false diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index a21cbf2bb2..a17b89af0d 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -162,7 +162,7 @@ BOOL LLFloaterIMContainer::postBuild() setTabContainer(getChild<LLTabContainer>("im_box_tab_container")); mStubPanel = getChild<LLPanel>("stub_panel"); - mStubTextBox = getChild<LLTextBox>("stub_textbox_2"); + mStubTextBox = getChild<LLTextBox>("stub_textbox"); mStubTextBox->setURLClickedCallback(boost::bind(&LLFloaterIMContainer::returnFloaterToHost, this)); mConversationsStack = getChild<LLLayoutStack>("conversations_stack"); @@ -380,7 +380,7 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate() { LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model); // Get the avatar name for this participant id from the cache and update the model - participant_model->updateAvatarName(); + participant_model->updateName(); // Next participant current_participant_model++; } @@ -1390,7 +1390,7 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& return NULL; } item->renameItem(display_name); - item->updateParticipantName(NULL); + item->updateName(NULL); mConversationsItems[uuid] = item; @@ -1419,6 +1419,11 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& } } + if (uuid.notNull() && im_sessionp->isP2PSessionType()) + { + item->fetchAvatarName(false); + } + // Do that too for the conversation dialog LLFloaterIMSessionTab *conversation_floater = (uuid.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(uuid))); if (conversation_floater) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0011f54175..067f0d1993 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -129,11 +129,7 @@ void process_dnd_im(const LLSD& notification) false); //will need slight refactor to retrieve whether offline message or not (assume online for now) } - //For now always flash conversation line item - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); - im_box->flashConversationItemWidget(sessionID, true); - - //And flash toolbar button + //Flash toolbar button for now, eventually the user's preference will be taken into account gToolBarView->flashCommand(LLCommandId("chat"), true); } @@ -225,12 +221,18 @@ void on_new_message(const LLSD& msg) //User is not focused on conversation containing the message if(session_floater_not_focused) { - im_box->flashConversationItemWidget(session_id, true); - + if(!LLMuteList::getInstance()->isMuted(participant_id)) + { + im_box->flashConversationItemWidget(session_id, true); + } //The conversation floater isn't focused/open if(conversation_floater_not_focused) { - gToolBarView->flashCommand(LLCommandId("chat"), true); + if(!LLMuteList::getInstance()->isMuted(participant_id) + && !gAgent.isDoNotDisturb()) + { + gToolBarView->flashCommand(LLCommandId("chat"), true); + } //Show IM toasts (upper right toasts) // Skip toasting for system messages and for nearby chat diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 2fe6cd578b..52f73d6c43 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2869,23 +2869,6 @@ void LLViewerObject::updateInventory( U8 key, bool is_new) { - LLMemType mt(LLMemType::MTYPE_OBJECT); - - std::list<LLUUID>::iterator begin = mPendingInventoryItemsIDs.begin(); - std::list<LLUUID>::iterator end = mPendingInventoryItemsIDs.end(); - - bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end; - bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL; - - if (is_fetched || is_fetching) - { - return; - } - else - { - mPendingInventoryItemsIDs.push_back(item->getAssetUUID()); - } - // This slices the object into what we're concerned about on the // viewer. The simulator will take the permissions and transfer // ownership. diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 951665552f..12c1676127 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -161,32 +161,18 @@ <text type="string" clip_partial="false" - follows="left|top" + follows="left|top|right" layout="topleft" - left="20" - right="-20" - name="stub_textbox_1" - top="30" - height="20" - valign="center" - wrap="true"> - This conversation is in a separate window. - </text> - <text - type="string" - clip_partial="false" - follows="left|top" - layout="topleft" - left="20" - right="-20" - name="stub_textbox_2" - top="60" - height="20" + left="15" + right="-15" + name="stub_textbox" + top="25" + height="40" valign="center" parse_urls="true" wrap="true"> - [secondlife:/// Bring it back.] - </text> + This conversation is in a separate window. [secondlife:/// Bring it back.] + </text> </panel> </panel_container> </layout_panel> |