diff options
author | elektrahesse | 2010-09-09 19:40:48 +0200 |
---|---|---|
committer | McCabe Maxsted | 2010-09-10 19:11:54 -0700 |
commit | 6fb57fa78c8ac2a4e356345d8e18bd4487ea9e5e (patch) | |
tree | d00befcfdc7a38b18fec331bc0fc44fb152fcc51 /linden/indra | |
parent | Switched to boost::regex and wrote a regex supporting punctuation for name ma... (diff) | |
download | meta-impy-6fb57fa78c8ac2a4e356345d8e18bd4487ea9e5e.zip meta-impy-6fb57fa78c8ac2a4e356345d8e18bd4487ea9e5e.tar.gz meta-impy-6fb57fa78c8ac2a4e356345d8e18bd4487ea9e5e.tar.bz2 meta-impy-6fb57fa78c8ac2a4e356345d8e18bd4487ea9e5e.tar.xz |
Code cleanup
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/newview/llfloaterchat.cpp | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index 4be20b5..1cf85de 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp | |||
@@ -459,41 +459,8 @@ BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line) | |||
459 | std::string pattern_s = "(^|.*[\\.\\?!:;\\*\\(\\s]+)(" + my_name + ")([,\\.\\?!:;\\*\\)\\s]+.*|$)"; | 459 | std::string pattern_s = "(^|.*[\\.\\?!:;\\*\\(\\s]+)(" + my_name + ")([,\\.\\?!:;\\*\\)\\s]+.*|$)"; |
460 | boost::smatch what; | 460 | boost::smatch what; |
461 | boost::regex e1(pattern_s, boost::regex::icase); | 461 | boost::regex e1(pattern_s, boost::regex::icase); |
462 | return boost::regex_search(text_line, what, e1); | ||
463 | |||
464 | /* | ||
465 | std::transform(my_name.begin(), my_name.end(), my_name.begin(), tolower); | ||
466 | |||
467 | std::string lower_chat = std::string(text_line); | ||
468 | std::transform(lower_chat.begin(), lower_chat.end(), lower_chat.begin(), tolower); | ||
469 | 462 | ||
470 | std::string blank = " "; | 463 | return boost::regex_search(text_line, what, e1); |
471 | |||
472 | // yes yes, this sucks, will move to a nicer regexp as soon as i have time to make it lol | ||
473 | if (lower_chat.find(my_name + blank) == 0 || // at the beginning of the text | ||
474 | (lower_chat.find(my_name) == 0 && lower_chat.length() == my_name.length()) || // only my name in the text | ||
475 | lower_chat.find(blank + my_name + blank) != std::string::npos || // my name in the middle of the text | ||
476 | lower_chat.rfind(blank + my_name) == lower_chat.length() - (blank + my_name).length()) // my name at the end of the text | ||
477 | { | ||
478 | return TRUE; | ||
479 | } | ||
480 | |||
481 | return FALSE; | ||
482 | */ | ||
483 | |||
484 | /* | ||
485 | regex_t compiled; | ||
486 | // ^.*([\.\?!:;\*\(\s]+)(elektra)([,\.\?!:;\*\)\s$]+).* <--- this works :) | ||
487 | std::string pre_pattern = "^.*([\\.\\?!:;\\*\\(\\s]+)("; | ||
488 | std::string post_pattern = ")([,\\.\\?!:;\\*\\)\\s$]+).*"; | ||
489 | std::string pattern_s = pre_pattern + my_name + post_pattern; | ||
490 | regcomp(&compiled, pattern_s.c_str(), REG_ICASE); | ||
491 | |||
492 | if (regexec(&compiled, text_line.c_str(), 0, NULL, 0) == 0) | ||
493 | return TRUE; | ||
494 | |||
495 | return FALSE; | ||
496 | */ | ||
497 | } | 464 | } |
498 | 465 | ||
499 | LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor) | 466 | LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor) |