summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llimfloater.cpp36
-rw-r--r--indra/newview/llimfloater.h7
2 files changed, 37 insertions, 6 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index d25aa37e16..804cc75f75 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -38,6 +38,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,22 @@ 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.getNameAndSLID();
+ updateSessionName(ui_title, av_name.mDisplayName);
+}
+
// virtual
void LLIMFloater::draw()
{
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index d63246a5cd..75ff0372ee 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -38,6 +38,7 @@
#include "lltooldraganddrop.h"
#include "lltransientdockablefloater.h"
+class LLAvatarName;
class LLLineEditor;
class LLPanelChatControlPanel;
class LLChatHistory;
@@ -130,6 +131,12 @@ private:
/* virtual */ void onFocusLost();
/* virtual */ void onFocusReceived();
+ // Update the window title, input field help text, etc.
+ void updateSessionName(const std::string& ui_title, const std::string& ui_label);
+
+ // For display name lookups for IM window titles
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+
BOOL dropCallingCard(LLInventoryItem* item, BOOL drop);
BOOL dropCategory(LLInventoryCategory* category, BOOL drop);