diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 81cc52528cf131deed8c1f868a77c1212e080478..3fb043c6695f0018483ab51d57210d83ea76098f 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 96ce01c05f559950963598cc16d0c557698fa1ff..f13445fa5dc86cf9024a6808eaa9fbe681d9628d 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 b8e0892b02cddbe607599fcf61f19f401da13792..35569cfface6d511ef43fdd3df29f0b20af51cad 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);
 	}
 }