From 4da02c26e10fe59dfde762cdb3c0d20be7f6ebde Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 2 Nov 2012 19:36:46 -0700 Subject: CHUI-481, CHUI-404, CHUI-405, CHUI-406, CHUI-407, CHUI-408 : Fixed! Change the way Ad-hoc and P2P chats update their session name in a way which is consistent and honor display name. --- indra/newview/llimconversation.cpp | 60 ++++++++++++++++++-------------------- indra/newview/llimfloater.cpp | 22 ++------------ indra/newview/llimfloater.h | 3 -- 3 files changed, 31 insertions(+), 54 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index a6a246a01e..6272c75ccf 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -29,6 +29,8 @@ #include "llimconversation.h" +#include "llagent.h" +#include "llavataractions.h" #include "llchatentry.h" #include "llchathistory.h" #include "llchiclet.h" @@ -370,50 +372,47 @@ void LLIMConversation::updateConversationViewParticipant(const LLUUID& participa if (widget) { widget->refresh(); - refreshConversation(); } + refreshConversation(); } void LLIMConversation::refreshConversation() { - // Debug : Check that all participant models do have a view (debug consistency check) - /* - LLParticipantList* item = getParticipantList(); - llinfos << "Merov debug : Start consistency check" << llendl; - LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin(); - LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd(); - while (current_participant_model != end_participant_model) + // Note: We collect participants names to change the session name only in the case of ad-hoc conversations + bool is_ad_hoc = (mSession ? mSession->isAdHocSessionType() : false); + uuid_vec_t participants_uuids; // uuids vector for building the added participants name string + // For P2P chat, we still need to update the session name who may have changed (switch display name for instance) + if (mIsP2PChat && mSession) { - LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); - if (participant_model != NULL) - { - LLUUID uuid = participant_model->getUUID(); - LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid); - if (!widget) - { - llinfos << "Merov debug : Consistency error! Couldn't find widget for " << participant_model->getName() << llendl; - } - else - { - llinfos << "Merov debug : Consistency check pass for " << participant_model->getName() << llendl; - } - } - else - { - llinfos << "Merov debug : Consistency check, skip non participant child" << llendl; - } - current_participant_model++; + participants_uuids.push_back(mSession->mOtherParticipantID); } - llinfos << "Merov debug : End consistency check" << llendl; - */ - + conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); while (widget_it != mConversationsWidgets.end()) { + // Add the participant to the list except if it's the agent itself (redundant) + if (is_ad_hoc && (widget_it->first != gAgentID)) + { + participants_uuids.push_back(widget_it->first); + } widget_it->second->refresh(); widget_it->second->setVisible(TRUE); ++widget_it; } + if (is_ad_hoc || mIsP2PChat) + { + // Build the session name and update it + std::string session_name; + if (participants_uuids.size() != 0) + { + LLAvatarActions::buildResidentsString(participants_uuids, session_name); + } + else + { + session_name = LLIMModel::instance().getName(mSessionID); + } + updateSessionName(session_name); + } mConversationViewModel.requestSortAll(); mConversationsRoot->arrangeAll(); mConversationsRoot->update(); @@ -510,7 +509,6 @@ void LLIMConversation::hideOrShowTitle() void LLIMConversation::updateSessionName(const std::string& name) { - llinfos << "Merov debug : updateSessionName, name = " << name << llendl; mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + name); } diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 4e1bfb4e77..75be0a7edc 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -270,14 +270,7 @@ void LLIMFloater::initIMFloater() mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); } - if (mIsP2PChat) - { - // look up display name for window title - LLAvatarNameCache::get(mSession->mOtherParticipantID, - boost::bind(&LLIMFloater::onAvatarNameCache, - this, _1, _2)); - } - else + if (!mIsP2PChat) { std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name); @@ -530,18 +523,7 @@ void LLIMFloater::updateSessionName(const std::string& name) { LLIMConversation::updateSessionName(name); setTitle(name); -} - -void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, - const LLAvatarName& av_name) -{ - // Use display name for label - updateSessionName(av_name.mDisplayName); - - // Overwrite the floater title with the extended name - std::string ui_title = av_name.getCompleteName(); - setTitle(ui_title); - mTypingStart.setArg("[NAME]", ui_title); + mTypingStart.setArg("[NAME]", name); } void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index ec3a96f694..bac21c27f0 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -142,9 +142,6 @@ private: // Update the window title and input field help text /*virtual*/ void updateSessionName(const std::string& name); - // For display name lookups for IM window titles - void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - /// Updates the list of ad hoc conference participants /// in an IM floater title. void onParticipantsListChanged(LLUICtrl* ctrl); -- cgit v1.2.3