diff options
Diffstat (limited to 'indra/newview/llimfloater.cpp')
-rw-r--r-- | indra/newview/llimfloater.cpp | 89 |
1 files changed, 7 insertions, 82 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 2ff883da67..73c7be37eb 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -220,7 +220,6 @@ void LLIMFloater::sendMsg(const std::string& msg) LLIMFloater::~LLIMFloater() { - mParticipantsListRefreshConnection.disconnect(); mVoiceChannelStateChangeConnection.disconnect(); if(LLVoiceClient::instanceExists()) { @@ -243,7 +242,6 @@ void LLIMFloater::initIMSession(const LLUUID& session_id) { mIsP2PChat = mSession->isP2PSessionType(); mSessionInitialized = mSession->mSessionInitialized; - mDialog = mSession->mType; } } @@ -271,31 +269,10 @@ 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, session_name); - - // For ad hoc conferences we should update the title with participants names. - if ((IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) - || mDialog == IM_SESSION_CONFERENCE_START) - { - if (mParticipantsListRefreshConnection.connected()) - { - mParticipantsListRefreshConnection.disconnect(); - } - - LLAvatarList* avatar_list = getChild<LLAvatarList>("speakers_list"); - mParticipantsListRefreshConnection = avatar_list->setRefreshCompleteCallback( - boost::bind(&LLIMFloater::onParticipantsListChanged, this, _1)); - } + updateSessionName(session_name); } } @@ -525,64 +502,13 @@ void LLIMFloater::onVoiceChannelStateChanged( updateCallBtnState(callIsActive); } -void LLIMFloater::updateSessionName(const std::string& ui_title, - const std::string& ui_label) -{ - mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + ui_label); - setTitle(ui_title); -} - -void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, - const LLAvatarName& av_name) -{ - // Use display name only for labels, as the extended name will be in the - // floater title - std::string ui_title = av_name.getCompleteName(); - updateSessionName(ui_title, av_name.mDisplayName); - mTypingStart.setArg("[NAME]", ui_title); -} - -void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) +void LLIMFloater::updateSessionName(const std::string& name) { - LLAvatarList* avatar_list = dynamic_cast<LLAvatarList*>(ctrl); - if (!avatar_list) - { - return; - } - - bool all_names_resolved = true; - std::vector<LLSD> participants_uuids; - uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string - - avatar_list->getValues(participants_uuids); - - // Check whether we have all participants names in LLAvatarNameCache - for (std::vector<LLSD>::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) - { - const LLUUID& id = it->asUUID(); - temp_uuids.push_back(id); - LLAvatarName av_name; - if (!LLAvatarNameCache::get(id, &av_name)) - { - all_names_resolved = false; - - // If a name is not found in cache, request it and continue the process recursively - // until all ids are resolved into names. - LLAvatarNameCache::get(id, - boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); - break; - } - } - - if (all_names_resolved) - { - std::string ui_title; - LLAvatarActions::buildResidentsString(temp_uuids, ui_title); - updateSessionName(ui_title, ui_title); - } + LLIMConversation::updateSessionName(name); + setTitle(name); + mTypingStart.setArg("[NAME]", name); } - //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { @@ -771,8 +697,7 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) if (mSessionID != im_session_id) { initIMSession(im_session_id); - - buildParticipantList(); + buildConversationViewParticipant(); } initIMFloater(); |