Skip to content
Snippets Groups Projects
Commit 45229637 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add auto-close OOC and option to disable mupose chat

parent 3816ece8
No related branches found
No related tags found
No related merge requests found
......@@ -992,6 +992,28 @@
<key>Value</key>
<boolean>1</boolean>
</map>
<key>EnableAutoCloseOOC</key>
<map>
<key>Comment</key>
<string>Auto-close ((OOC)) parentheses</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>EnableMUPoseChat</key>
<map>
<key>Comment</key>
<string>: as a synonym for /me</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>GroupSnoozeTime</key>
<map>
<key>Comment</key>
......
......@@ -615,6 +615,7 @@ void LLFloaterIMNearbyChat::sendChat( EChatType type )
std::string utf8_revised_text;
if (0 == channel)
{
applyOOCClose(utf8text);
applyMUPose(utf8text);
// discard returned "found" boolean
......
......@@ -321,6 +321,7 @@ void LLFloaterIMSession::sendMsgFromInputEditor()
{
// Truncate and convert to UTF8 for transport
std::string utf8_text = wstring_to_utf8str(text);
applyOOCClose(utf8_text);
applyMUPose(utf8_text);
sendMsg(utf8_text);
......
......@@ -1183,9 +1183,12 @@ LLView* LLFloaterIMSessionTab::getChatHistory()
return mChatHistory;
}
// virtual
void LLFloaterIMSessionTab::applyMUPose(std::string& text)
{
if (!gSavedSettings.getBOOL("EnableMUPoseChat"))
{
return;
}
if (text.at(0) == ':'
&& text.length() > 3)
{
......@@ -1203,6 +1206,48 @@ void LLFloaterIMSessionTab::applyMUPose(std::string& text)
}
}
void LLFloaterIMSessionTab::applyOOCClose(std::string& message)
{
if (!gSavedSettings.getBOOL("EnableAutoCloseOOC"))
{
return;
}
// Try to find any unclosed OOC chat (i.e. an opening
// double parenthesis without a matching closing double
// parenthesis.
if (message.find("(( ") != std::string::npos && message.find("))") == std::string::npos)
{
// add the missing closing double parenthesis.
message.append(" ))");
}
else if (message.find("((") != std::string::npos && message.find("))") == std::string::npos)
{
if (message.at(message.length() - 1) == ')')
{
// cosmetic: add a space first to avoid a closing triple parenthesis
message.append(" ");
}
// add the missing closing double parenthesis.
message.append("))");
}
else if (message.find("[[ ") != std::string::npos && message.find("]]") == std::string::npos)
{
// add the missing closing double parenthesis.
message.append(" ]]");
}
else if (message.find("[[") != std::string::npos && message.find("]]") == std::string::npos)
{
if (message.at(message.length() - 1) == ']')
{
// cosmetic: add a space first to avoid a closing triple parenthesis
message.append(" ");
}
// add the missing closing double parenthesis.
message.append("]]");
}
}
BOOL LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask )
{
BOOL handled = FALSE;
......
......@@ -145,7 +145,8 @@ class LLFloaterIMSessionTab
std::string appendTime();
void assignResizeLimits();
virtual void applyMUPose(std::string& text);
void applyMUPose(std::string& text);
void applyOOCClose(std::string& text);
S32 mFloaterExtraWidth;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment