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.

meow-7.2.2
Merov Linden 2012-11-02 19:36:46 -07:00
parent b6ad7db0d6
commit 4da02c26e1
3 changed files with 31 additions and 54 deletions

View File

@ -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<LLConversationItemParticipant*>(*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);
}

View File

@ -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)

View File

@ -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);