From 3ae34daddae6c2e65afd89b1b74bed6cc97fec91 Mon Sep 17 00:00:00 2001 From: Arrehn Date: Sat, 23 Apr 2011 07:50:48 -0700 Subject: [PATCH] FIRE-805 update, don't log group notices to console, Thanks Ansariel --- indra/newview/llnotificationgrouphandler.cpp | 139 +++---------------- indra/newview/llnotificationhandler.h | 9 -- 2 files changed, 22 insertions(+), 126 deletions(-) diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index 4cd5b30d8f..9b7fdaef82 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -34,12 +34,6 @@ #include "llnotificationmanager.h" #include "llnotifications.h" -#include "llavatarnamecache.h" -#include "llconsole.h" -#include "llfloaterreg.h" -#include "llnearbychat.h" -#include "rlvhandler.h" - using namespace LLNotificationsUI; //-------------------------------------------------------------------------- @@ -52,9 +46,6 @@ LLGroupHandler::LLGroupHandler(e_notification_type type, const LLSD& id) LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) channel->setOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1)); - - PhoenixLogImToChatConsole = gSavedSettings.getBOOL("PhoenixLogImToChatConsole"); - gSavedSettings.getControl("PhoenixLogImToChatConsole")->getSignal()->connect(boost::bind(&LLGroupHandler::updatePhoenixLogImToChatConsole, this, _2)); } //-------------------------------------------------------------------------- @@ -62,11 +53,6 @@ LLGroupHandler::~LLGroupHandler() { } -void LLGroupHandler::updatePhoenixLogImToChatConsole(const LLSD &data) -{ - PhoenixLogImToChatConsole = data.asBoolean(); -} - //-------------------------------------------------------------------------- void LLGroupHandler::initChannel() { @@ -75,29 +61,6 @@ void LLGroupHandler::initChannel() mChannel->init(channel_right_bound - channel_width, channel_right_bound); } -void LLGroupHandler::lookupDisplayNames(const LLUUID& agent_id) -{ - LLAvatarNameCache::get(agent_id, boost::bind(&LLGroupHandler::onAvatarNameCache, this, _1, _2)); -} - -void LLGroupHandler::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) -{ - mAvatarName = av_name; -} - -bool LLGroupHandler::checkDisplayName() -{ - for (int i = 0; i <=20; i++) - { - if (mAvatarName.mDisplayName.empty()) - ms_sleep(50); - else - return true; - } - return false; -} - - //-------------------------------------------------------------------------- bool LLGroupHandler::processNotification(const LLSD& notify) { @@ -111,93 +74,35 @@ bool LLGroupHandler::processNotification(const LLSD& notify) if(!notification) return false; - if (PhoenixLogImToChatConsole && gSavedSettings.getBOOL("PhoenixUseNearbyChatConsole")) + // arrange a channel on a screen + if(!mChannel->getVisible()) { - // AO: For checking to see if we're blocking on IM-to-Console calls. Should be removed before release - llinfos << "AO DEBUG: IM2Console" << llendl; - - if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") - { - LLSD substitutions = notification->getSubstitutions(); - - // Filter notifications with empty ID and empty message - if (substitutions["FROM_ID"].asString() == "" && substitutions["MESSAGE"].asString() == "") return false; - - lookupDisplayNames(LLUUID(substitutions["FROM_ID"].asString())); - - std::string senderName; - std::string message(substitutions["MESSAGE"].asString()); - std::string delimiter = ": "; - std::string prefix = message.substr(0, 4); - LLStringUtil::toLower(prefix); - - // irc styled messages - if (prefix == "/me " || prefix == "/me'") - { - delimiter = LLStringUtil::null; - message = message.substr(3); - } - - if ((gSavedSettings.getBOOL("NameTagShowUsernames")) && (gSavedSettings.getBOOL("UseDisplayNames"))) - { - checkDisplayName(); - senderName = mAvatarName.getCompleteName(); - } - else if (gSavedSettings.getBOOL("UseDisplayNames")) - { - checkDisplayName(); - senderName = mAvatarName.mDisplayName; - } - else - { - checkDisplayName(); - senderName = mAvatarName.getLegacyName(); - } - - if (rlv_handler_t::isEnabled() && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - senderName = RlvStrings::getAnonym(senderName); - } - - gConsole->addConsoleLine("IM: " + senderName + delimiter + message, LLUIColorTable::instance().getColor("AgentChatColor")); - - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat", LLSD()); - gConsole->setVisible(!nearby_chat->getVisible()); - } + initChannel(); } - else + + if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") { + LLHandlerUtil::logGroupNoticeToIMGroup(notification); - // arrange a channel on a screen - if(!mChannel->getVisible()) - { - initChannel(); - } - - if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") - { - LLHandlerUtil::logGroupNoticeToIMGroup(notification); + LLPanel* notify_box = new LLToastGroupNotifyPanel(notification); + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1); - LLPanel* notify_box = new LLToastGroupNotifyPanel(notification); - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1); + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); + // send a signal to the counter manager + mNewNotificationSignal(); - // send a signal to the counter manager - mNewNotificationSignal(); - - LLGroupActions::refresh_notices(); - } - else if (notify["sigtype"].asString() == "delete") - { - mChannel->killToastByNotificationID(notification->getID()); - } + LLGroupActions::refresh_notices(); + } + else if (notify["sigtype"].asString() == "delete") + { + mChannel->killToastByNotificationID(notification->getID()); } return false; } diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 7892d6621b..96e44d2f2a 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -223,21 +223,12 @@ public: // base interface functions virtual bool processNotification(const LLSD& notify); - void updatePhoenixLogImToChatConsole(const LLSD &data); - protected: virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); // own handlers void onRejectToast(LLUUID& id); - - void lookupDisplayNames(const LLUUID& agent_id); - void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - bool checkDisplayName(); - - BOOL PhoenixLogImToChatConsole; - LLAvatarName mAvatarName; }; /**