//Generate highlight color segments for this paragraph. Pass in default color of paragraph. void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) { LLTextParser* highlight = LLTextParser::getInstance(); LLSD paragraph_color_segments; LLColor4 lcolor=color; highlight->parseFullLineHighlights(wstring_to_utf8str(mParagraphText), &lcolor); paragraph_color_segments = highlight->parsePartialLineHighlights( wstring_to_utf8str(mParagraphText), lcolor); for(LLSD::array_const_iterator color_segment_it = paragraph_color_segments.beginArray(); color_segment_it != paragraph_color_segments.endArray(); ++color_segment_it) { LLSD color_llsd = (*color_segment_it)["color"]; std::string color_str = (*color_segment_it)["text"].asString(); ParagraphColorSegment color_segment; color_segment.mColor.setValue(color_llsd); color_segment.mNumChars = color_str.length(); mParagraphColorSegments.push_back(color_segment); } }
// Put a line of chat in all the right places void LLFloaterChat::addChat(const LLChat& chat, BOOL from_instant_message, BOOL local_agent) { LLColor4 text_color = get_text_color(chat); BOOL invisible_script_debug_chat = chat.mChatType == CHAT_TYPE_DEBUG_MSG && !gSavedSettings.getBOOL("ScriptErrorsAsChat"); #if LL_LCD_COMPILE // add into LCD displays if (!invisible_script_debug_chat) { if (!from_instant_message) { AddNewChatToLCD(chat.mText); } else { AddNewIMToLCD(chat.mText); } } #endif if (!invisible_script_debug_chat && !chat.mMuted && gConsole && !local_agent) { F32 size = CHAT_MSG_SIZE; if (chat.mSourceType == CHAT_SOURCE_SYSTEM) { text_color = gSavedSettings.getColor("SystemChatColor"); } else if(from_instant_message) { text_color = gSavedSettings.getColor("IMChatColor"); size = INSTANT_MSG_SIZE; } // We display anything if it's not an IM. If it's an IM, check pref... if ( !from_instant_message || gSavedSettings.getBOOL("IMInChatConsole") ) { gConsole->addLine(chat.mText, size, text_color); } } if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) log_chat_text(chat); if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) addChatHistory(chat,false); LLTextParser* highlight = LLTextParser::getInstance(); highlight->triggerAlerts(gAgent.getID(), gAgent.getPositionGlobal(), chat.mText, gViewerWindow->getWindow()); if(!from_instant_message) addChatHistory(chat); }
// Moved from lltextparser.cpp to break llui/llaudio library dependency. //static void LLFloaterChat::triggerAlerts(const std::string& text) { // Cannot instantiate LLTextParser before logging in. if (gDirUtilp->getLindenUserDir(true).empty()) return; LLTextParser* parser = LLTextParser::getInstance(); // bool spoken=FALSE; for (S32 i=0;i<parser->mHighlights.size();i++) { LLSD& highlight = parser->mHighlights[i]; if (parser->findPattern(text,highlight) >= 0 ) { if(gAudiop) { if ((std::string)highlight["sound_lluuid"] != LLUUID::null.asString()) { if(gAudiop) gAudiop->triggerSound(highlight["sound_lluuid"].asUUID(), gAgent.getID(), 1.f, LLAudioEngine::AUDIO_TYPE_UI, gAgent.getPositionGlobal() ); } /* if (!spoken) { LLTextToSpeech* text_to_speech = NULL; text_to_speech = LLTextToSpeech::getInstance(); spoken = text_to_speech->speak((LLString)highlight["voice"],text); } */ } if (highlight["flash"]) { LLWindow* viewer_window = gViewerWindow->getWindow(); if (viewer_window && viewer_window->getMinimized()) { viewer_window->flashIcon(5.f); } } } } }
// Put a line of chat in all the right places void LLFloaterChat::addChat(const LLChat& chat, BOOL from_instant_message, BOOL local_agent) { LLColor4 text_color = get_text_color(chat); BOOL invisible_script_debug_chat = chat.mChatType == CHAT_TYPE_DEBUG_MSG && !gSavedSettings.getBOOL("ScriptErrorsAsChat"); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (rlv_handler_t::isEnabled()) { // TODO-RLVa: we might cast too broad a net by filtering here, needs testing if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!chat.mRlvLocFiltered) && (CHAT_SOURCE_AGENT != chat.mSourceType) ) { LLChat& rlvChat = const_cast<LLChat&>(chat); if (!from_instant_message) gRlvHandler.filterLocation(rlvChat.mText); rlvChat.mRlvLocFiltered = TRUE; } if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!chat.mRlvNamesFiltered) ) { LLChat& rlvChat = const_cast<LLChat&>(chat); if ( (!from_instant_message) && (CHAT_SOURCE_AGENT != chat.mSourceType) ) { // Filter object and system chat (names are filtered elsewhere to save ourselves an gObjectList lookup) gRlvHandler.filterNames(rlvChat.mText); } rlvChat.mRlvNamesFiltered = TRUE; } } // [/RLVa:KB] #if LL_LCD_COMPILE // add into LCD displays if (!invisible_script_debug_chat) { if (!from_instant_message) { AddNewChatToLCD(chat.mText); } else { AddNewIMToLCD(chat.mText); } } #endif if (!invisible_script_debug_chat && !chat.mMuted && gConsole && !local_agent) { F32 size = CHAT_MSG_SIZE; if (chat.mSourceType == CHAT_SOURCE_SYSTEM) { text_color = gSavedSettings.getColor("SystemChatColor"); } else if(from_instant_message) { text_color = gSavedSettings.getColor("IMChatColor"); size = INSTANT_MSG_SIZE; } // We display anything if it's not an IM. If it's an IM, check pref... if ( !from_instant_message || gSavedSettings.getBOOL("IMInChatConsole") ) { gConsole->addLine(chat.mText, size, text_color); } } if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) log_chat_text(chat); if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) addChatHistory(chat,false); LLTextParser* highlight = LLTextParser::getInstance(); highlight->triggerAlerts(gAgent.getID(), gAgent.getPositionGlobal(), chat.mText, gViewerWindow->getWindow()); if(!from_instant_message) addChatHistory(chat); }