// virtual BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; // ALT-RETURN is reserved for windowed/fullscreen toggle if( KEY_RETURN == key ) { if (mask == MASK_CONTROL) { // shout sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } else if (mask == MASK_NONE) { // say sendChat( CHAT_TYPE_NORMAL ); handled = TRUE; } } // only do this in main chatbar else if ( KEY_ESCAPE == key && gChatBar == this) { stopChat(); handled = TRUE; } return handled; }
// <dogmode> void LLChatBar::sendChat( EChatType type ) { if (mInputEditor) { LLWString text = mInputEditor->getConvertedText(); if (!text.empty()) { // store sent line in history, duplicates will get filtered if (mInputEditor) mInputEditor->updateHistory(); S32 channel = 0; stripChannelNumber(text, &channel); std::string utf8text = wstring_to_utf8str(text);//+" and read is "+llformat("%f",readChan)+" and undone is "+llformat("%d",undoneChan)+" but actualy channel is "+llformat("%d",channel); // Try to trigger a gesture, if not chat to a script. std::string utf8_revised_text; if (0 == channel) { convert_roleplay_text(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(type == CHAT_TYPE_OOC ? CHAT_TYPE_NORMAL : type); if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, nType)) { // Chat with animation #if SHY_MOD //Command handler if(!SHCommandHandler::handleCommand(true, utf8_revised_text, gAgentID, (LLViewerObject*)gAgentAvatarp))//returns true if handled #endif //shy_mod sendChatFromViewer(utf8_revised_text, nType, TRUE); } } } childSetValue("Chat Editor", LLStringUtil::null); gAgent.stopTyping(); // If the user wants to stop chatting on hitting return, lose focus // and go out of chat mode. if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn")) { stopChat(); } }
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 LLChatBar::sendChat( EChatType type ) { if (mInputEditor) { LLWString text = mInputEditor->getConvertedText(); if (!text.empty()) { // store sent line in history, duplicates will get filtered if (mInputEditor) mInputEditor->updateHistory(); // Check if this is destined for another channel S32 channel = mChanCtrlEnabled ? (S32)(mChannelControl->get()) : 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 gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text); } else { utf8_revised_text = utf8text; } utf8_revised_text = utf8str_trim(utf8_revised_text); if (!utf8_revised_text.empty()) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, TRUE); } } } childSetValue("Chat Editor", LLStringUtil::null); gAgent.stopTyping(); // If the user wants to stop chatting on hitting return, lose focus // and go out of chat mode. if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn")) { stopChat(); } }
void LLChatBar::sendChat( EChatType type ) { if (mInputEditor) { LLWString text = mInputEditor->getConvertedText(); if (!text.empty()) { // store sent line in history, duplicates will get filtered if (mInputEditor) mInputEditor->updateHistory(); // Check if this is destined for another channel S32 channel = mChanCtrlEnabled ? (S32)(mChannelControl->get()) : 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) { 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); } else { utf8_revised_text = utf8text; } utf8_revised_text = utf8str_trim(utf8_revised_text); if (!utf8_revised_text.empty()) if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) { // Chat with animation sendChatFromViewer(utf8_revised_text, type, TRUE); } } } childSetValue("Chat Editor", LLStringUtil::null); gAgent.stopTyping(); // If the user wants to stop chatting on hitting return, lose focus // and go out of chat mode. if (gChatBar == this && 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(); } }
// <dogmode> void LLChatBar::sendChat( EChatType type ) { if (mInputEditor) { LLWString text = mInputEditor->getConvertedText(); if (!text.empty()) { // store sent line in history, duplicates will get filtered if (mInputEditor) mInputEditor->updateHistory(); S32 channel = 0; stripChannelNumber(text, &channel); std::string utf8text = wstring_to_utf8str(text);//+" and read is "+llformat("%f",readChan)+" and undone is "+llformat("%d",undoneChan)+" but actualy channel is "+llformat("%d",channel); // Try to trigger a gesture, if not chat to a script. std::string utf8_revised_text; if (0 == channel) { if (gSavedSettings.getBOOL("AscentAutoCloseOOC") && (utf8text.length() > 1)) { // Chalice - OOC autoclosing patch based on code by Henri Beauchamp int needsClosingType=0; //Check if it needs the end-of-chat brackets -HgB if (utf8text.find("((") == 0 && utf8text.find("))") == -1) { if(utf8text.at(utf8text.length() - 1) == ')') utf8text+=" "; utf8text+="))"; } else if(utf8text.find("[[") == 0 && utf8text.find("]]") == -1) { if(utf8text.at(utf8text.length() - 1) == ']') utf8text+=" "; utf8text+="]]"; } //Check if it needs the start-of-chat brackets -HgB needsClosingType=0; if (utf8text.find("((") == -1 && utf8text.find("))") == (utf8text.length() - 2)) { if(utf8text.at(0) == '(') utf8text.insert(0," "); utf8text.insert(0,"(("); } else if (utf8text.find("[[") == -1 && utf8text.find("]]") == (utf8text.length() - 2)) { if(utf8text.at(0) == '[') utf8text.insert(0," "); utf8text.insert(0,"[["); } } // Convert MU*s style poses into IRC emotes here. if (gSavedSettings.getBOOL("AscentAllowMUpose") && 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 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; if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, nType)) { // Chat with animation #if SHY_MOD //Command handler if(!SHCommandHandler::handleCommand(true, utf8_revised_text, gAgentID, (LLViewerObject*)gAgentAvatarp))//returns true if handled #endif //shy_mod sendChatFromViewer(utf8_revised_text, nType, TRUE); } } } childSetValue("Chat Editor", LLStringUtil::null); gAgent.stopTyping(); // If the user wants to stop chatting on hitting return, lose focus // and go out of chat mode. if (gChatBar == this && 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(); } }
// virtual BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; // ALT-RETURN is reserved for windowed/fullscreen toggle if( KEY_RETURN == key ) { if (mask == MASK_CONTROL) { // shout sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } else if (mask == MASK_SHIFT) { // whisper sendChat( CHAT_TYPE_WHISPER ); handled = TRUE; } else if (mask == MASK_NONE) { // say sendChat( CHAT_TYPE_NORMAL ); handled = TRUE; } } // only do this in main chatbar else if (KEY_ESCAPE == key && mask == MASK_NONE && gChatBar == this) { stopChat(); handled = TRUE; } else if (key == KEY_TAB) { if (mInputEditor) { mInputEditor->deleteSelection(); // Clean up prev completion before attempting a new one std::string txt(mInputEditor->getText()); std::vector<LLUUID> avatar_ids; std::vector<LLVector3d> positions; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); if (!avatar_ids.empty() && !txt.empty()) { if (mCompletionHolder.cursorPos == -1) // Ele: cache cursor position mCompletionHolder.cursorPos = mInputEditor->getCursor(); if (mCompletionHolder.last_txt != mInputEditor->getText()) { mCompletionHolder.last_txt = std::string(mInputEditor->getText()); if (mCompletionHolder.cursorPos < (S32)txt.length()) { mCompletionHolder.right = txt.substr(mCompletionHolder.cursorPos); mCompletionHolder.left = txt.substr(0, mCompletionHolder.cursorPos); mCompletionHolder.match = std::string(mCompletionHolder.left); } else { mCompletionHolder.right = ""; mCompletionHolder.match = std::string(txt); mCompletionHolder.left = txt; } std::string pattern_s = "(^|.*[_=&\\|\\<\\>#@\\[\\]\\-\\+\"',\\.\\?!:;\\*\\(\\)\\s]+)([a-z0-9]+)$"; boost::match_results<std::string::const_iterator> what; boost::regex expression(pattern_s, boost::regex::icase); if (boost::regex_search(mCompletionHolder.match, what, expression, boost::match_extra)) { mCompletionHolder.match = what[2]; if (mCompletionHolder.match.length() < 1) return handled; } else return handled; } mCompletionHolder.names.clear(); for (U32 i=0; i<avatar_ids.size(); i++) { if (avatar_ids[i] == gAgent.getID() || avatar_ids[i].isNull()) continue; std::string agent_name = " "; std::string agent_surname = " "; if(!gCacheName->getName(avatar_ids[i], agent_name, agent_surname) && (agent_name == " " || agent_surname == " ")) continue; std::string test_name(agent_name); std::transform(test_name.begin(), test_name.end(), test_name.begin(), tolower); std::transform(mCompletionHolder.match.begin(), mCompletionHolder.match.end(), mCompletionHolder.match.begin(), tolower); if (test_name.find(mCompletionHolder.match) == 0) mCompletionHolder.names.push_back(agent_name); } if (mCompletionHolder.current_index >= (S32)mCompletionHolder.names.size() || mCompletionHolder.match != mCompletionHolder.last_match) { mCompletionHolder.current_index = 0; mCompletionHolder.last_match = mCompletionHolder.match; } if (mCompletionHolder.names.size() > 0) { std::string current_name = mCompletionHolder.names[mCompletionHolder.current_index]; mInputEditor->setText(mCompletionHolder.left.substr(0, mCompletionHolder.left.length() - mCompletionHolder.match.length()) + current_name + mCompletionHolder.right); mInputEditor->setCursor(mCompletionHolder.cursorPos + (current_name.length() - mCompletionHolder.match.length())); mInputEditor->setSelection(mCompletionHolder.cursorPos, mCompletionHolder.cursorPos + (current_name.length() - mCompletionHolder.match.length())); mCompletionHolder.current_index++; mCompletionHolder.selected = TRUE; return TRUE; } } } } return handled; }