aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterchat.cpp
diff options
context:
space:
mode:
authorelektrahesse2010-09-16 20:44:00 +0200
committerelektrahesse2010-09-16 20:44:00 +0200
commit9cae845499cd22a73c9521fcc6a2a9500770bee0 (patch)
tree43c35d660c54f713459bdedf8ec035afcd1de694 /linden/indra/newview/llfloaterchat.cpp
parentCommented out the checks for distance, above 1024mts seems like i can't make ... (diff)
downloadmeta-impy-9cae845499cd22a73c9521fcc6a2a9500770bee0.zip
meta-impy-9cae845499cd22a73c9521fcc6a2a9500770bee0.tar.gz
meta-impy-9cae845499cd22a73c9521fcc6a2a9500770bee0.tar.bz2
meta-impy-9cae845499cd22a73c9521fcc6a2a9500770bee0.tar.xz
Added nicknames support for chat highlighting (up to 3) in prefs->adv->extra
Diffstat (limited to 'linden/indra/newview/llfloaterchat.cpp')
-rw-r--r--linden/indra/newview/llfloaterchat.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp
index f352926..59f4d70 100644
--- a/linden/indra/newview/llfloaterchat.cpp
+++ b/linden/indra/newview/llfloaterchat.cpp
@@ -453,14 +453,32 @@ void LLFloaterChat::updateSettings()
453 LLFloaterChat::getInstance(LLSD())->getChild<LLCheckBoxCtrl>("translate chat")->set(translate_chat); 453 LLFloaterChat::getInstance(LLSD())->getChild<LLCheckBoxCtrl>("translate chat")->set(translate_chat);
454} 454}
455 455
456BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line) 456BOOL checkStringInText(const std::string &text_line, std::string textToMatch)
457{ 457{
458 std::string my_name = gSavedSettings.getString("FirstName");
459 std::string pattern_s = "(^|.*[_=&\\|\\<\\>#@\\[\\]\\-\\+\"',\\.\\?!:;\\*\\(\\)\\s]+)(" + my_name + ")([_=&\\|\\<\\>#@\\[\\]\\-\\+\"',\\.\\?!:;\\*\\(\\)\\s]+.*|$)";
460 boost::smatch what; 458 boost::smatch what;
461 boost::regex e1(pattern_s, boost::regex::icase); 459 std::string pattern_s = "(^|.*[_=&\\|\\<\\>#@\\[\\]\\-\\+\"',\\.\\?!:;\\*\\(\\)\\s]+)(" + textToMatch + ")([_=&\\|\\<\\>#@\\[\\]\\-\\+\"',\\.\\?!:;\\*\\(\\)\\s]+.*|$)";
460 boost::regex expression(pattern_s, boost::regex::icase);
461 return boost::regex_search(text_line, what, expression);
462}
463
464BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line)
465{
466 if (checkStringInText(text_line, gSavedSettings.getString("FirstName")))
467 return TRUE;
468
469 for (int i=1; i<=3; i++)
470 {
471 std::stringstream key;
472 key << "nick0" << i;
473 std::string nick = gSavedSettings.getString(key.str());
474 if (! nick.empty())
475 {
476 if (checkStringInText(text_line, nick))
477 return TRUE;
478 }
479 }
462 480
463 return boost::regex_search(text_line, what, e1); 481 return FALSE;
464} 482}
465 483
466LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor) 484LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor)