From ba57bb139617b0ad7039066fee59aa6c3a84e242 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Mon, 31 Dec 2012 06:24:35 -0500 Subject: [PATCH] In-group feature request: Allow coloring chat of special people (Friends, Estate Owner, Lindens, Muted Residents) Added ColorFriendChat, ColorEstateOwnerChat, ColorLindenChat, and ColorMutedChat. Did some spaces to tabs work, view without space changes. Add checkboxes beneath corresponding color swatches and "Use colors for chat:" text to Vanity. Fix Ascent*Color Comments strings. Also fix the issue where clicking ones name in a group chat would result in it opening a random profile. --- .../app_settings/settings_ascent_coa.xml | 62 +++++++++++++++++-- indra/newview/ascentprefsvan.cpp | 32 +++++++--- indra/newview/ascentprefsvan.h | 4 ++ indra/newview/llfloaterchat.cpp | 42 +++++++++++-- indra/newview/llimview.cpp | 30 ++++++--- .../en-us/panel_preferences_ascent_vanity.xml | 5 ++ 6 files changed, 148 insertions(+), 27 deletions(-) diff --git a/indra/newview/app_settings/settings_ascent_coa.xml b/indra/newview/app_settings/settings_ascent_coa.xml index 792c600e7..f9cf9e010 100644 --- a/indra/newview/app_settings/settings_ascent_coa.xml +++ b/indra/newview/app_settings/settings_ascent_coa.xml @@ -135,7 +135,7 @@ AscentFriendColor Comment - Color of chat messages from other residents + Special color to distinguish friends from other residents Persist 1 Type @@ -153,7 +153,7 @@ AscentLindenColor Comment - Color of chat messages from other residents + Special color to distinguish Lindens(/grid operators) from other residents Persist 1 Type @@ -171,7 +171,7 @@ AscentMutedColor Comment - Color of chat messages from other residents + Special color to distinguish those who have been muted from other residents Persist 1 Type @@ -189,7 +189,7 @@ AscentEstateOwnerColor Comment - Color of chat messages from other residents + Special color to distinguish estate owners from other residents Persist 1 Type @@ -204,7 +204,59 @@ IsCOA 1 - AscentReportClientUUID + ColorFriendChat + + Comment + Color chat from friends using AscentFriendColor + Persist + 1 + Type + Boolean + Value + 0 + IsCOA + 1 + + ColorLindenChat + + Comment + Color chat from Lindens(/grid operators) using AscentLindenColor + Persist + 1 + Type + Boolean + Value + 0 + IsCOA + 1 + + ColorMutedChat + + Comment + Color chat from muted residents using AscentMutedColor + Persist + 1 + Type + Boolean + Value + 0 + IsCOA + 1 + + ColorEstateOwnerChat + + Comment + Color chat from estate owners using AscentEstateOwnerColor + Persist + 1 + Type + Boolean + Value + 0 + IsCOA + 1 + + AscentReportClientUUID Comment Broadcasted Client Key diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 0fb702115..e80be45d3 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -156,12 +156,16 @@ void LLPrefsAscentVan::onCommitCheckBox(LLUICtrl* ctrl, void* user_data) if (ctrl->getName() == "use_status_check") { - BOOL showCustomColors = gSavedSettings.getBOOL("AscentUseStatusColors"); - self->childSetEnabled("friends_color_textbox", showCustomColors); - self->childSetEnabled("friend_color_swatch", showCustomColors); - self->childSetEnabled("estate_owner_color_swatch", showCustomColors); - self->childSetEnabled("linden_color_swatch", showCustomColors); - self->childSetEnabled("muted_color_swatch", showCustomColors); + bool showCustomColors = gSavedSettings.getBOOL("AscentUseStatusColors"); + self->childSetEnabled("friends_color_textbox", showCustomColors); + bool frColors = gSavedSettings.getBOOL("ColorFriendChat"); + self->childSetEnabled("friend_color_swatch", showCustomColors || frColors); + bool eoColors = gSavedSettings.getBOOL("ColorEstateOwnerChat"); + self->childSetEnabled("estate_owner_color_swatch", showCustomColors || eoColors); + bool lindColors = gSavedSettings.getBOOL("ColorLindenChat"); + self->childSetEnabled("linden_color_swatch", showCustomColors || lindColors); + bool muteColors = gSavedSettings.getBOOL("ColorMutedChat"); + self->childSetEnabled("muted_color_swatch", showCustomColors || muteColors); } else if (ctrl->getName() == "customize_own_tag_check") { @@ -208,6 +212,10 @@ void LLPrefsAscentVan::refreshValues() mLindenColor = gSavedSettings.getColor4("AscentLindenColor"); mMutedColor = gSavedSettings.getColor4("AscentMutedColor"); //mCustomColor = gSavedSettings.getColor4("MoyMiniMapCustomColor"); + mColorFriendChat = gSavedSettings.getBOOL("ColorFriendChat"); + mColorEOChat = gSavedSettings.getBOOL("ColorEstateOwnerChat"); + mColorLindenChat = gSavedSettings.getBOOL("ColorLindenChat"); + mColorMutedChat = gSavedSettings.getBOOL("ColorMutedChat"); //Body Dynamics -------------------------------------------------------------------------- mBreastPhysicsToggle = gSavedSettings.getBOOL("EmeraldBreastPhysicsToggle"); @@ -232,10 +240,10 @@ void LLPrefsAscentVan::refresh() combo->setCurrentByIndex(mSelectedClient); childSetEnabled("friends_color_textbox", mUseStatusColors); - childSetEnabled("friend_color_swatch", mUseStatusColors); - childSetEnabled("estate_owner_color_swatch", mUseStatusColors); - childSetEnabled("linden_color_swatch", mUseStatusColors); - childSetEnabled("muted_color_swatch", mUseStatusColors); + childSetEnabled("friend_color_swatch", mUseStatusColors || mColorFriendChat); + childSetEnabled("estate_owner_color_swatch", mUseStatusColors || mColorEOChat); + childSetEnabled("linden_color_swatch", mUseStatusColors || mColorLindenChat); + childSetEnabled("muted_color_swatch", mUseStatusColors || mColorMutedChat); childSetEnabled("custom_tag_label_text", mCustomTagOn); childSetEnabled("custom_tag_label_box", mCustomTagOn); @@ -286,6 +294,10 @@ void LLPrefsAscentVan::cancel() gSavedSettings.setColor4("AscentLindenColor", mLindenColor); gSavedSettings.setColor4("AscentMutedColor", mMutedColor); // gSavedSettings.setColor4("MoyMiniMapCustomColor", mCustomColor); + gSavedSettings.setBOOL("ColorFriendChat", mColorFriendChat); + gSavedSettings.setBOOL("ColorEstateOwnerChat", mColorEOChat); + gSavedSettings.setBOOL("ColorLindenChat", mColorLindenChat); + gSavedSettings.setBOOL("ColorMutedChat", mColorMutedChat); //Body Dynamics -------------------------------------------------------------------------- gSavedSettings.setBOOL("EmeraldBreastPhysicsToggle", mBreastPhysicsToggle); diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index 271d2af59..0c84ce432 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -82,6 +82,10 @@ protected: LLColor4 mEstateOwnerColor; LLColor4 mLindenColor; LLColor4 mMutedColor; + bool mColorFriendChat; + bool mColorEOChat; + bool mColorLindenChat; + bool mColorMutedChat; //Body Dynamics BOOL mBreastPhysicsToggle; F32 mBoobMass; diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 22281826d..bfb4892c6 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -317,8 +317,9 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) } else { + static LLCachedControl color_muted_chat("ColorMutedChat"); // desaturate muted chat - LLColor4 muted_color = lerp(color, LLColor4::grey, 0.5f); + LLColor4 muted_color = lerp(color, color_muted_chat ? gSavedSettings.getColor4("AscentMutedColor") : LLColor4::grey, 0.5f); add_timestamped_line(history_editor_with_mute, chat, muted_color); } @@ -493,7 +494,7 @@ void LLFloaterChat::triggerAlerts(const std::string& text) { // Cannot instantiate LLTextParser before logging in. if (gDirUtilp->getLindenUserDir(true).empty()) - return; + return; LLTextParser* parser = LLTextParser::getInstance(); // bool spoken=FALSE; @@ -539,7 +540,11 @@ LLColor4 get_text_color(const LLChat& chat) if(chat.mMuted) { - text_color.setVec(0.8f, 0.8f, 0.8f, 1.f); + static LLCachedControl color_muted_chat("ColorMutedChat"); + if (color_muted_chat) + text_color = gSavedSettings.getColor4("AscentMutedColor"); + else + text_color.setVec(0.8f, 0.8f, 0.8f, 1.f); } else { @@ -549,7 +554,7 @@ LLColor4 get_text_color(const LLChat& chat) text_color = gSavedSettings.getColor4("SystemChatColor"); break; case CHAT_SOURCE_AGENT: - if (chat.mFromID.isNull()) + if (chat.mFromID.isNull()) { text_color = gSavedSettings.getColor4("SystemChatColor"); } @@ -561,7 +566,34 @@ LLColor4 get_text_color(const LLChat& chat) } else { - text_color = gSavedSettings.getColor4("AgentChatColor"); + static LLCachedControl color_linden_chat("ColorLindenChat"); + if (color_linden_chat && LLMuteList::getInstance()->isLinden(chat.mFromName)) + { + text_color = gSavedSettings.getColor4("AscentLindenColor"); + } + else if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + static LLCachedControl color_friend_chat("ColorFriendChat"); + static LLCachedControl color_eo_chat("ColorEstateOwnerChat"); + if (color_friend_chat && LLAvatarTracker::instance().isBuddy(chat.mFromID)) + { + text_color = gSavedSettings.getColor4("AscentFriendColor"); + } + else if (color_eo_chat) + { + LLViewerRegion* parent_estate = gAgent.getRegion(); + if (parent_estate && parent_estate->isAlive() && chat.mFromID == parent_estate->getOwner()) + text_color = gSavedSettings.getColor4("AscentEstateOwnerColor"); + else + text_color = gSavedSettings.getColor4("AgentChatColor"); + } + else + text_color = gSavedSettings.getColor4("AgentChatColor"); + } + else + { + text_color = gSavedSettings.getColor4("AgentChatColor"); + } } } break; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d6dabcdae..b72a80755 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -483,8 +483,8 @@ void LLIMMgr::addMessage( } //not sure why...but if it is from ourselves we set the target_id - //to be NULL - if( other_participant_id == gAgent.getID() ) + //to be NULL, which seems to be breaking links on group chats, so let's not there. + if (other_participant_id == gAgent.getID() && !gAgent.isInGroup(session_id)) { other_participant_id = LLUUID::null; } @@ -553,7 +553,6 @@ void LLIMMgr::addMessage( // when answering questions. if(gAgent.isGodlike()) { - // *TODO:translate (low priority, god ability) std::ostringstream bonus_info; bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + LLTrans::getString(":") + " " << parent_estate_id @@ -574,9 +573,26 @@ void LLIMMgr::addMessage( // now add message to floater bool is_from_system = target_id.isNull() || (from == SYSTEM_FROM); - const LLColor4& color = ( is_from_system ? - gSavedSettings.getColor4("SystemChatColor") : - gSavedSettings.getColor("IMChatColor")); + + static LLCachedControl color_linden_chat("ColorLindenChat"); + bool linden = color_linden_chat && LLMuteList::getInstance()->isLinden(from); + + static LLCachedControl color_friend_chat("ColorFriendChat"); + bool contact = color_friend_chat && LLAvatarTracker::instance().isBuddy(other_participant_id); + + static LLCachedControl color_eo_chat("ColorEstateOwnerChat"); + bool estate_owner = false; + if (color_eo_chat) + { + LLViewerRegion* parent_estate = gAgent.getRegion(); + estate_owner = (parent_estate && parent_estate->isAlive() && other_participant_id == parent_estate->getOwner()); + } + + const LLColor4& color = ( is_from_system ? gSavedSettings.getColor4("SystemChatColor") + : linden ? gSavedSettings.getColor4("AscentLindenColor") + : contact ? gSavedSettings.getColor4("AscentFriendColor") + : estate_owner ? gSavedSettings.getColor4("AscentEstateOwnerColor") + : gSavedSettings.getColor("IMChatColor")); if ( !link_name ) { floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally @@ -1153,7 +1169,7 @@ void LLIMMgr::noteOfflineUsers( std::string full_name; if (info && !info->isOnline() - && gCacheName->getFullName(ids.get(i), full_name)) + && LLAvatarNameCache::getPNSName(ids.get(i), full_name)) { LLUIString offline = LLTrans::getString("offline_message"); offline.setArg("[NAME]", full_name); diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml index 46a679fe2..bba6be356 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml @@ -42,6 +42,11 @@ + Use colors for chat: + + + +