aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorelektrahesse2010-09-09 19:33:36 +0200
committerMcCabe Maxsted2010-09-10 19:11:42 -0700
commitd35cd20e170663f0d3e6d87310d26743f2b03c4f (patch)
tree62865137122a819014b913822aeaf2962a4dae53 /linden
parentFixed chat colors and added group im colors (diff)
downloadmeta-impy-d35cd20e170663f0d3e6d87310d26743f2b03c4f.zip
meta-impy-d35cd20e170663f0d3e6d87310d26743f2b03c4f.tar.gz
meta-impy-d35cd20e170663f0d3e6d87310d26743f2b03c4f.tar.bz2
meta-impy-d35cd20e170663f0d3e6d87310d26743f2b03c4f.tar.xz
Switched to boost::regex and wrote a regex supporting punctuation for name matching in both chat and group ims
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/newview/llfloaterchat.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp
index d7465fa..4be20b5 100644
--- a/linden/indra/newview/llfloaterchat.cpp
+++ b/linden/indra/newview/llfloaterchat.cpp
@@ -78,7 +78,7 @@
78#include "llstylemap.h" 78#include "llstylemap.h"
79#include "llviewermenu.h" 79#include "llviewermenu.h"
80 80
81#include "regex.h" 81#include "boost/regex.hpp"
82 82
83// Used for LCD display 83// Used for LCD display
84extern void AddNewIMToLCD(const std::string &newLine); 84extern void AddNewIMToLCD(const std::string &newLine);
@@ -456,7 +456,12 @@ void LLFloaterChat::updateSettings()
456BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line) 456BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line)
457{ 457{
458 std::string my_name = gSavedSettings.getString("FirstName"); 458 std::string my_name = gSavedSettings.getString("FirstName");
459 std::string pattern_s = "(^|.*[\\.\\?!:;\\*\\(\\s]+)(" + my_name + ")([,\\.\\?!:;\\*\\)\\s]+.*|$)";
460 boost::smatch what;
461 boost::regex e1(pattern_s, boost::regex::icase);
462 return boost::regex_search(text_line, what, e1);
459 463
464/*
460 std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); 465 std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower);
461 466
462 std::string lower_chat = std::string(text_line); 467 std::string lower_chat = std::string(text_line);
@@ -473,6 +478,9 @@ BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line)
473 return TRUE; 478 return TRUE;
474 } 479 }
475 480
481 return FALSE;
482*/
483
476/* 484/*
477 regex_t compiled; 485 regex_t compiled;
478 // ^.*([\.\?!:;\*\(\s]+)(elektra)([,\.\?!:;\*\)\s$]+).* <--- this works :) 486 // ^.*([\.\?!:;\*\(\s]+)(elektra)([,\.\?!:;\*\)\s$]+).* <--- this works :)
@@ -483,8 +491,9 @@ BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line)
483 491
484 if (regexec(&compiled, text_line.c_str(), 0, NULL, 0) == 0) 492 if (regexec(&compiled, text_line.c_str(), 0, NULL, 0) == 0)
485 return TRUE; 493 return TRUE;
486*/ 494
487 return FALSE; 495 return FALSE;
496*/
488} 497}
489 498
490LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor) 499LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor)