summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2010-10-22 17:41:06 -0700
committerLeyla Farazha <leyla@lindenlab.com>2010-10-22 17:41:06 -0700
commitcb5d8d1a9295076327f23e5f6d6c91fd0d4580ea (patch)
tree7e57893b40aa5d63aad08d28b0f62843ad4ed31c /indra/newview/llchathistory.cpp
parent48e6f36f987623ca5040de1365f9454eb074d131 (diff)
DN-181 Chat & IM logs saved in unreadable .llsd instead of .txt
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp47
1 files changed, 42 insertions, 5 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 378c4358b3..cb5cf4a61d 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -54,6 +54,7 @@
#include "llviewertexteditor.h"
#include "llworld.h"
#include "lluiconstants.h"
+#include "llstring.h"
#include "llviewercontrol.h"
@@ -260,7 +261,7 @@ public:
if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull())
{
mSourceType = CHAT_SOURCE_SYSTEM;
- }
+ }
mUserNameFont = style_params.font();
LLTextBox* user_name = getChild<LLTextBox>("user_name");
@@ -268,14 +269,14 @@ public:
user_name->setColor(style_params.color());
if (chat.mFromName.empty()
- || mSourceType == CHAT_SOURCE_SYSTEM
- || mAvatarID.isNull())
+ || mSourceType == CHAT_SOURCE_SYSTEM)
{
mFrom = LLTrans::getString("SECOND_LIFE");
user_name->setValue(mFrom);
updateMinUserNameWidth();
}
else if (mSourceType == CHAT_SOURCE_AGENT
+ && !mAvatarID.isNull()
&& chat.mChatStyle != CHAT_STYLE_HISTORY)
{
// ...from a normal user, lookup the name and fill in later.
@@ -288,7 +289,41 @@ public:
LLAvatarNameCache::get(mAvatarID,
boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2));
}
- else {
+ else if (chat.mChatStyle == CHAT_STYLE_HISTORY ||
+ mSourceType == CHAT_SOURCE_AGENT)
+ {
+ //if it's an avatar name with a username add formatting
+ S32 username_start = chat.mFromName.rfind(" (");
+ S32 username_end = chat.mFromName.rfind(')');
+
+ if (username_start != std::string::npos &&
+ username_end == (chat.mFromName.length() - 1))
+ {
+ mFrom = chat.mFromName.substr(0, username_start);
+ user_name->setValue(mFrom);
+
+ if (gSavedSettings.getBOOL("NameTagShowUsernames"))
+ {
+ std::string username = chat.mFromName.substr(username_start + 2);
+ username = username.substr(0, username.length() - 1);
+ LLStyle::Params style_params_name;
+ LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
+ style_params_name.color(userNameColor);
+ style_params_name.font.name("SansSerifSmall");
+ style_params_name.font.style("NORMAL");
+ style_params_name.readonly_color(userNameColor);
+ user_name->appendText(" - " + username, FALSE, style_params_name);
+ }
+ }
+ else
+ {
+ mFrom = chat.mFromName;
+ user_name->setValue(mFrom);
+ updateMinUserNameWidth();
+ }
+ }
+ else
+ {
// ...from an object, just use name as given
mFrom = chat.mFromName;
user_name->setValue(mFrom);
@@ -367,7 +402,9 @@ public:
user_name->setValue( LLSD(av_name.mDisplayName ) );
user_name->setToolTip( av_name.mUsername );
- if (gSavedSettings.getBOOL("NameTagShowUsernames") && LLAvatarNameCache::useDisplayNames())
+ if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
+ LLAvatarNameCache::useDisplayNames() &&
+ !av_name.mIsDisplayNameDefault)
{
LLStyle::Params style_params_name;
LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");