summaryrefslogtreecommitdiff
path: root/indra/newview/lllogchat.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-05-25 11:40:29 -0700
committerJames Cook <james@lindenlab.com>2010-05-25 11:40:29 -0700
commitd6ea42984553b7adb6f26cf2ed094d32e36814d2 (patch)
tree25fe04a20b89ce63ad5c6b32856371c46a728c08 /indra/newview/lllogchat.cpp
parentfb51f985c35f5dae85057ad932928b8fcd44cc73 (diff)
DEV-50013 Display names load at startup in local chat/IM history
Had to change the chat log file format to include agent_id. Code will load viewer 2.0 logs, but viewer 2.0 will just discard data from 2.1 logs, which seems OK. Reviewed with Leyla.
Diffstat (limited to 'indra/newview/lllogchat.cpp')
-rw-r--r--indra/newview/lllogchat.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index be8b2363ad..1d348834fe 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -426,6 +426,12 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const
return;
}
+ if (im[IM_FROM_ID].isDefined())
+ {
+ LLUUID from_id = im[IM_FROM_ID].asUUID();
+ ostr << '{' << from_id.asString() << '}';
+ }
+
if (im[IM_TIME].isDefined())
{
std::string timestamp = im[IM_TIME].asString();
@@ -456,15 +462,32 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const
}
}
-bool LLChatLogParser::parse(std::string& raw, LLSD& im)
+bool LLChatLogParser::parse(const std::string& raw, LLSD& im)
{
if (!raw.length()) return false;
im = LLSD::emptyMap();
+ // In Viewer 2.1 we added UUID to chat/IM logging so we can look up
+ // display names
+ std::string line = raw;
+ if (raw[0] == '{')
+ {
+ const S32 UUID_LEN = 36;
+ size_t pos = line.find_first_of('}');
+ // If it matches, pos will be 37
+ if (pos != line.npos && pos > UUID_LEN)
+ {
+ std::string uuid_string = line.substr(1, UUID_LEN);
+ LLUUID from_id(uuid_string);
+ im[IM_FROM_ID] = from_id;
+ line = line.substr(pos + 1);
+ }
+ }
+
//matching a timestamp
boost::match_results<std::string::const_iterator> matches;
- if (!boost::regex_match(raw, matches, TIMESTAMP_AND_STUFF)) return false;
+ if (!boost::regex_match(line, matches, TIMESTAMP_AND_STUFF)) return false;
bool has_timestamp = matches[IDX_TIMESTAMP].matched;
if (has_timestamp)