void LLNearbyChatBar::sendChat( EChatType type ) { if (mChatBox) { LLWString text = mChatBox->getConvertedText(); if (!text.empty()) { // store sent line in history, duplicates will get filtered mChatBox->updateHistory(); // Check if this is destined for another channel S32 channel = 0; stripChannelNumber(text, &channel); std::string utf8text = wstring_to_utf8str(text); // Try to trigger a gesture, if not chat to a script. std::string utf8_revised_text; if (0 == channel) { // discard returned "found" boolean LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); } else { utf8_revised_text = utf8text; } utf8_revised_text = utf8str_trim(utf8_revised_text); type = processChatTypeTriggers(type, utf8_revised_text); if (!utf8_revised_text.empty()) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, TRUE); } } mChatBox->setText(LLStringExplicit("")); } gAgent.stopTyping(); // If the user wants to stop chatting on hitting return, lose focus // and go out of chat mode. if (gSavedSettings.getBOOL("CloseChatOnReturn")) { stopChat(); } }
void LLNearbyChatBar::sendChat( EChatType type ) { if (mChatBox) { LLWString text = mChatBox->getConvertedText(); if (!text.empty()) { if(type == CHAT_TYPE_OOC) { std::string tempText = mChatBox->getText(); tempText = gSavedSettings.getString("PhoenixOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("PhoenixOOCPostfix"); mChatBox->setText(tempText); text = utf8str_to_wstring(tempText); } // store sent line in history, duplicates will get filtered mChatBox->updateHistory(); // Check if this is destined for another channel S32 channel = 0; stripChannelNumber(text, &channel); std::string utf8text = wstring_to_utf8str(text); // Try to trigger a gesture, if not chat to a script. std::string utf8_revised_text; if (0 == channel) { //-TT Satomi Ahn - Patch MU_OOC 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) { // add the missing closing double parenthesis. utf8text += " ))"; } else 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 += "))"; } else if (utf8text.find("[[ ") != -1 && utf8text.find("]]") == -1) { // add the missing closing double parenthesis. utf8text += " ]]"; } else 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 "); } } //-TT Satomi Ahn - Patch MU_OOC // discard returned "found" boolean LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); } else { utf8_revised_text = utf8text; } utf8_revised_text = utf8str_trim(utf8_revised_text); EChatType nType; if(type == CHAT_TYPE_OOC) nType = CHAT_TYPE_NORMAL; else nType = type; type = processChatTypeTriggers(nType, utf8_revised_text); if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, PhoenixPlayChatAnimation); } } mChatBox->setText(LLStringExplicit("")); } gAgent.stopTyping(); // If the user wants to stop chatting on hitting return, lose focus // and go out of chat mode. if (gSavedSettings.getBOOL("CloseChatOnReturn")) { stopChat(); } }
void FSFloaterNearbyChat::sendChat( EChatType type ) { if (mInputEditor) { LLWString text = mInputEditor->getWText(); LLWStringUtil::trim(text); LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. if (!text.empty()) { if(type == CHAT_TYPE_OOC) { std::string tempText = wstring_to_utf8str( text ); tempText = gSavedSettings.getString("FSOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("FSOOCPostfix"); text = utf8str_to_wstring(tempText); } // Check if this is destined for another channel S32 channel = 0; stripChannelNumber(text, &channel); // If "/<number>" is not specified, see if a channel has been set in // the spinner. if (gSavedSettings.getBOOL("FSNearbyChatbar") && gSavedSettings.getBOOL("FSShowChatChannel") && (channel == 0)) { channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild<LLSpinCtrl>("ChatChannel")->get()); } std::string utf8text = wstring_to_utf8str(text); // Try to trigger a gesture, if not chat to a script. std::string utf8_revised_text; if (0 == channel) { // Convert OOC and MU* style poses utf8text = applyAutoCloseOoc(utf8text); utf8text = applyMuPose(utf8text); // discard returned "found" boolean LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); } else { utf8_revised_text = utf8text; } utf8_revised_text = utf8str_trim(utf8_revised_text); EChatType nType; if(type == CHAT_TYPE_OOC) nType = CHAT_TYPE_NORMAL; else nType = type; type = processChatTypeTriggers(nType, utf8_revised_text); if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim")); } } mInputEditor->setText(LLStringExplicit("")); } gAgent.stopTyping(); // If the user wants to stop chatting on hitting return, lose focus // and go out of chat mode. if (gSavedSettings.getBOOL("CloseChatOnReturn") && gSavedSettings.getBOOL("FSUnfocusChatHistoryOnReturn")) { stopChat(); } }
void FSNearbyChat::sendChat(LLWString text, EChatType type) { LLWStringUtil::trim(text); if (!text.empty()) { if (type == CHAT_TYPE_OOC) { std::string tempText = wstring_to_utf8str( text ); tempText = gSavedSettings.getString("FSOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("FSOOCPostfix"); text = utf8str_to_wstring(tempText); } // Check if this is destined for another channel S32 channel = 0; bool is_set = false; stripChannelNumber(text, &channel, &sLastSpecialChatChannel, &is_set); // If "/<number>" is not specified, see if a channel has been set in // the spinner. if (!is_set && gSavedSettings.getBOOL("FSNearbyChatbar") && gSavedSettings.getBOOL("FSShowChatChannel")) { channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild<LLSpinCtrl>("ChatChannel")->get()); } std::string utf8text = wstring_to_utf8str(text); // Try to trigger a gesture, if not chat to a script. std::string utf8_revised_text; if (0 == channel) { // Convert OOC and MU* style poses utf8text = applyAutoCloseOoc(utf8text); utf8text = applyMuPose(utf8text); // discard returned "found" boolean if(!LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text)) { utf8_revised_text = utf8text; } } else { utf8_revised_text = utf8text; } utf8_revised_text = utf8str_trim(utf8_revised_text); EChatType nType; if (type == CHAT_TYPE_OOC) { nType = CHAT_TYPE_NORMAL; } else { nType = type; } type = processChatTypeTriggers(nType, utf8_revised_text); if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim")); } } gAgent.stopTyping(); }
void LLNearbyChat::sendChat(LLWString text,EChatType type) { LLWStringUtil::trim(text); if (!text.empty()) { if(type == CHAT_TYPE_OOC) { std::string tempText = wstring_to_utf8str( text ); tempText = gSavedSettings.getString("FSOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("FSOOCPostfix"); text = utf8str_to_wstring(tempText); } // Check if this is destined for another channel S32 channel = 0; stripChannelNumber(text, &channel); // If "/<number>" is not specified, see if a channel has been set in // the spinner. if (gSavedSettings.getBOOL("FSNearbyChatbar") && gSavedSettings.getBOOL("FSShowChatChannel") && (channel == 0)) { channel = (S32)(LLFloaterNearbyChat::getInstance()->getChild<LLSpinCtrl>("ChatChannel")->get()); } std::string utf8text = wstring_to_utf8str(text); // Try to trigger a gesture, if not chat to a script. std::string utf8_revised_text; if (0 == channel) { //-TT Satomi Ahn - Patch MU_OOC 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) { // add the missing closing double parenthesis. utf8text += " ))"; } else 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 += "))"; } else if (utf8text.find("[[ ") != -1 && utf8text.find("]]") == -1) { // add the missing closing double parenthesis. utf8text += " ]]"; } else 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 (!isdigit(utf8text.at(1)) && !ispunct(utf8text.at(1)) && !isspace(utf8text.at(1))) // Do not prevent smileys and such. { utf8text.replace(0, 1, "/me "); } } //-TT Satomi Ahn - Patch MU_OOC // discard returned "found" boolean LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); } else { utf8_revised_text = utf8text; } utf8_revised_text = utf8str_trim(utf8_revised_text); EChatType nType; if(type == CHAT_TYPE_OOC) nType = CHAT_TYPE_NORMAL; else nType = type; type = processChatTypeTriggers(nType, utf8_revised_text); if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("FSPlayChatAnimation")); } } gAgent.stopTyping(); }