diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llconversationmodel.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 40 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 1 |
3 files changed, 39 insertions, 6 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 7d0ffa0788..9fa8758d11 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -251,8 +251,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mName = av_name.mUsername; - mDisplayName = av_name.mDisplayName; + mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); + mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; if (mParent) { diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index a74ebdae7a..ffbdae305b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -158,8 +158,7 @@ BOOL LLIMFloaterContainer::postBuild() collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed")); collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed")); - LLAvatarNameCache::addUseDisplayNamesCallback( - boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); + LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); if (! mMessagesPane->isCollapsed()) { @@ -176,8 +175,11 @@ BOOL LLIMFloaterContainer::postBuild() mInitialized = true; - // Add callback: we'll take care of view updates on idle + // Add callbacks: + // We'll take care of view updates on idle gIdleCallbacks.addFunction(idle, this); + // When display name option change, we need to reload all participant names + LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLIMFloaterContainer::processParticipantsStyleUpdate, this)); return TRUE; } @@ -330,6 +332,37 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +// Update all participants in the conversation lists +void LLIMFloaterContainer::processParticipantsStyleUpdate() +{ + // On each session in mConversationsItems + for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) + { + // Get the current session descriptors + LLConversationItem* session_model = it_session->second; + // Iterate through each model participant child + LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = session_model->getChildrenBegin(); + LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = session_model->getChildrenEnd(); + while (current_participant_model != end_participant_model) + { + LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model); + // Get the avatar name for this participant id from the cache and update the model + LLUUID participant_id = participant_model->getUUID(); + LLAvatarName av_name; + LLAvatarNameCache::get(participant_id,&av_name); + // Avoid updating the model though if the cache is still waiting for its first update + if (!av_name.mDisplayName.empty()) + { + participant_model->onAvatarNameCache(av_name); + } + // Bind update to the next cache name signal + LLAvatarNameCache::get(participant_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant_model, _2)); + // Next participant + current_participant_model++; + } + } +} + // static void LLIMFloaterContainer::idle(void* user_data) { @@ -341,7 +374,6 @@ void LLIMFloaterContainer::idle(void* user_data) { self->setNearbyDistances(); } - self->mConversationsRoot->update(); } diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 070feb3273..2debc2455b 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -96,6 +96,7 @@ private: void onNewMessageReceived(const LLSD& data); void onExpandCollapseButtonClicked(); + void processParticipantsStyleUpdate(); void collapseConversationsPane(bool collapse); |