diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-05-25 14:22:56 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-05-25 14:22:56 -0700 |
commit | 16e3d7ebf56731c5e9ff40b92eff427316c65103 (patch) | |
tree | 62552614f1314f4d3bb96ef133b9659bdae89e16 /indra/newview/lllogchat.cpp | |
parent | 1bd6061ff57a46293d962adf8ffa5326f87a3566 (diff) | |
parent | a91d10dc1806d1931c7f1361bfcf70df59d982d5 (diff) |
Merge
Diffstat (limited to 'indra/newview/lllogchat.cpp')
-rw-r--r-- | indra/newview/lllogchat.cpp | 27 |
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) |