diff options
Diffstat (limited to 'linden/indra/newview/llfloaterchat.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterchat.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index c89bc86..a38684a 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp | |||
@@ -565,30 +565,34 @@ LLColor4 get_text_color(const LLChat& chat) | |||
565 | } | 565 | } |
566 | else | 566 | else |
567 | { | 567 | { |
568 | std::string my_name = gSavedSettings.getString("FirstName"); | 568 | if (gSavedSettings.getBOOL("HighlightOwnNameInChat")) |
569 | std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); | ||
570 | |||
571 | std::string lower_chat = std::string(chat.mText); | ||
572 | std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); | ||
573 | |||
574 | std::string blank = " "; | ||
575 | |||
576 | // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol | ||
577 | if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text | ||
578 | (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text | ||
579 | lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text | ||
580 | lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text | ||
581 | { | 569 | { |
582 | text_color = LLColor4::purple; | 570 | std::string my_name = gSavedSettings.getString("FirstName"); |
571 | std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); | ||
572 | |||
573 | std::string lower_chat = std::string(chat.mText); | ||
574 | std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); | ||
575 | |||
576 | std::string blank = " "; | ||
577 | |||
578 | // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol | ||
579 | if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text | ||
580 | (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text | ||
581 | lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text | ||
582 | lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text | ||
583 | { | ||
584 | text_color = gSavedSettings.getColor4("OwnNameChatColor"); | ||
585 | break; | ||
586 | } | ||
583 | } | 587 | } |
584 | else if (is_agent_friend(chat.mFromID)) | 588 | |
585 | { | 589 | if (gSavedSettings.getBOOL("HighlightFriendsChat") && is_agent_friend(chat.mFromID)) |
586 | text_color = LLColor4::yellow; | ||
587 | } | ||
588 | else | ||
589 | { | 590 | { |
590 | text_color = gSavedSettings.getColor4("AgentChatColor"); | 591 | text_color = gSavedSettings.getColor4("FriendsChatColor"); |
592 | break; | ||
591 | } | 593 | } |
594 | |||
595 | text_color = gSavedSettings.getColor4("AgentChatColor"); | ||
592 | } | 596 | } |
593 | } | 597 | } |
594 | } | 598 | } |