aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview
diff options
context:
space:
mode:
authorelektrahesse2010-09-08 01:55:28 +0200
committerelektrahesse2010-09-08 01:55:28 +0200
commit051a9d47d2c32ee5852f6d22af4d19dddd13a978 (patch)
tree1934d191c914d5a782a72ccf686cb87bb4ad8be3 /linden/indra/newview
parentMade the texture fix cross platform and removed boost::filesystem dep for loa... (diff)
downloadmeta-impy-051a9d47d2c32ee5852f6d22af4d19dddd13a978.zip
meta-impy-051a9d47d2c32ee5852f6d22af4d19dddd13a978.tar.gz
meta-impy-051a9d47d2c32ee5852f6d22af4d19dddd13a978.tar.bz2
meta-impy-051a9d47d2c32ee5852f6d22af4d19dddd13a978.tar.xz
Initial hacky release of colors in chat highlighting friend chat and when your name is typed
Diffstat (limited to 'linden/indra/newview')
-rw-r--r--linden/indra/newview/llfloaterchat.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp
index f7ff3f9..c89bc86 100644
--- a/linden/indra/newview/llfloaterchat.cpp
+++ b/linden/indra/newview/llfloaterchat.cpp
@@ -76,6 +76,7 @@
76#include "llfloaterhtml.h" 76#include "llfloaterhtml.h"
77#include "llweb.h" 77#include "llweb.h"
78#include "llstylemap.h" 78#include "llstylemap.h"
79#include "llviewermenu.h"
79 80
80// Used for LCD display 81// Used for LCD display
81extern void AddNewIMToLCD(const std::string &newLine); 82extern void AddNewIMToLCD(const std::string &newLine);
@@ -551,19 +552,44 @@ LLColor4 get_text_color(const LLChat& chat)
551 text_color = gSavedSettings.getColor4("SystemChatColor"); 552 text_color = gSavedSettings.getColor4("SystemChatColor");
552 break; 553 break;
553 case CHAT_SOURCE_AGENT: 554 case CHAT_SOURCE_AGENT:
554 if (chat.mFromID.isNull())
555 { 555 {
556 text_color = gSavedSettings.getColor4("SystemChatColor"); 556 if (chat.mFromID.isNull())
557 }
558 else
559 {
560 if(gAgent.getID() == chat.mFromID)
561 { 557 {
562 text_color = gSavedSettings.getColor4("UserChatColor"); 558 text_color = gSavedSettings.getColor4("SystemChatColor");
563 } 559 }
564 else 560 else
565 { 561 {
566 text_color = gSavedSettings.getColor4("AgentChatColor"); 562 if(gAgent.getID() == chat.mFromID)
563 {
564 text_color = gSavedSettings.getColor4("UserChatColor");
565 }
566 else
567 {
568 std::string my_name = gSavedSettings.getString("FirstName");
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 {
582 text_color = LLColor4::purple;
583 }
584 else if (is_agent_friend(chat.mFromID))
585 {
586 text_color = LLColor4::yellow;
587 }
588 else
589 {
590 text_color = gSavedSettings.getColor4("AgentChatColor");
591 }
592 }
567 } 593 }
568 } 594 }
569 break; 595 break;