Skip to content
Snippets Groups Projects
Commit 6575b685 authored by Igor Borovkov's avatar Igor Borovkov
Browse files

fixed EXT-5526 Objects are shown as persons in the chat history from previous sessions

- new chat source type CHAT_SOURCE_UNKNOWN for avatar names not in cache and object names consisting of two words (avatar names like)
- new icon (unknown_icon.png) for message headers () of nearby chat messagses coming from CHAT_SOURCE_UNKNOWN
- context menu no longer displayed for object names from chat history (no UUIDs)
- double click on message headers in nearby chat no longer opens Inspector (no UUIDs)
- object names (loaded from chat history) in nearby chat are no longer SLURLed (no UUIDs for them)

--HG--
branch : product-engine
parent df29381d
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,8 @@ typedef enum e_chat_source_type ...@@ -43,7 +43,8 @@ typedef enum e_chat_source_type
{ {
CHAT_SOURCE_SYSTEM = 0, CHAT_SOURCE_SYSTEM = 0,
CHAT_SOURCE_AGENT = 1, CHAT_SOURCE_AGENT = 1,
CHAT_SOURCE_OBJECT = 2 CHAT_SOURCE_OBJECT = 2,
CHAT_SOURCE_UNKNOWN = 3
} EChatSourceType; } EChatSourceType;
typedef enum e_chat_type typedef enum e_chat_type
......
...@@ -209,6 +209,8 @@ public: ...@@ -209,6 +209,8 @@ public:
void showInspector() void showInspector()
{ {
if (mAvatarID.isNull() && CHAT_SOURCE_SYSTEM != mSourceType) return;
if (mSourceType == CHAT_SOURCE_OBJECT) if (mSourceType == CHAT_SOURCE_OBJECT)
{ {
LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", mAvatarID)); LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", mAvatarID));
...@@ -279,6 +281,9 @@ public: ...@@ -279,6 +281,9 @@ public:
break; break;
case CHAT_SOURCE_SYSTEM: case CHAT_SOURCE_SYSTEM:
icon->setValue(LLSD("SL_Logo")); icon->setValue(LLSD("SL_Logo"));
break;
case CHAT_SOURCE_UNKNOWN:
icon->setValue(LLSD("Unknown_Icon"));
} }
} }
...@@ -325,9 +330,9 @@ protected: ...@@ -325,9 +330,9 @@ protected:
{ {
if(mSourceType == CHAT_SOURCE_SYSTEM) if(mSourceType == CHAT_SOURCE_SYSTEM)
showSystemContextMenu(x,y); showSystemContextMenu(x,y);
if(mSourceType == CHAT_SOURCE_AGENT) if(mAvatarID.notNull() && mSourceType == CHAT_SOURCE_AGENT)
showAvatarContextMenu(x,y); showAvatarContextMenu(x,y);
if(mSourceType == CHAT_SOURCE_OBJECT && SYSTEM_FROM != mFrom) if(mAvatarID.notNull() && mSourceType == CHAT_SOURCE_OBJECT && SYSTEM_FROM != mFrom)
showObjectContextMenu(x,y); showObjectContextMenu(x,y);
} }
...@@ -632,7 +637,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL ...@@ -632,7 +637,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
if (utf8str_trim(chat.mFromName).size() != 0) if (utf8str_trim(chat.mFromName).size() != 0)
{ {
// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
if ( chat.mSourceType == CHAT_SOURCE_OBJECT ) if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
{ {
// for object IMs, create a secondlife:///app/objectim SLapp // for object IMs, create a secondlife:///app/objectim SLapp
std::string url = LLSLURL::buildCommand("objectim", chat.mFromID, ""); std::string url = LLSLURL::buildCommand("objectim", chat.mFromID, "");
......
...@@ -278,6 +278,13 @@ void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue) ...@@ -278,6 +278,13 @@ void LLNearbyChat::processChatHistoryStyleUpdate(const LLSD& newvalue)
nearby_chat->updateChatHistoryStyle(); nearby_chat->updateChatHistoryStyle();
} }
bool isTwoWordsName(const std::string& name)
{
//checking for a single space
S32 pos = name.find(' ', 0);
return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos;
}
void LLNearbyChat::loadHistory() void LLNearbyChat::loadHistory()
{ {
LLSD do_not_log; LLSD do_not_log;
...@@ -304,6 +311,18 @@ void LLNearbyChat::loadHistory() ...@@ -304,6 +311,18 @@ void LLNearbyChat::loadHistory()
chat.mText = msg[IM_TEXT].asString(); chat.mText = msg[IM_TEXT].asString();
chat.mTimeStr = msg[IM_TIME].asString(); chat.mTimeStr = msg[IM_TIME].asString();
chat.mChatStyle = CHAT_STYLE_HISTORY; chat.mChatStyle = CHAT_STYLE_HISTORY;
chat.mSourceType = CHAT_SOURCE_AGENT;
if (from_id.isNull() && SYSTEM_FROM == from)
{
chat.mSourceType = CHAT_SOURCE_SYSTEM;
}
else if (from_id.isNull())
{
chat.mSourceType = isTwoWordsName(from) ? CHAT_SOURCE_UNKNOWN : CHAT_SOURCE_OBJECT;
}
addMessage(chat, true, do_not_log); addMessage(chat, true, do_not_log);
it++; it++;
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -516,6 +516,7 @@ with the same filename but different name ...@@ -516,6 +516,7 @@ with the same filename but different name
<texture name="SL_Logo" file_name="icons/SL_Logo.png" preload="true" /> <texture name="SL_Logo" file_name="icons/SL_Logo.png" preload="true" />
<texture name="OBJECT_Icon" file_name="icons/object_icon.png" preload="true" /> <texture name="OBJECT_Icon" file_name="icons/object_icon.png" preload="true" />
<texture name="Unknown_Icon" file_name="icons/unknown_icon.png" preload="true" />
<texture name="Snapshot_Off" file_name="bottomtray/Snapshot_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="Snapshot_Off" file_name="bottomtray/Snapshot_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
<texture name="Snapshot_Over" file_name="bottomtray/Snapshot_Over.png" preload="false" /> <texture name="Snapshot_Over" file_name="bottomtray/Snapshot_Over.png" preload="false" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment