From 9cf44eacc46cb7d690d06bc6516bba32050d7809 Mon Sep 17 00:00:00 2001 From: Cinders Date: Fri, 16 Aug 2013 12:23:31 -0600 Subject: [PATCH] FIRE-10827: Be a little more lenient on coloring when rlv showname restricted --- indra/newview/lggcontactsets.cpp | 83 ++++++++++++++++++-------------- indra/newview/lggcontactsets.h | 1 + indra/newview/llviewerchat.cpp | 5 +- 3 files changed, 52 insertions(+), 37 deletions(-) diff --git a/indra/newview/lggcontactsets.cpp b/indra/newview/lggcontactsets.cpp index 3c4f08e9e5..1647f33164 100644 --- a/indra/newview/lggcontactsets.cpp +++ b/indra/newview/lggcontactsets.cpp @@ -342,17 +342,15 @@ LLColor4 LGGContactSets::colorize(const LLUUID& uuid, const LLColor4& cur_color, { static LLCachedControl legacy_radar_friend(gSavedSettings, "FSLegacyRadarFriendColoring"); static LLCachedControl legacy_radar_linden(gSavedSettings, "FSLegacyRadarLindenColoring"); + bool rlv_shownames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); LLColor4 color = cur_color; - - // Leave generic colors if RLV restricted - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - return color; - else if (uuid == gAgent.getID()) + if (uuid == gAgent.getID()) { switch (type) { case LGG_CS_CHAT: + case LGG_CS_IM: color = LLUIColorTable::instance().getColor("UserChatColor", LLColor4::white); break; case LGG_CS_TAG: @@ -367,12 +365,51 @@ LLColor4 LGGContactSets::colorize(const LLUUID& uuid, const LLColor4& cur_color, break; } } + else if (LLAvatarTracker::instance().getBuddyInfo(uuid) != NULL) + { + switch (type) + { + case LGG_CS_CHAT: + if (!rlv_shownames) + color = LLUIColorTable::instance().getColor("FriendsChatColor", LLColor4::white); + break; + case LGG_CS_IM: + color = LLUIColorTable::instance().getColor("FriendsChatColor", LLColor4::white); + break; + case LGG_CS_TAG: + { + // This is optional per prefs. + static LLUICachedControl color_friends("NameTagShowFriends"); + if (color_friends && !rlv_shownames) + { + color = LLUIColorTable::instance().getColor("NameTagFriend", LLColor4::white); + } + } + break; + case LGG_CS_MINIMAP: + if (!rlv_shownames) + color = LLUIColorTable::instance().getColor("MapAvatarFriendColor", LLColor4::white); + break; + case LGG_CS_RADAR: + if (legacy_radar_friend && !rlv_shownames) + color = LLUIColorTable::instance().getColor("MapAvatarFriendColor", LLColor4::white); + break; + default: + llwarns << "Unhandled colorize case!" << llendl; + break; + } + } + else if (rlv_shownames) + { + // Don't bother with the rest if we're rlv_shownames restricted. + } else if (LLMuteList::getInstance()->isMuted(uuid)) { switch (type) { case LGG_CS_CHAT: - color = LLUIColorTable::instance().getColor("MutedChatColor", LLColor4::grey3); + case LGG_CS_IM: + color = LLUIColorTable::instance().getColor("MutedChatColor", LLColor4::grey3); break; case LGG_CS_TAG: color = LLUIColorTable::instance().getColor("NameTagMuted", LLColor4::grey3); @@ -386,40 +423,12 @@ LLColor4 LGGContactSets::colorize(const LLUUID& uuid, const LLColor4& cur_color, break; } } - else if (LLAvatarTracker::instance().getBuddyInfo(uuid) != NULL) - { - switch (type) - { - case LGG_CS_CHAT: - color = LLUIColorTable::instance().getColor("FriendsChatColor", LLColor4::white); - break; - case LGG_CS_TAG: - { - // This is optional per prefs. - static LLUICachedControl color_friends("NameTagShowFriends"); - if (color_friends) - { - color = LLUIColorTable::instance().getColor("NameTagFriend", LLColor4::white); - } - } - break; - case LGG_CS_MINIMAP: - color = LLUIColorTable::instance().getColor("MapAvatarFriendColor", LLColor4::white); - break; - case LGG_CS_RADAR: - if (legacy_radar_friend) - color = LLUIColorTable::instance().getColor("MapAvatarFriendColor", LLColor4::white); - break; - default: - llwarns << "Unhandled colorize case!" << llendl; - break; - } - } else if (FSData::instance().isAgentFlag(uuid, FSData::CHAT_COLOR)) { switch (type) { case LGG_CS_CHAT: + case LGG_CS_IM: color = LLUIColorTable::instance().getColor("FirestormChatColor", LLColor4::red); break; case LGG_CS_TAG: @@ -442,6 +451,7 @@ LLColor4 LGGContactSets::colorize(const LLUUID& uuid, const LLColor4& cur_color, switch (type) { case LGG_CS_CHAT: + case LGG_CS_IM: color = LLUIColorTable::instance().getColor("LindenChatColor", LLColor4::blue); break; case LGG_CS_TAG: @@ -461,7 +471,7 @@ LLColor4 LGGContactSets::colorize(const LLUUID& uuid, const LLColor4& cur_color, } } - if (isNonFriend(uuid)) + if (!rlv_shownames && isNonFriend(uuid)) { color = toneDownColor(color, 0.8f); } @@ -527,6 +537,7 @@ bool LGGContactSets::hasFriendColorThatShouldShow(const LLUUID& friend_id, ELGGC switch (type) { case LGG_CS_CHAT: + case LGG_CS_IM: if (!fsContactSetsColorizeChat) return false; break; diff --git a/indra/newview/lggcontactsets.h b/indra/newview/lggcontactsets.h index 392aab0f71..7701831bac 100644 --- a/indra/newview/lggcontactsets.h +++ b/indra/newview/lggcontactsets.h @@ -28,6 +28,7 @@ typedef enum e_lgg_cs { LGG_CS_CHAT, + LGG_CS_IM, LGG_CS_TAG, LGG_CS_RADAR, LGG_CS_MINIMAP diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 5df3c08504..354cb980c6 100755 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -77,7 +77,10 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color, bool is_l //{ r_color = LLUIColorTable::instance().getColor("AgentChatColor"); //} - r_color = LGGContactSets::getInstance()->colorize(chat.mFromID, r_color, LGG_CS_CHAT); + if (chat.mChatType == CHAT_TYPE_IM || chat.mChatType == CHAT_TYPE_IM_GROUP) + r_color = LGGContactSets::getInstance()->colorize(chat.mFromID, r_color, LGG_CS_IM); + else + r_color = LGGContactSets::getInstance()->colorize(chat.mFromID, r_color, LGG_CS_CHAT); // //color based on contact sets prefs