Display Name work

This commit is contained in:
Siana Gearz
2010-12-12 21:58:19 +01:00
parent a8ce4df93c
commit 9983d0b803
29 changed files with 525 additions and 134 deletions

View File

@@ -102,6 +102,8 @@ LLVoiceChannel* LLVoiceChannel::sSuspendedVoiceChannel = NULL;
BOOL LLVoiceChannel::sSuspended = FALSE;
std::set<LLFloaterIMPanel*> LLFloaterIMPanel::sFloaterIMPanels;
void session_starter_helper(
const LLUUID& temp_session_id,
const LLUUID& other_participant_id,
@@ -1104,6 +1106,10 @@ LLFloaterIMPanel::LLFloaterIMPanel(
mFirstKeystrokeTimer(),
mLastKeystrokeTimer()
{
// [Ansariel: Display name support]
sFloaterIMPanels.insert(this);
// [/Ansariel: Display name support]
init(session_label);
}
@@ -1136,6 +1142,10 @@ LLFloaterIMPanel::LLFloaterIMPanel(
mFirstKeystrokeTimer(),
mLastKeystrokeTimer()
{
// [Ansariel: Display name support]
sFloaterIMPanels.insert(this);
// [/Ansariel: Display name support]
mSessionInitialTargetIDs = ids;
init(session_label);
}
@@ -1145,6 +1155,10 @@ void LLFloaterIMPanel::init(const std::string& session_label)
{
mSessionLabel = session_label;
// [Ansariel: Display name support]
mProfileButtonEnabled = FALSE;
// [/Ansariel: Display name support]
std::string xml_filename;
switch(mDialog)
{
@@ -1199,6 +1213,15 @@ void LLFloaterIMPanel::init(const std::string& session_label)
FALSE);
setTitle(mSessionLabel);
// [Ansariel: Display name support]
if (mProfileButtonEnabled)
{
lookupName();
}
// [/Ansariel: Display name support]
mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN);
// enable line history support for instant message bar
mInputEditor->setEnableLineHistory(TRUE);
@@ -1240,9 +1263,34 @@ void LLFloaterIMPanel::init(const std::string& session_label)
}
}
// [Ansariel: Display name support]
void LLFloaterIMPanel::lookupName()
{
LLAvatarNameCache::get(mOtherParticipantUUID, boost::bind(&LLFloaterIMPanel::onAvatarNameLookup, _1, _2, this));
}
//static
void LLFloaterIMPanel::onAvatarNameLookup(const LLUUID& id, const LLAvatarName& avatar_name, void* user_data)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*)user_data;
if (self && sFloaterIMPanels.count(self) != 0)
{
std::string title = avatar_name.getCompleteName();
if (!title.empty())
{
self->setTitle(title);
}
}
}
// [/Ansariel: Display name support]
LLFloaterIMPanel::~LLFloaterIMPanel()
{
// [Ansariel: Display name support]
sFloaterIMPanels.erase(this);
// [/Ansariel: Display name support]
delete mSpeakers;
mSpeakers = NULL;
@@ -1587,7 +1635,12 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4
else
histstr = name + utf8msg;
LLLogChat::saveHistory(getTitle(),histstr);
// [Ansariel: Display name support]
// Floater title contains display name -> bad idea to use that as filename
// mSessionLabel, however, should still be the old legacy name
//LLLogChat::saveHistory(getTitle(),histstr);
LLLogChat::saveHistory(mSessionLabel, histstr);
// [/Ansariel: Display name support]
}
if (!isInVisibleChain())
@@ -1815,7 +1868,10 @@ void LLFloaterIMPanel::onClickHistory( void* userdata )
if (self->mOtherParticipantUUID.notNull())
{
char command[256];
std::string fullname(gDirUtilp->getScrubbedFileName(self->getTitle()));
// [Ansariel: Display name support]
//std::string fullname(gDirUtilp->getScrubbedFileName(self->getTitle()));
std::string fullname(gDirUtilp->getScrubbedFileName(self->mSessionLabel));
// [/Ansariel: Display name support]
sprintf(command, "\"%s\\%s.txt\"", gDirUtilp->getPerAccountChatLogsDir().c_str(),fullname.c_str());
gViewerWindow->getWindow()->ShellEx(command);