diff options
author | elektrahesse | 2010-09-16 20:44:00 +0200 |
---|---|---|
committer | elektrahesse | 2010-09-16 20:44:00 +0200 |
commit | 9cae845499cd22a73c9521fcc6a2a9500770bee0 (patch) | |
tree | 43c35d660c54f713459bdedf8ec035afcd1de694 /linden/indra | |
parent | Commented out the checks for distance, above 1024mts seems like i can't make ... (diff) | |
download | meta-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')
-rw-r--r-- | linden/indra/newview/app_settings/settings.xml | 33 | ||||
-rw-r--r-- | linden/indra/newview/llfloaterchat.cpp | 28 | ||||
-rw-r--r-- | linden/indra/newview/llprefsadvanced.cpp | 19 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml | 24 |
4 files changed, 98 insertions, 6 deletions
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 2b61a19..7a22e7e 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml | |||
@@ -4,6 +4,39 @@ | |||
4 | 4 | ||
5 | <!-- Imprudence-specific settings --> | 5 | <!-- Imprudence-specific settings --> |
6 | 6 | ||
7 | <key>nick01</key> | ||
8 | <map> | ||
9 | <key>Comment</key> | ||
10 | <string>First Nickname for Chat Highlight</string> | ||
11 | <key>Persist</key> | ||
12 | <integer>1</integer> | ||
13 | <key>Type</key> | ||
14 | <string>String</string> | ||
15 | <key>Value</key> | ||
16 | <string></string> | ||
17 | </map> | ||
18 | <key>nick02</key> | ||
19 | <map> | ||
20 | <key>Comment</key> | ||
21 | <string>Second Nickname for Chat Highlight</string> | ||
22 | <key>Persist</key> | ||
23 | <integer>1</integer> | ||
24 | <key>Type</key> | ||
25 | <string>String</string> | ||
26 | <key>Value</key> | ||
27 | <string></string> | ||
28 | </map> | ||
29 | <key>nick03</key> | ||
30 | <map> | ||
31 | <key>Comment</key> | ||
32 | <string>Third Nickname for Chat Highlight</string> | ||
33 | <key>Persist</key> | ||
34 | <integer>1</integer> | ||
35 | <key>Type</key> | ||
36 | <string>String</string> | ||
37 | <key>Value</key> | ||
38 | <string></string> | ||
39 | </map> | ||
7 | <key>HighlightOwnNameInIM</key> | 40 | <key>HighlightOwnNameInIM</key> |
8 | <map> | 41 | <map> |
9 | <key>Comment</key> | 42 | <key>Comment</key> |
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 | ||
456 | BOOL LLFloaterChat::isOwnNameInText(const std::string &text_line) | 456 | BOOL 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 | |||
464 | BOOL 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 | ||
466 | LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor) | 484 | LLColor4 get_extended_text_color(const LLChat& chat, LLColor4 defaultColor) |
diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp index 898ba2c..ed0b432 100644 --- a/linden/indra/newview/llprefsadvanced.cpp +++ b/linden/indra/newview/llprefsadvanced.cpp | |||
@@ -45,6 +45,8 @@ | |||
45 | 45 | ||
46 | #include "lluictrlfactory.h" | 46 | #include "lluictrlfactory.h" |
47 | 47 | ||
48 | #include "boost/algorithm/string.hpp" | ||
49 | |||
48 | LLPrefsAdvanced* LLPrefsAdvanced::sInstance; | 50 | LLPrefsAdvanced* LLPrefsAdvanced::sInstance; |
49 | 51 | ||
50 | LLPrefsAdvanced::LLPrefsAdvanced() | 52 | LLPrefsAdvanced::LLPrefsAdvanced() |
@@ -117,11 +119,14 @@ BOOL LLPrefsAdvanced::postBuild() | |||
117 | getChild<LLColorSwatchCtrl>("FriendsChatColor")->set(gSavedSettings.getColor4("FriendsChatColor")); | 119 | getChild<LLColorSwatchCtrl>("FriendsChatColor")->set(gSavedSettings.getColor4("FriendsChatColor")); |
118 | childSetValue("HighlightOwnNameInChat", gSavedSettings.getBOOL("HighlightOwnNameInChat")); | 120 | childSetValue("HighlightOwnNameInChat", gSavedSettings.getBOOL("HighlightOwnNameInChat")); |
119 | getChild<LLColorSwatchCtrl>("OwnNameChatColor")->set(gSavedSettings.getColor4("OwnNameChatColor")); | 121 | getChild<LLColorSwatchCtrl>("OwnNameChatColor")->set(gSavedSettings.getColor4("OwnNameChatColor")); |
122 | childSetValue("nick01", gSavedSettings.getString("nick01")); | ||
123 | childSetValue("nick02", gSavedSettings.getString("nick02")); | ||
124 | childSetValue("nick03", gSavedSettings.getString("nick03")); | ||
120 | 125 | ||
121 | refresh(); | 126 | refresh(); |
122 | 127 | ||
123 | return TRUE; | 128 | return TRUE; |
124 | } | 129 | } |
125 | 130 | ||
126 | void LLPrefsAdvanced::apply() | 131 | void LLPrefsAdvanced::apply() |
127 | { | 132 | { |
@@ -146,6 +151,18 @@ void LLPrefsAdvanced::apply() | |||
146 | gSavedSettings.setBOOL("HighlightOwnNameInChat", childGetValue("HighlightOwnNameInChat")); | 151 | gSavedSettings.setBOOL("HighlightOwnNameInChat", childGetValue("HighlightOwnNameInChat")); |
147 | gSavedSettings.setColor4("OwnNameChatColor", getChild<LLColorSwatchCtrl>("OwnNameChatColor")->get()); | 152 | gSavedSettings.setColor4("OwnNameChatColor", getChild<LLColorSwatchCtrl>("OwnNameChatColor")->get()); |
148 | 153 | ||
154 | std::string nick01 = childGetValue("nick01"); | ||
155 | boost::trim(nick01); | ||
156 | gSavedSettings.setString("nick01", nick01); | ||
157 | |||
158 | std::string nick02 = childGetValue("nick02"); | ||
159 | boost::trim(nick02); | ||
160 | gSavedSettings.setString("nick02", nick02); | ||
161 | |||
162 | std::string nick03 = childGetValue("nick03"); | ||
163 | boost::trim(nick03); | ||
164 | gSavedSettings.setString("nick03", nick03); | ||
165 | |||
149 | // Need to force a rebake when ClothingLayerProtection toggled for it take effect -- MC | 166 | // Need to force a rebake when ClothingLayerProtection toggled for it take effect -- MC |
150 | if (gSavedSettings.getBOOL("ShowMyClientTagToOthers") != (BOOL)childGetValue("client_name_tag_broadcast_check")) | 167 | if (gSavedSettings.getBOOL("ShowMyClientTagToOthers") != (BOOL)childGetValue("client_name_tag_broadcast_check")) |
151 | { | 168 | { |
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 073ed42..cac3ef1 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 | |||
@@ -199,6 +199,30 @@ | |||
199 | enabled="true" follows="left|top" height="67" label="Own Name" left_delta="68" | 199 | enabled="true" follows="left|top" height="67" label="Own Name" left_delta="68" |
200 | mouse_opaque="true" name="OwnNameChatColor" width="65" /> | 200 | mouse_opaque="true" name="OwnNameChatColor" width="65" /> |
201 | 201 | ||
202 | <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-50" | ||
203 | enabled="true" follows="left|top" font="SansSerif" | ||
204 | handle_edit_keys_directly="true" height="20" left_delta="0" | ||
205 | max_length="50" mouse_opaque="true" name="nick01" | ||
206 | select_all_on_focus_received="true" width="400" word_wrap="false" /> | ||
207 | |||
208 | <text bottom_delta="-3" follows="left|top" font="SansSerifSmall" height="20" left="20" name="nick01_text" width="70">Nick 1</text> | ||
209 | |||
210 | <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-30" | ||
211 | enabled="true" follows="left|top" font="SansSerif" | ||
212 | handle_edit_keys_directly="true" height="20" left_delta="60" | ||
213 | max_length="50" mouse_opaque="true" name="nick02" | ||
214 | select_all_on_focus_received="true" width="400" word_wrap="false" /> | ||
215 | |||
216 | <text bottom_delta="-3" follows="left|top" font="SansSerifSmall" height="20" left="20" name="nick02_text" width="70">Nick 2</text> | ||
217 | |||
218 | <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-30" | ||
219 | enabled="true" follows="left|top" font="SansSerif" | ||
220 | handle_edit_keys_directly="true" height="20" left_delta="60" | ||
221 | max_length="50" mouse_opaque="true" name="nick03" | ||
222 | select_all_on_focus_received="true" width="400" word_wrap="false" /> | ||
223 | |||
224 | <text bottom_delta="-3" follows="left|top" font="SansSerifSmall" height="20" left="20" name="nick03_text" width="70">Nick 3</text> | ||
225 | |||
202 | </panel> | 226 | </panel> |
203 | </tab_container> | 227 | </tab_container> |
204 | </panel> | 228 | </panel> |