From c16224d6b170cce51c124ce8abfc4dc594780447 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Sun, 18 Jul 2010 00:07:47 +0200 Subject: Henri Beauchamp: MU* pose style and (( auto close --- linden/indra/newview/app_settings/settings.xml | 27 ++++++++++++++++++++ linden/indra/newview/llchatbar.cpp | 30 ++++++++++++++++++++++ linden/indra/newview/llimpanel.cpp | 35 +++++++++++++++++++++++++- 3 files changed, 91 insertions(+), 1 deletion(-) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index fa2a400..4c9de12 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -1283,6 +1283,33 @@ Value 0 + + + AllowMUpose + + Comment + Allow MU* pose style in chat and IM (with ':' as a synonymous to '/me ') + Persist + 1 + Type + Boolean + Value + 1 + + ChatVisible + AutoCloseOOC + + Comment + Auto-close OOC chat (i.e. add \"))\" if not found and \"((\" was used) + Persist + 1 + Type + Boolean + Value + 1 + + + AllowIdleAFK Comment diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp index 8401138..bbf6b04 100644 --- a/linden/indra/newview/llchatbar.cpp +++ b/linden/indra/newview/llchatbar.cpp @@ -410,6 +410,36 @@ void LLChatBar::sendChat( EChatType type ) std::string utf8_revised_text; if (0 == channel) { + if (gSavedSettings.getBOOL("AutoCloseOOC")) + { + // Try to find any unclosed OOC chat (i.e. an opening + // double parenthesis without a matching closing double + // parenthesis. + if (utf8text.find("((") != -1 && utf8text.find("))") == -1) + { + if (utf8text.at(utf8text.length() - 1) == ')') + { + // cosmetic: add a space first to avoid a closing triple parenthesis + utf8text += " "; + } + // add the missing closing double parenthesis. + utf8text += "))"; + } + } + + // Convert MU*s style poses into IRC emotes here. + if (gSavedSettings.getBOOL("AllowMUpose") && utf8text.find(":") == 0 && utf8text.length() > 3) + { + if (utf8text.find(":'") == 0) + { + utf8text.replace(0, 1, "/me"); + } + else if (isalpha(utf8text.at(1))) // Do not prevent smileys and such. + { + utf8text.replace(0, 1, "/me "); + } + } + // discard returned "found" boolean gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text); } diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index 9a044d7..be6df5b 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp @@ -2107,8 +2107,41 @@ void LLFloaterIMPanel::sendMsg() { // store sent line in history, duplicates will get filtered if (mInputEditor) mInputEditor->updateHistory(); - // Truncate and convert to UTF8 for transport + + // Convert to UTF8 for transport std::string utf8_text = wstring_to_utf8str(text); + + if (gSavedSettings.getBOOL("AutoCloseOOC")) + { + // Try to find any unclosed OOC chat (i.e. an opening + // double parenthesis without a matching closing double + // parenthesis. + if (utf8_text.find("((") != -1 && utf8_text.find("))") == -1) + { + if (utf8_text.at(utf8_text.length() - 1) == ')') + { + // cosmetic: add a space first to avoid a closing triple parenthesis + utf8_text += " "; + } + // add the missing closing double parenthesis. + utf8_text += "))"; + } + } + + // Convert MU*s style poses into IRC emotes here. + if (gSavedSettings.getBOOL("AllowMUpose") && utf8_text.find(":") == 0 && utf8_text.length() > 3) + { + if (utf8_text.find(":'") == 0) + { + utf8_text.replace(0, 1, "/me"); + } + else if (isalpha(utf8_text.at(1))) // Do not prevent smileys and such. + { + utf8_text.replace(0, 1, "/me "); + } + } + + // Truncate and convert to UTF8 for transport utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-1.0.0g -- cgit v1.1