From 45ae4881525730eece3298d3c88984ce0599a106 Mon Sep 17 00:00:00 2001 From: Nemurimasu Neiro Date: Mon, 6 Sep 2010 00:04:56 +0000 Subject: use setenv instead of putenv putenv requires that the string not be freed --- linden/indra/llmedia/llmediaimplgstreamer.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 2bfe4ea..7af9c9a 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -188,9 +188,6 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) // Protect against GStreamer resetting the locale, yuck. static std::string saved_locale; saved_locale = setlocale(LC_ALL, NULL); -#if LL_DARWIN - setenv("GST_PLUGIN_SYSTEM_PATH", "lib/gstreamer-plugins", TRUE); -#endif if (0 == gst_init_check(NULL, NULL, NULL)) { LL_WARNS("MediaImpl") << "GStreamer library failed to initialize and load standard plugins." << LL_ENDL; @@ -294,7 +291,6 @@ void LLMediaImplGStreamer::set_gst_plugin_path() // Search both Imprudence and Imprudence\lib\gstreamer-plugins. // But we also want to search the path the user has set, if any. std::string plugin_path = - "GST_PLUGIN_PATH=" + #if LL_WINDOWS imp_dir + "\\lib\\gstreamer-plugins" + #elif LL_DARWIN @@ -307,9 +303,9 @@ void LLMediaImplGStreamer::set_gst_plugin_path() // Place GST_PLUGIN_PATH in the environment settings #if LL_WINDOWS - put_result = _putenv( (char*)plugin_path.c_str() ); + put_result = _putenv_s( "GST_PLUGIN_PATH", (char*)plugin_path.c_str() ); #elif LL_DARWIN - put_result = putenv( (char*)plugin_path.c_str() ); + put_result = setenv( "GST_PLUGIN_PATH", (char*)plugin_path.c_str(), 1 ); #endif if( put_result == -1 ) @@ -324,9 +320,9 @@ void LLMediaImplGStreamer::set_gst_plugin_path() // Don't load system plugins. We only want to use ours, to avoid conflicts. #if LL_WINDOWS - put_result = _putenv( "GST_PLUGIN_SYSTEM_PATH=\"\"" ); + put_result = _putenv_s( "GST_PLUGIN_SYSTEM_PATH", "" ); #elif LL_DARWIN - put_result = putenv( "GST_PLUGIN_SYSTEM_PATH=\"\"" ); + put_result = setenv( "GST_PLUGIN_SYSTEM_PATH", "", 1 ); #endif if( put_result == -1 ) -- cgit v1.1 From c01c71d3b22b9acb983c238b608401f7d032ef9b Mon Sep 17 00:00:00 2001 From: Nemurimasu Neiro Date: Mon, 6 Sep 2010 05:11:05 +0000 Subject: store our password in the Mac OS keychain much more secure than XORing against a MAC address :) --- linden/indra/newview/CMakeLists.txt | 2 ++ linden/indra/newview/llstartup.cpp | 45 ++++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index 995ef7e..313ed9f 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -955,11 +955,13 @@ if (DARWIN) find_library(APPKIT_LIBRARY AppKit) find_library(COCOA_LIBRARY Cocoa) find_library(IOKIT_LIBRARY IOKit) + find_library(SECURITY_LIBRARY SECURITY) set(viewer_LIBRARIES ${COCOA_LIBRARY} ${AGL_LIBRARY} ${IOKIT_LIBRARY} + ${SECURITY_LIBRARY} ) # Add resource files to the project. diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 6622740..606262f 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -2935,17 +2935,29 @@ std::string LLStartUp::loadPasswordFromDisk() return hashed_password; } + // UUID is 16 bytes, written into ASCII is 32 characters + // without trailing \0 + const S32 HASHED_LENGTH = 32; + std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat"); LLFILE* fp = LLFile::fopen(filepath, "rb"); /* Flawfinder: ignore */ if (!fp) { +#if LL_DARWIN + UInt32 passwordLength; + char *passwordData; + OSStatus stat = SecKeychainFindGenericPassword(NULL, 10, "Imprudence", 0, NULL, &passwordLength, (void**)&passwordData, NULL); + if (stat == noErr) + { + if (passwordLength == HASHED_LENGTH) + hashed_password.assign(passwordData, HASHED_LENGTH); + SecKeychainItemFreeContent(NULL, passwordData); + } +#endif return hashed_password; } - // UUID is 16 bytes, written into ASCII is 32 characters - // without trailing \0 - const S32 HASHED_LENGTH = 32; U8 buffer[HASHED_LENGTH+1]; if (1 != fread(buffer, HASHED_LENGTH, 1, fp)) @@ -2969,6 +2981,10 @@ std::string LLStartUp::loadPasswordFromDisk() { hashed_password.assign((char*)buffer); } +#if LL_DARWIN + // we're migrating to the keychain + LLFile::remove(filepath); +#endif return hashed_password; } @@ -2977,6 +2993,19 @@ std::string LLStartUp::loadPasswordFromDisk() // static void LLStartUp::savePasswordToDisk(const std::string& hashed_password) { +#if LL_DARWIN + SecKeychainItemRef keychainItem; + OSStatus status = SecKeychainFindGenericPassword(NULL, 10, "Imprudence", 0, NULL, NULL, NULL, &keychainItem); + if (status == noErr) + { + SecKeychainItemModifyAttributesAndData(keychainItem, NULL, hashed_password.length(), hashed_password.c_str()); + CFRelease(keychainItem); + } + else + { + SecKeychainAddGenericPassword(NULL, 10, "Imprudence", 0, NULL, hashed_password.length(), hashed_password.c_str(), NULL); + } +#else std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat"); LLFILE* fp = LLFile::fopen(filepath, "wb"); /* Flawfinder: ignore */ @@ -3000,12 +3029,22 @@ void LLStartUp::savePasswordToDisk(const std::string& hashed_password) } fclose(fp); +#endif } // static void LLStartUp::deletePasswordFromDisk() { +#if LL_DARWIN + SecKeychainItemRef keychainItem; + OSStatus status = SecKeychainFindGenericPassword(NULL, 10, "Imprudence", 0, NULL, NULL, NULL, &keychainItem); + if (status == noErr) + { + SecKeychainItemDelete(keychainItem); + CFRelease(keychainItem); + } +#endif std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat"); LLFile::remove(filepath); -- cgit v1.1 From 0819763a22fa70a3808197ed5bedf0a98ccf1293 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 8 Sep 2010 01:17:37 -0700 Subject: Replace '>' glyph in cascading menus with a proper triangle(backport from Viewer 2) --- linden/indra/llui/llmenugl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden/indra') diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp index e00700a..8bca58a 100644 --- a/linden/indra/llui/llmenugl.cpp +++ b/linden/indra/llui/llmenugl.cpp @@ -102,7 +102,7 @@ const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10; const S32 MENU_ITEM_PADDING = 4; const std::string BOOLEAN_TRUE_PREFIX( "X" ); -const std::string BRANCH_SUFFIX( ">" ); +const std::string BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE const std::string ARROW_UP ("^^^^^^^"); const std::string ARROW_DOWN("vvvvvvv"); -- cgit v1.1 From 30fdc31be51f2e2f2629fded97658464ac37702b Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 8 Sep 2010 04:17:38 -0700 Subject: Increased max settable value for RenderVolumeLODFactor from 2 to 4 --- .../newview/skins/default/xui/en-us/panel_preferences_graphics1.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml index 153a111..72a6438 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml @@ -286,7 +286,7 @@ Value 0 + ResetFocusOnSelfClick + + Comment + Setting this to TRUE resets your camera when you left-click your avatar + Persist + 1 + Type + Boolean + Value + 0 + RezWithLandGroup Comment diff --git a/linden/indra/newview/lltoolpie.cpp b/linden/indra/newview/lltoolpie.cpp index 262c349..2887515 100644 --- a/linden/indra/newview/lltoolpie.cpp +++ b/linden/indra/newview/lltoolpie.cpp @@ -292,7 +292,10 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) gViewerWindow->hideCursor(); LLToolCamera::getInstance()->setMouseCapture(TRUE); LLToolCamera::getInstance()->pickCallback(mPick); - gAgent.setFocusOnAvatar(TRUE, TRUE); + if (gSavedSettings.getBOOL("ResetFocusOnSelfClick")) + { + gAgent.setFocusOnAvatar(TRUE, TRUE); + } return TRUE; } -- cgit v1.1 From b98e28160cfdc19cab4fba69f8aeb6c4a690e65c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 8 Sep 2010 12:34:00 -0700 Subject: Changed the menu enabled 'x' to a checkmark --- linden/indra/llui/llmenugl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden/indra') diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp index 8bca58a..91bb581 100644 --- a/linden/indra/llui/llmenugl.cpp +++ b/linden/indra/llui/llmenugl.cpp @@ -101,7 +101,7 @@ const U32 SEPARATOR_HEIGHT_PIXELS = 8; const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10; const S32 MENU_ITEM_PADDING = 4; -const std::string BOOLEAN_TRUE_PREFIX( "X" ); +const std::string BOOLEAN_TRUE_PREFIX( "\xe2\x9c\x93" ); // U+2714 -- MC const std::string BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE const std::string ARROW_UP ("^^^^^^^"); const std::string ARROW_DOWN("vvvvvvv"); -- cgit v1.1 From 8e52ade6dd3aaeb33b18d8a99a169633f472b973 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 8 Sep 2010 14:26:03 -0700 Subject: Ported use group name in chat feature from Emerald --- linden/indra/newview/app_settings/settings.xml | 11 +++++++++++ linden/indra/newview/llviewermessage.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 333a780..667f0ad 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -772,6 +772,17 @@ Value 0 + ShowGroupNameInChatIM + + Comment + Show the group name when receiving group IMs + Persist + 1 + Type + Boolean + Value + 1 + ShowMiniMapRadar Comment diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index 56aed12..ec6d4d4 100755 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -2313,7 +2313,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) position, true); - chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset); + std::string group_name; + if (gAgent.isInGroup(session_id) && gSavedSettings.getBOOL("ShowGroupNameInChatIM")) + { + group_name = std::string((char*)binary_bucket); + chat.mText = std::string("[") + group_name + std::string("] ") + name + + separator_string + saved + message.substr(message_offset); + } + else + { + chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset); + } LLFloaterChat::addChat(chat, TRUE, is_this_agent); } break; -- cgit v1.1 From e06ab7e8e6acd094d354bd5d383abc5c8869bfc9 Mon Sep 17 00:00:00 2001 From: elektrahesse Date: Tue, 7 Sep 2010 22:34:40 +0200 Subject: Made the texture fix cross platform and removed boost::filesystem dep for loaterlocalassetbrowse.cpp --- linden/indra/newview/floaterlocalassetbrowse.cpp | 25 +++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/floaterlocalassetbrowse.cpp b/linden/indra/newview/floaterlocalassetbrowse.cpp index 0ff24ca..0c313fb 100644 --- a/linden/indra/newview/floaterlocalassetbrowse.cpp +++ b/linden/indra/newview/floaterlocalassetbrowse.cpp @@ -40,12 +40,6 @@ this feature is still a work in progress. #include "llviewerprecompiledheaders.h" #include "lluictrlfactory.h" -/* boost madness from hell */ -#ifdef equivalent - #undef equivalent -#endif -#include - /* own class header && upload floater header */ #include "floaterlocalassetbrowse.h" //#include "floaterlocaluploader.h" <- in development. @@ -65,6 +59,7 @@ this feature is still a work in progress. #include "llfilepicker.h" #include "llviewermenufile.h" #include "llfloaterimagepreview.h" +#include "llfile.h" /* repeated in header */ #include "lltexturectrl.h" @@ -124,7 +119,11 @@ LocalBitmap::LocalBitmap(std::string fullpath) else { return; } // no valid extension. /* getting file's last modified */ - const std::time_t time = boost::filesystem::last_write_time( boost::filesystem::path( this->filename ) ); + + llstat temp_stat; + LLFile::stat(this->filename, &temp_stat); + std::time_t time = temp_stat.st_mtime; + this->last_modified = asctime( localtime(&time) ); /* checking if the bitmap is valid && decoding if it is */ @@ -161,7 +160,19 @@ void LocalBitmap::updateSelf() if ( !gDirUtilp->fileExists(this->filename) ) { this->linkstatus = LINK_BROKEN; return; } /* exists, let's check if it's lastmod has changed */ + std::time_t temp_time; +#ifdef LL_DARWIN + struct stat temp_stat; + stat(this->filename.c_str(), &temp_stat); + temp_time = temp_stat.st_mtime; +#else + temp_time = boost::filesystem::last_write_time( boost::filesystem::path( this->filename ) ); +#endif const std::time_t temp_time = boost::filesystem::last_write_time( boost::filesystem::path( this->filename ) ); + llstat temp_stat; + LLFile::stat(this->filename, &temp_stat); + std::time_t temp_time = temp_stat.st_mtime; + LLSD new_last_modified = asctime( localtime(&temp_time) ); if ( this->last_modified.asString() == new_last_modified.asString() ) { return; } -- cgit v1.1 From 83e9f753ea2c79fa14e0e91d38eb24edd1ea64dc Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 8 Sep 2010 17:00:34 -0700 Subject: Made the local asset texture boost change work on Windows as well --- linden/indra/newview/floaterlocalassetbrowse.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/floaterlocalassetbrowse.cpp b/linden/indra/newview/floaterlocalassetbrowse.cpp index 0c313fb..6657334 100644 --- a/linden/indra/newview/floaterlocalassetbrowse.cpp +++ b/linden/indra/newview/floaterlocalassetbrowse.cpp @@ -160,18 +160,19 @@ void LocalBitmap::updateSelf() if ( !gDirUtilp->fileExists(this->filename) ) { this->linkstatus = LINK_BROKEN; return; } /* exists, let's check if it's lastmod has changed */ - std::time_t temp_time; -#ifdef LL_DARWIN +#ifdef LL_WINDOWS + struct _stat temp_stat; + _stat(this->filename.c_str(), &temp_stat); +#else struct stat temp_stat; stat(this->filename.c_str(), &temp_stat); - temp_time = temp_stat.st_mtime; -#else - temp_time = boost::filesystem::last_write_time( boost::filesystem::path( this->filename ) ); #endif - const std::time_t temp_time = boost::filesystem::last_write_time( boost::filesystem::path( this->filename ) ); + std::time_t temp_time = temp_stat.st_mtime; + + /*const std::time_t temp_time = boost::filesystem::last_write_time( boost::filesystem::path( this->filename ) ); llstat temp_stat; LLFile::stat(this->filename, &temp_stat); - std::time_t temp_time = temp_stat.st_mtime; + std::time_t temp_time = temp_stat.st_mtime;*/ LLSD new_last_modified = asctime( localtime(&temp_time) ); if ( this->last_modified.asString() == new_last_modified.asString() ) { return; } -- cgit v1.1 From aa25ecf61b9ff876646be889a32ca9eeb2506c32 Mon Sep 17 00:00:00 2001 From: elektrahesse Date: Wed, 8 Sep 2010 01:55:28 +0200 Subject: Initial hacky release of colors in chat highlighting friend chat and when your name is typed --- linden/indra/newview/llfloaterchat.cpp | 42 +++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'linden/indra') 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 @@ #include "llfloaterhtml.h" #include "llweb.h" #include "llstylemap.h" +#include "llviewermenu.h" // Used for LCD display extern void AddNewIMToLCD(const std::string &newLine); @@ -551,19 +552,44 @@ LLColor4 get_text_color(const LLChat& chat) text_color = gSavedSettings.getColor4("SystemChatColor"); break; case CHAT_SOURCE_AGENT: - if (chat.mFromID.isNull()) { - text_color = gSavedSettings.getColor4("SystemChatColor"); - } - else - { - if(gAgent.getID() == chat.mFromID) + if (chat.mFromID.isNull()) { - text_color = gSavedSettings.getColor4("UserChatColor"); + text_color = gSavedSettings.getColor4("SystemChatColor"); } else { - text_color = gSavedSettings.getColor4("AgentChatColor"); + if(gAgent.getID() == chat.mFromID) + { + text_color = gSavedSettings.getColor4("UserChatColor"); + } + else + { + std::string my_name = gSavedSettings.getString("FirstName"); + std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); + + std::string lower_chat = std::string(chat.mText); + std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); + + std::string blank = " "; + + // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol + if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text + (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text + lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text + lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text + { + text_color = LLColor4::purple; + } + else if (is_agent_friend(chat.mFromID)) + { + text_color = LLColor4::yellow; + } + else + { + text_color = gSavedSettings.getColor4("AgentChatColor"); + } + } } } break; -- cgit v1.1 From d529e9bac87c0423baed54f2c1b20563351e9071 Mon Sep 17 00:00:00 2001 From: elektrahesse Date: Wed, 8 Sep 2010 05:03:56 +0200 Subject: Added a Extra tab in adv. preferences to enable/disable chat colors and to select the colors --- linden/indra/newview/app_settings/settings.xml | 54 ++++++++++++++++++++++ linden/indra/newview/llfloaterchat.cpp | 44 ++++++++++-------- linden/indra/newview/llprefsadvanced.cpp | 10 ++++ .../xui/en-us/panel_preferences_advanced.xml | 24 ++++++++++ 4 files changed, 112 insertions(+), 20 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 667f0ad..a459623 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -4,6 +4,60 @@ + HighlightFriendsChat + + Comment + Show chat messages from friends in a different color + Persist + 1 + Type + Boolean + Value + 1 + + FriendsChatColor + + Comment + Color of chat messages from friends + Persist + 1 + Type + Color4 + Value + + 0.699999988079 + 0.899999976158 + 0.699999988079 + 1 + + + HighlightOwnNameInChat + + Comment + Show chat messages containing your name in a different color + Persist + 1 + Type + Boolean + Value + 1 + + OwnNameChatColor + + Comment + Color of chat messages from friends + Persist + 1 + Type + Color4 + Value + + 0.8 + 1.0 + 0.8 + 1 + + AllowMUpose Comment 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) } else { - std::string my_name = gSavedSettings.getString("FirstName"); - std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); - - std::string lower_chat = std::string(chat.mText); - std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); - - std::string blank = " "; - - // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol - if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text - (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text - lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text - lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text + if (gSavedSettings.getBOOL("HighlightOwnNameInChat")) { - text_color = LLColor4::purple; + std::string my_name = gSavedSettings.getString("FirstName"); + std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); + + std::string lower_chat = std::string(chat.mText); + std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); + + std::string blank = " "; + + // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol + if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text + (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text + lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text + lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text + { + text_color = gSavedSettings.getColor4("OwnNameChatColor"); + break; + } } - else if (is_agent_friend(chat.mFromID)) - { - text_color = LLColor4::yellow; - } - else + + if (gSavedSettings.getBOOL("HighlightFriendsChat") && is_agent_friend(chat.mFromID)) { - text_color = gSavedSettings.getColor4("AgentChatColor"); + text_color = gSavedSettings.getColor4("FriendsChatColor"); + break; } + + text_color = gSavedSettings.getColor4("AgentChatColor"); } } } diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp index de39e01..695e604 100644 --- a/linden/indra/newview/llprefsadvanced.cpp +++ b/linden/indra/newview/llprefsadvanced.cpp @@ -41,6 +41,7 @@ #include "lgghunspell_wrapper.h" #include "lggautocorrectfloater.h" #include "llcombobox.h" +#include "llcolorswatch.h" #include "lluictrlfactory.h" @@ -111,6 +112,11 @@ BOOL LLPrefsAdvanced::postBuild() initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); + childSetValue("HighlightFriendsChat", gSavedSettings.getBOOL("HighlightFriendsChat")); + getChild("FriendsChatColor")->set(gSavedSettings.getColor4("FriendsChatColor")); + childSetValue("HighlightOwnNameInChat", gSavedSettings.getBOOL("HighlightOwnNameInChat")); + getChild("OwnNameChatColor")->set(gSavedSettings.getColor4("OwnNameChatColor")); + refresh(); return TRUE; @@ -133,6 +139,10 @@ void LLPrefsAdvanced::apply() gSavedSettings.setU32("LightShareAllowed", (U32)childGetValue("lightshare_combo").asInteger()); + gSavedSettings.setBOOL("HighlightFriendsChat", childGetValue("HighlightFriendsChat")); + gSavedSettings.setColor4("FriendsChatColor", getChild("FriendsChatColor")->get()); + gSavedSettings.setBOOL("HighlightOwnNameInChat", childGetValue("HighlightOwnNameInChat")); + gSavedSettings.setColor4("OwnNameChatColor", getChild("OwnNameChatColor")->get()); // Need to force a rebake when ClothingLayerProtection toggled for it take effect -- MC if (gSavedSettings.getBOOL("ShowMyClientTagToOthers") != (BOOL)childGetValue("client_name_tag_broadcast_check")) diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml index 857d1f1..65d118d 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml @@ -172,5 +172,29 @@