void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name) { // start tab flashing when receiving im for background session from user if (source != LLUUID::null) { LLMultiFloater* hostp = getHost(); if( !isInVisibleChain() && hostp && source != gAgent.getID()) { hostp->setFloaterFlashing(this, TRUE); } } // Now we're adding the actual line of text, so erase the // "Foo is typing..." text segment, and the optional timestamp // if it was present. JC removeTypingIndicator(NULL); // Actually add the line std::string timestring; bool prepend_newline = true; if (gSavedSettings.getBOOL("IMShowTimestamps")) { timestring = mHistoryEditor->appendTime(prepend_newline); prepend_newline = false; } std::string separator_string(": "); // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. if (!name.empty()) // If name exists, then add it to the front of the message. { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if (name == SYSTEM_FROM) { mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color)); } else { // Convert the name to a hotlink and add to message. mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source)); } prepend_newline = false; } mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color)); mHistoryEditor->blockUndo(); if (!isInVisibleChain()) { mNumUnreadMessages++; } }
void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) { if ( typing ) { // other user started typing addTypingIndicator(im_info); } else { // other user stopped typing removeTypingIndicator(im_info); } }
void LLFloaterIMPanel::processIMTyping(const LLIMInfo* im_info, bool typing) { if (typing) { // other user started typing std::string name; if (!LLAvatarNameCache::getPNSName(im_info->mFromID, name)) name = im_info->mName; addTypingIndicator(name); } else { // other user stopped typing removeTypingIndicator(im_info); } }
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incolor, bool log_to_file, const LLUUID& source, const std::string& name) { static const LLCachedControl<bool> mKeywordsChangeColor(gSavedPerAccountSettings, "KeywordsChangeColor", false); static const LLCachedControl<LLColor4> mKeywordsColor(gSavedPerAccountSettings, "KeywordsColor", LLColor4(1.f, 1.f, 1.f, 1.f)); if (gAgentID != source) { if (mKeywordsChangeColor) { if (AscentKeyword::hasKeyword(utf8msg, 2)) { incolor = mKeywordsColor; } } if (mDing && (!hasFocus() || !gFocusMgr.getAppHasFocus())) { static const LLCachedControl<std::string> ding("LiruNewMessageSound"); static const LLCachedControl<std::string> dong("LiruNewMessageSoundForSystemMessages"); LLUI::sAudioCallback(LLUUID(source.notNull() ? ding : dong)); } } const LLColor4& color = incolor; // start tab flashing when receiving im for background session from user if (source.notNull()) { LLMultiFloater* hostp = getHost(); if( !isInVisibleChain() && hostp && source != gAgentID) { hostp->setFloaterFlashing(this, TRUE); } } // Now we're adding the actual line of text, so erase the // "Foo is typing..." text segment, and the optional timestamp // if it was present. JC removeTypingIndicator(NULL); // Actually add the line bool prepend_newline = true; if (gSavedSettings.getBOOL("IMShowTimestamps")) { mHistoryEditor->appendTime(prepend_newline); prepend_newline = false; } std::string show_name = name; bool is_irc = false; // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. if (!name.empty()) // If name exists, then add it to the front of the message. { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if (name == SYSTEM_FROM) { mHistoryEditor->appendColoredText(name,false,prepend_newline,color); } else { // IRC style text starts with a colon here; empty names and system messages aren't irc style. static const LLCachedControl<bool> italicize("LiruItalicizeActions"); is_irc = italicize && utf8msg[0] != ':'; if (source.notNull()) LLAvatarNameCache::getPNSName(source, show_name); // Convert the name to a hotlink and add to message. LLStyleSP source_style = LLStyleMap::instance().lookupAgent(source); source_style->mItalic = is_irc; mHistoryEditor->appendStyledText(show_name,false,prepend_newline,source_style); } prepend_newline = false; } // Append the chat message in style { LLStyleSP style(new LLStyle); style->setColor(color); style->mItalic = is_irc; style->mBold = gSavedSettings.getBOOL("SingularityBoldGroupModerator") && isModerator(source); mHistoryEditor->appendStyledText(utf8msg, false, prepend_newline, style); } if (log_to_file && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) { std::string histstr; if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + show_name + utf8msg; else histstr = show_name + utf8msg; // [Ansariel: Display name support] // Floater title contains display name -> bad idea to use that as filename // mLogLabel, however, is the old legacy name //LLLogChat::saveHistory(getTitle(),histstr); LLLogChat::saveHistory(mLogLabel, histstr); // [/Ansariel: Display name support] } if (source.notNull()) { if (!isInVisibleChain() || (!hasFocus() && getParent() == gFloaterView)) { mNumUnreadMessages++; } mSpeakers->speakerChatted(source); mSpeakers->setSpeakerTyping(source, FALSE); } }