summaryrefslogtreecommitdiff
path: root/indra/newview/llimfloater.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2010-11-04 18:09:35 -0700
committerMerov Linden <merov@lindenlab.com>2010-11-04 18:09:35 -0700
commitba3307b8d0f2ceb40454174a6593f3f98ce98b65 (patch)
tree7c016ab72795543361d206de5344b34a6a823fdf /indra/newview/llimfloater.cpp
parentdac53830f1a67c8657ced9c39eccedbadf149bd9 (diff)
parent40979589afc5c91cab977307a1e400315b1c8a8f (diff)
merge with STORM-105
Diffstat (limited to 'indra/newview/llimfloater.cpp')
-rw-r--r--indra/newview/llimfloater.cpp43
1 files changed, 32 insertions, 11 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 56d3ed1c4d..e000abda2a 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -32,6 +32,7 @@
#include "llagent.h"
#include "llappviewer.h"
+#include "llavatarnamecache.h"
#include "llbutton.h"
#include "llbottomtray.h"
#include "llchannelmanager.h"
@@ -275,12 +276,6 @@ BOOL LLIMFloater::postBuild()
mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
mInputEditor->setPassDelete( TRUE );
- std::string session_name(LLIMModel::instance().getName(mSessionID));
-
- mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + session_name);
-
- setTitle(session_name);
-
childSetCommitCallback("chat_editor", onSendMsg, this);
mChatHistory = getChild<LLChatHistory>("chat_history");
@@ -298,6 +293,19 @@ BOOL LLIMFloater::postBuild()
mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label"));
}
+ if ( im_session && im_session->isP2PSessionType())
+ {
+ // look up display name for window title
+ LLAvatarNameCache::get(im_session->mOtherParticipantID,
+ boost::bind(&LLIMFloater::onAvatarNameCache,
+ this, _1, _2));
+ }
+ else
+ {
+ std::string session_name(LLIMModel::instance().getName(mSessionID));
+ updateSessionName(session_name, session_name);
+ }
+
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
//see LLFloaterIMPanel for how it is done (IB)
@@ -311,6 +319,23 @@ BOOL LLIMFloater::postBuild()
}
}
+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);
+}
+
// virtual
void LLIMFloater::draw()
{
@@ -1071,13 +1096,9 @@ void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info)
{
mOtherTyping = true;
- // Create typing is started title string
- LLUIString typing_start(mTypingStart);
- typing_start.setArg("[NAME]", im_info->mName);
-
// Save and set new title
mSavedTitle = getTitle();
- setTitle (typing_start);
+ setTitle (mTypingStart);
// Update speaker
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);