summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychathandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnearbychathandler.cpp')
-rw-r--r--indra/newview/llnearbychathandler.cpp65
1 files changed, 35 insertions, 30 deletions
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index c43c95a366..600fd395fb 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -63,7 +63,8 @@ public:
typedef std::vector<LLHandle<LLToast> > toast_vec_t;
typedef std::list<LLHandle<LLToast> > toast_list_t;
- LLNearbyChatScreenChannel(const Params& p):LLScreenChannelBase(p)
+ LLNearbyChatScreenChannel(const Params& p)
+ : LLScreenChannelBase(p)
{
mStopProcessing = false;
@@ -365,12 +366,15 @@ void LLNearbyChatScreenChannel::arrangeToasts()
if(mStopProcessing || isHovering())
return;
- LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
-
+ if (mFloaterSnapRegion == NULL)
+ {
+ mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+ }
+
if (!getParent())
{
// connect to floater snap region just to get resize events, we don't care about being a proper widget
- floater_snap_region->addChild(this);
+ mFloaterSnapRegion->addChild(this);
setFollows(FOLLOWS_ALL);
}
@@ -378,13 +382,13 @@ void LLNearbyChatScreenChannel::arrangeToasts()
updateRect();
LLRect channel_rect;
- floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &channel_rect, gFloaterView);
+ mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView);
channel_rect.mLeft += 10;
channel_rect.mRight = channel_rect.mLeft + 300;
S32 channel_bottom = channel_rect.mBottom;
- S32 bottom = channel_bottom + 10;
+ S32 bottom = channel_bottom + 80;
S32 margin = gSavedSettings.getS32("ToastGap");
//sort active toasts
@@ -454,7 +458,9 @@ LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& i
channel->setCreatePanelCallback(callback);
- mChannel = LLChannelManager::getInstance()->addChannel(channel);
+ LLChannelManager::getInstance()->addChannel(channel);
+
+ mChannel = channel->getHandle();
}
LLNearbyChatHandler::~LLNearbyChatHandler()
@@ -470,7 +476,7 @@ void LLNearbyChatHandler::initChannel()
-void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not really const, see hack below changing chat_msg.mText
+void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
const LLSD &args)
{
if(chat_msg.mMuted == TRUE)
@@ -479,28 +485,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not
if(chat_msg.mText.empty())
return;//don't process empty messages
- // Handle irc styled messages for toast panel
- // HACK ALERT - changes mText, stripping out IRC style "/me" prefixes
- LLChat& tmp_chat = const_cast<LLChat&>(chat_msg);
- std::string original_message = tmp_chat.mText; // Save un-modified version of chat text
- 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);
- }
-
LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar");
LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat");
- {
- //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();
- }
-
// Build notification data
LLSD notification;
notification["message"] = chat_msg.mText;
@@ -543,7 +531,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not
LLViewerChat::getChatColor(chat_msg,txt_color);
- LLFloaterScriptDebug::addScriptLine(original_message, // Send full message with "/me" style prefix
+ LLFloaterScriptDebug::addScriptLine(chat_msg.mText,
chat_msg.mFromName,
txt_color,
chat_msg.mFromID);
@@ -572,11 +560,12 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not
&& nearby_chat->isInVisibleChain()
|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
&& gSavedSettings.getBOOL("UseChatBubbles") )
- || !mChannel->getShowToasts() ) // to prevent toasts in Busy mode
+ || 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->getVisible())
+ if(!mChannel.get()->getVisible())
{
initChannel();
}
@@ -593,10 +582,25 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not
}
*/
- LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel);
+ 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();
@@ -608,6 +612,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not
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);
}
}