summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Borovkov <iborovkov@productengine.com>2010-02-17 16:09:50 +0200
committerIgor Borovkov <iborovkov@productengine.com>2010-02-17 16:09:50 +0200
commit4c5a998f79e835d1f3436a8f8d1cc920d158fcff (patch)
tree1a4d32f6e7f41895134d84f3e03673095f790510
parent2ab4bf8b35bed067a1e7871e921e489fdc8322aa (diff)
fixed EXT-5456 Messages from objects are shownas messages from Second Life in nearby chat history from the prev session
Completed things which were agreed on: - system messages in the log file are prepended with "Second Life:" after the timestamp - object names set which are parsed extended to object names consisting with any number of words Side effect: "Second Life:" is shown as From Name in Nearby Chat when in plain text chat --HG-- branch : product-engine
-rw-r--r--indra/newview/llchathistory.cpp2
-rw-r--r--indra/newview/lllogchat.cpp28
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp1
3 files changed, 29 insertions, 2 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 81cc52528c..3fb043c669 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -264,7 +264,7 @@ public:
gCacheName->get(mAvatarID, FALSE, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3, _4));
//*TODO overly defensive thing, source type should be maintained out there
- if(chat.mFromID.isNull() || chat.mFromName == SYSTEM_FROM)
+ if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM)
{
mSourceType = CHAT_SOURCE_SYSTEM;
}
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 96ce01c05f..f13445fa5d 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -69,6 +69,8 @@ const static std::string MULTI_LINE_PREFIX(" ");
* Katar Ivercourt is Offline
* [3:00] Katar Ivercourt is Offline
* [2009/11/20 3:01] Corba ProductEngine is Offline
+ *
+ * Note: "You" was used as an avatar names in viewers of previous versions
*/
const static boost::regex TIMESTAMP_AND_STUFF("^(\\[\\d{4}/\\d{1,2}/\\d{1,2}\\s+\\d{1,2}:\\d{2}\\]\\s+|\\[\\d{1,2}:\\d{2}\\]\\s+)?(.*)$");
@@ -78,6 +80,9 @@ const static boost::regex TIMESTAMP_AND_STUFF("^(\\[\\d{4}/\\d{1,2}/\\d{1,2}\\s+
*/
const static boost::regex NAME_AND_TEXT("(You:|Second Life:|[^\\s:]+\\s*[:]{1}|\\S+\\s+[^\\s:]+[:]{1})?(\\s*)(.*)");
+//is used to parse complex object names like "Xstreet SL Terminal v2.2.5 st"
+const static std::string NAME_TEXT_DIVIDER(": ");
+
const static int IDX_TIMESTAMP = 1;
const static int IDX_STUFF = 2;
const static int IDX_NAME = 1;
@@ -160,10 +165,19 @@ void LLLogChat::saveHistory(const std::string& filename,
if (gSavedPerAccountSettings.getBOOL("LogTimestamp"))
item["time"] = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate"));
- item["from"] = from;
item["from_id"] = from_id;
item["message"] = line;
+ //adding "Second Life:" for all system messages to make chat log history parsing more reliable
+ if (from.empty() && from_id.isNull())
+ {
+ item["from"] = SYSTEM_FROM;
+ }
+ else
+ {
+ item["from"] = from;
+ }
+
file << LLChatLogFormatter(item) << std::endl;
file.close();
@@ -398,6 +412,18 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im)
im[IM_FROM_ID] = LLUUID::null;
}
+ //possibly a case of complex object names consisting of 3+ words
+ if (!has_name)
+ {
+ U32 divider_pos = stuff.find(NAME_TEXT_DIVIDER);
+ if (divider_pos != std::string::npos && divider_pos < (stuff.length() - NAME_TEXT_DIVIDER.length()))
+ {
+ im[IM_FROM] = stuff.substr(0, divider_pos);
+ im[IM_TEXT] = stuff.substr(divider_pos + NAME_TEXT_DIVIDER.length());
+ return true;
+ }
+ }
+
if (!has_name)
{
//text is mandatory
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index b8e0892b02..35569cffac 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -220,6 +220,7 @@ void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChat
{
LLChat chat_msg(notification->getMessage());
chat_msg.mSourceType = type;
+ chat_msg.mFromName = SYSTEM_FROM;
nearby_chat->addMessage(chat_msg);
}
}