FIRE-805 update, don't log group notices to console, Thanks Ansariel

meow-7.2.2
Arrehn 2011-04-23 07:50:48 -07:00
parent 649318c478
commit 3ae34dadda
2 changed files with 22 additions and 126 deletions

View File

@ -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<LLScreenChannel*>(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<LLNearbyChat>("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<LLScreenChannel*>(mChannel);
if(channel)
channel->addToast(p);
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(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;
}

View File

@ -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;
};
/**