//----------------------------------------------------------------------------------------------- //LLNearbyChatHandler //----------------------------------------------------------------------------------------------- LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& id) { mType = type; // Getting a Channel for our notifications LLNearbyChatScreenChannel* channel = new LLNearbyChatScreenChannel(LLUUID(gSavedSettings.getString("NearByChatChannelUUID"))); LLNearbyChatScreenChannel::create_toast_panel_callback_t callback = createToastPanel; channel->setCreatePanelCallback(callback); mChannel = LLChannelManager::getInstance()->addChannel(channel); }
LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& id) { mType = type; // Getting a Channel for our notifications LLNearbyChatScreenChannel::Params p; p.id = LLUUID(gSavedSettings.getString("NearByChatChannelUUID")); LLNearbyChatScreenChannel* channel = new LLNearbyChatScreenChannel(p); LLNearbyChatScreenChannel::create_toast_panel_callback_t callback = createToastPanel; channel->setCreatePanelCallback(callback); LLChannelManager::getInstance()->addChannel(channel); mChannel = channel->getHandle(); FSUseNearbyChatConsole = gSavedSettings.getBOOL("FSUseNearbyChatConsole"); gSavedSettings.getControl("FSUseNearbyChatConsole")->getSignal()->connect(boost::bind(&LLNearbyChatHandler::updateFSUseNearbyChatConsole, this, _2)); }
void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) { if(chat_msg.mMuted == TRUE) return; if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull()) LLRecentPeople::instance().add(chat_msg.mFromID); if(chat_msg.mText.empty()) return;//don't process empty messages LLChat& tmp_chat = const_cast<LLChat&>(chat_msg); LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); { //sometimes its usefull to have no name at all... //if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null) // tmp_chat.mFromName = tmp_chat.mFromID.asString(); } nearby_chat->addMessage(chat_msg, true, args); if( nearby_chat->getVisible() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) ) return;//no need in toast if chat is visible or if bubble chat is enabled // Handle irc styled messages for toast panel if (tmp_chat.mChatStyle == CHAT_STYLE_IRC) { if(!tmp_chat.mFromName.empty()) tmp_chat.mText = tmp_chat.mFromName + tmp_chat.mText.substr(3); else tmp_chat.mText = tmp_chat.mText.substr(3); } // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } /* //comment all this due to EXT-4432 ..may clean up after some time... //only messages from AGENTS if(CHAT_SOURCE_OBJECT == chat_msg.mSourceType) { if(chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) return;//ok for now we don't skip messeges from object, so skip only debug messages } */ LLUUID id; id.generate(); LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel); if(channel) { LLSD notification; notification["id"] = id; notification["message"] = chat_msg.mText; notification["from"] = chat_msg.mFromName; notification["from_id"] = chat_msg.mFromID; notification["time"] = chat_msg.mTime; notification["source"] = (S32)chat_msg.mSourceType; notification["chat_type"] = (S32)chat_msg.mChatType; notification["chat_style"] = (S32)chat_msg.mChatStyle; std::string r_color_name = "White"; F32 r_color_alpha = 1.0f; LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); notification["text_color"] = r_color_name; notification["color_alpha"] = r_color_alpha; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; channel->addNotification(notification); } }
// virtual void LLNearbyChatToast::onClose(bool app_quitting) { mNearbyChatScreenChannelp->onToastDestroyed(this, app_quitting); }
void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) { if(chat_msg.mMuted == TRUE) // <FS:Ansariel> Optional muted chat history //return; { LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD()); // ## Zi - Post merge fixup ## nearby_chat->addMessage(chat_msg, true, args); return; } // </FS:Ansariel> Optional muted chat history if(chat_msg.mText.empty()) return;//don't process empty messages LLChat& tmp_chat = const_cast<LLChat&>(chat_msg); // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f if (rlv_handler_t::isEnabled()) { // NOTE-RLVa: we can only filter the *message* here since most everything else will already be part of "args" as well if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!tmp_chat.mRlvLocFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) { RlvUtil::filterLocation(tmp_chat.mText); tmp_chat.mRlvLocFiltered = TRUE; } if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!tmp_chat.mRlvNamesFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) { RlvUtil::filterNames(tmp_chat.mText); tmp_chat.mRlvNamesFiltered = TRUE; } } // [/RLVa:KB] // ## Zi - Post merge fixup ## // LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); // ## Zi - Post merge fixup ## // LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat"); LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD()); // ## Zi - Post merge fixup ## // Build notification data LLSD notification; notification["message"] = chat_msg.mText; notification["from"] = chat_msg.mFromName; notification["from_id"] = chat_msg.mFromID; notification["time"] = chat_msg.mTime; notification["source"] = (S32)chat_msg.mSourceType; notification["chat_type"] = (S32)chat_msg.mChatType; notification["chat_style"] = (S32)chat_msg.mChatStyle; // Pass sender info so that it can be rendered properly (STORM-1021). // notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); // [RLVa:KB] - Checked: 2011-12-13 (RLVa-1.4.6) | Added: RLVa-1.4.6 if ((CHAT_SOURCE_AGENT != chat_msg.mSourceType) || (!chat_msg.mRlvNamesFiltered)) notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); // [/RLVa:KB] if (chat_msg.mChatType == CHAT_TYPE_DIRECT && chat_msg.mText.length() > 0 && chat_msg.mText[0] == '@') { // Send event on to LLEventStream and exit sChatWatcher->post(notification); return; } // don't show toast and add message to chat history on receive debug message // with disabled setting showing script errors or enabled setting to show script // errors in separate window. if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) { if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) return; // don't process debug messages from not owned objects, see EXT-7762 if (gAgentID != chat_msg.mOwnerID) { return; } if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat")) { LLColor4 txt_color; LLViewerChat::getChatColor(chat_msg,txt_color); LLFloaterScriptDebug::addScriptLine(chat_msg.mText, chat_msg.mFromName, txt_color, chat_msg.mFromID); return; } } nearby_chat->addMessage(chat_msg, true, args); // Handle irc styled messages for toast panel // HACK ALERT - changes mText, stripping out IRC style "/me" prefixes if ((tmp_chat.mChatStyle == CHAT_STYLE_IRC) && !FSUseNearbyChatConsole) { if(!tmp_chat.mFromName.empty()) tmp_chat.mText = tmp_chat.mFromName + tmp_chat.mText.substr(3); else tmp_chat.mText = tmp_chat.mText.substr(3); } if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull() && chat_msg.mFromID != gAgentID) { LLFirstUse::otherAvatarChatFirst(); // Add sender to the recent people list. // [RLVa:KB] - Checked: 2012-03-15 (RLVa-1.4.6) | Added: RLVa-1.4.6 if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) LLRecentPeople::instance().add(chat_msg.mFromID); // [/RLVa:KB] // LLRecentPeople::instance().add(chat_msg.mFromID); } // Send event on to LLEventStream sChatWatcher->post(notification); static LLCachedControl<bool> useChatBubbles(gSavedSettings, "UseChatBubbles"); if( ( nearby_chat->getVisible() && !FSUseNearbyChatConsole) // Ansariel: If nearby chat not visible but we use the console, proceed! || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && useChatBubbles ) || mChannel.isDead() || !mChannel.get()->getShowToasts() ) // to prevent toasts in Busy mode return;//no need in toast if chat is visible or if bubble chat is enabled // Ansariel: Use either old style chat output to console or toasts if (FSUseNearbyChatConsole) { // Don't write to console if avatar chat and user wants // bubble chat or if the user is busy. if ( (chat_msg.mSourceType == CHAT_SOURCE_AGENT && useChatBubbles) || gAgent.getBusy() ) return; std::string consoleChat; if (chat_msg.mSourceType == CHAT_SOURCE_AGENT) { LLAvatarNameCache::get(chat_msg.mFromID, boost::bind(&LLNearbyChatHandler::onAvatarNameLookup, this, _1, _2, chat_msg)); } else if (chat_msg.mSourceType == CHAT_SOURCE_OBJECT) { std::string senderName(chat_msg.mFromName); std::string prefix = chat_msg.mText.substr(0, 4); LLStringUtil::toLower(prefix); //IRC styled /me messages. bool irc_me = prefix == "/me " || prefix == "/me'"; // Delimiter after a name in header copy/past and in plain text mode std::string delimiter = ": "; std::string shout = LLTrans::getString("shout"); std::string whisper = LLTrans::getString("whisper"); if (chat_msg.mChatType == CHAT_TYPE_SHOUT || chat_msg.mChatType == CHAT_TYPE_WHISPER || chat_msg.mText.compare(0, shout.length(), shout) == 0 || chat_msg.mText.compare(0, whisper.length(), whisper) == 0) { delimiter = " "; } // Don't add any delimiter after name in irc styled messages if (irc_me || chat_msg.mChatStyle == CHAT_STYLE_IRC) { delimiter = LLStringUtil::null; } std::string message = irc_me ? chat_msg.mText.substr(3) : chat_msg.mText; // <Ansariel> console support consoleChat = senderName + delimiter + message; LLColor4 chatcolor; LLViewerChat::getChatColor(chat_msg, chatcolor); gConsole->addConsoleLine(consoleChat, chatcolor); // </Ansariel> } else { if (chat_msg.mSourceType == CHAT_SOURCE_SYSTEM && args["type"].asInteger() == LLNotificationsUI::NT_MONEYCHAT) { consoleChat = args["console_message"].asString(); } //consoleChat = chat_msg.mText; // FS:LO FIRE-1439 - Clickable avatar names on local chat radar crossing reports else if(chat_msg.mFromName.empty()) { consoleChat = chat_msg.mText; } else { consoleChat = chat_msg.mFromName + " " + chat_msg.mText; } // FS:LO FIRE-1439 - Clickable avatar names on local chat radar crossing reports LLColor4 chatcolor; LLViewerChat::getChatColor(chat_msg, chatcolor); gConsole->addConsoleLine(consoleChat, chatcolor); gConsole->setVisible(!nearby_chat->getVisible()); } } else { // Toasts mode... // ## Zi - Post merge fixup ## // if( !chat_bar->isMinimized() && nearby_chat->getVisible() if( nearby_chat->getVisible() // ## Zi - Post merge fixup ## || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && useChatBubbles ) || mChannel.isDead() || !mChannel.get()->getShowToasts() ) // to prevent toasts in Busy mode return;//no need in toast if chat is visible or if bubble chat is enabled // arrange a channel on a screen if(!mChannel.get()->getVisible()) { initChannel(); } /* //comment all this due to EXT-4432 ..may clean up after some time... //only messages from AGENTS if(CHAT_SOURCE_OBJECT == chat_msg.mSourceType) { if(chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) return;//ok for now we don't skip messeges from object, so skip only debug messages } */ LLUUID id; id.generate(); LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel.get()); if(channel) { //LLSD notification; notification["id"] = id; // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Added: RLVa-1.2.0f if (rlv_handler_t::isEnabled()) notification["show_icon_tooltip"] = !chat_msg.mRlvNamesFiltered; // [/RLVa:KB] notification["message"] = chat_msg.mText; //notification["from"] = chat_msg.mFromName; //notification["from_id"] = chat_msg.mFromID; //notification["time"] = chat_msg.mTime; //notification["source"] = (S32)chat_msg.mSourceType; //notification["chat_type"] = (S32)chat_msg.mChatType; //notification["chat_style"] = (S32)chat_msg.mChatStyle; std::string r_color_name = "White"; F32 r_color_alpha = 1.0f; LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); notification["text_color"] = r_color_name; notification["color_alpha"] = r_color_alpha; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; channel->addNotification(notification); } } }
void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) { if(chat_msg.mMuted == TRUE) return; if(chat_msg.mText.empty()) return;//don't process empty messages LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat"); // Build notification data LLSD notification; notification["message"] = chat_msg.mText; notification["from"] = chat_msg.mFromName; notification["from_id"] = chat_msg.mFromID; notification["time"] = chat_msg.mTime; notification["source"] = (S32)chat_msg.mSourceType; notification["chat_type"] = (S32)chat_msg.mChatType; notification["chat_style"] = (S32)chat_msg.mChatStyle; // Pass sender info so that it can be rendered properly (STORM-1021). notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); if (chat_msg.mChatType == CHAT_TYPE_DIRECT && chat_msg.mText.length() > 0 && chat_msg.mText[0] == '@') { // Send event on to LLEventStream and exit sChatWatcher->post(notification); return; } // don't show toast and add message to chat history on receive debug message // with disabled setting showing script errors or enabled setting to show script // errors in separate window. if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) { if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) return; // don't process debug messages from not owned objects, see EXT-7762 if (gAgentID != chat_msg.mOwnerID) { return; } if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat")) { LLColor4 txt_color; LLViewerChat::getChatColor(chat_msg,txt_color); LLFloaterScriptDebug::addScriptLine(chat_msg.mText, chat_msg.mFromName, txt_color, chat_msg.mFromID); return; } } nearby_chat->addMessage(chat_msg, true, args); if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull() && chat_msg.mFromID != gAgentID) { LLFirstUse::otherAvatarChatFirst(); // Add sender to the recent people list. LLRecentPeople::instance().add(chat_msg.mFromID); } // Send event on to LLEventStream sChatWatcher->post(notification); if( !chat_bar->isMinimized() && nearby_chat->isInVisibleChain() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) || !mChannel->getShowToasts() ) // to prevent toasts in Busy mode return;//no need in toast if chat is visible or if bubble chat is enabled // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } /* //comment all this due to EXT-4432 ..may clean up after some time... //only messages from AGENTS if(CHAT_SOURCE_OBJECT == chat_msg.mSourceType) { if(chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) return;//ok for now we don't skip messeges from object, so skip only debug messages } */ LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel); if(channel) { // Handle IRC styled messages. std::string toast_msg; if (chat_msg.mChatStyle == CHAT_STYLE_IRC) { if (!chat_msg.mFromName.empty()) { toast_msg += chat_msg.mFromName; } toast_msg += chat_msg.mText.substr(3); } else { toast_msg = chat_msg.mText; } // Add a nearby chat toast. LLUUID id; id.generate(); notification["id"] = id; std::string r_color_name = "White"; F32 r_color_alpha = 1.0f; LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); notification["text_color"] = r_color_name; notification["color_alpha"] = r_color_alpha; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; notification["message"] = toast_msg; channel->addNotification(notification); } }
void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) { if(chat_msg.mMuted == TRUE) return; if(chat_msg.mText.empty()) return;//don't process empty messages // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f if (rlv_handler_t::isEnabled()) { // NOTE-RLVa: we can only filter the *message* here since most everything else will already be part of "args" as well LLChat& tmp_chat = const_cast<LLChat&>(chat_msg); if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!tmp_chat.mRlvLocFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) { RlvUtil::filterLocation(tmp_chat.mText); tmp_chat.mRlvLocFiltered = TRUE; } if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!tmp_chat.mRlvNamesFiltered) && (CHAT_SOURCE_AGENT != tmp_chat.mSourceType) ) { RlvUtil::filterNames(tmp_chat.mText); tmp_chat.mRlvNamesFiltered = TRUE; } } // [/RLVa:KB] LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat"); // Build notification data LLSD notification; notification["message"] = chat_msg.mText; notification["from"] = chat_msg.mFromName; notification["from_id"] = chat_msg.mFromID; notification["time"] = chat_msg.mTime; notification["source"] = (S32)chat_msg.mSourceType; notification["chat_type"] = (S32)chat_msg.mChatType; notification["chat_style"] = (S32)chat_msg.mChatStyle; // Pass sender info so that it can be rendered properly (STORM-1021). // notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); // [RLVa:KB] - Checked: 2011-12-13 (RLVa-1.4.6) | Added: RLVa-1.4.6 if ((CHAT_SOURCE_AGENT != chat_msg.mSourceType) || (!chat_msg.mRlvNamesFiltered)) notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); // [/RLVa:KB] if (chat_msg.mChatType == CHAT_TYPE_DIRECT && chat_msg.mText.length() > 0 && chat_msg.mText[0] == '@') { // Send event on to LLEventStream and exit sChatWatcher->post(notification); return; } // don't show toast and add message to chat history on receive debug message // with disabled setting showing script errors or enabled setting to show script // errors in separate window. if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) { if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) return; // don't process debug messages from not owned objects, see EXT-7762 if (gAgentID != chat_msg.mOwnerID) { return; } if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat")) { LLColor4 txt_color; LLViewerChat::getChatColor(chat_msg,txt_color); LLFloaterScriptDebug::addScriptLine(chat_msg.mText, chat_msg.mFromName, txt_color, chat_msg.mFromID); return; } } nearby_chat->addMessage(chat_msg, true, args); if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull() && chat_msg.mFromID != gAgentID) { LLFirstUse::otherAvatarChatFirst(); // Add sender to the recent people list. // [RLVa:KB] - Checked: 2012-03-15 (RLVa-1.4.6) | Added: RLVa-1.4.6 if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) LLRecentPeople::instance().add(chat_msg.mFromID); // [/RLVa:KB] // LLRecentPeople::instance().add(chat_msg.mFromID); } // Send event on to LLEventStream sChatWatcher->post(notification); if( !chat_bar->isMinimized() && nearby_chat->isInVisibleChain() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) || mChannel.isDead() || !mChannel.get()->getShowToasts() ) // to prevent toasts in Busy mode return;//no need in toast if chat is visible or if bubble chat is enabled // arrange a channel on a screen if(!mChannel.get()->getVisible()) { initChannel(); } /* //comment all this due to EXT-4432 ..may clean up after some time... //only messages from AGENTS if(CHAT_SOURCE_OBJECT == chat_msg.mSourceType) { if(chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) return;//ok for now we don't skip messeges from object, so skip only debug messages } */ LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel.get()); if(channel) { // Handle IRC styled messages. std::string toast_msg; if (chat_msg.mChatStyle == CHAT_STYLE_IRC) { if (!chat_msg.mFromName.empty()) { toast_msg += chat_msg.mFromName; } toast_msg += chat_msg.mText.substr(3); } else { toast_msg = chat_msg.mText; } // Add a nearby chat toast. LLUUID id; id.generate(); notification["id"] = id; // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Added: RLVa-1.2.0f if (rlv_handler_t::isEnabled()) notification["show_icon_tooltip"] = !chat_msg.mRlvNamesFiltered; // [/RLVa:KB] std::string r_color_name = "White"; F32 r_color_alpha = 1.0f; LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); notification["text_color"] = r_color_name; notification["color_alpha"] = r_color_alpha; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; notification["message"] = toast_msg; channel->addNotification(notification); } }