summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
authorAnchor Linden <anchor@lindenlab.com>2018-06-27 17:45:35 +0530
committerAnchor Linden <anchor@lindenlab.com>2018-06-27 17:45:35 +0530
commitb48ca9da4786015f23d265f59f97110b48d0d22f (patch)
treec168dbb2e068bf8bdd96c703b178b783b8e03bfd /indra/newview/llchathistory.cpp
parenta0beacf007b9e99b7d92647ebb31307d77eec51f (diff)
parentdc07de2f4a4c49d1877bf743b6f0d209392f6eb6 (diff)
Merge
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp73
1 files changed, 41 insertions, 32 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index a9e8e77a0b..97a71a8802 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -53,6 +53,7 @@
#include "llstylemap.h"
#include "llslurl.h"
#include "lllayoutstack.h"
+#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "lltoastnotifypanel.h"
#include "lltooltip.h"
@@ -1315,44 +1316,52 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
// notify processing
if (chat.mNotifId.notNull())
{
- bool create_toast = true;
- for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances())
- , tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti)
- {
- LLToastNotifyPanel& panel = *ti;
- LLIMToastNotifyPanel * imtoastp = dynamic_cast<LLIMToastNotifyPanel *>(&panel);
- const std::string& notification_name = panel.getNotificationName();
- if (notification_name == "OfferFriendship" && panel.isControlPanelEnabled() && imtoastp)
- {
- create_toast = false;
- break;
- }
- }
-
- if (create_toast)
- {
LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId);
if (notification != NULL)
{
- LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel(
- notification, chat.mSessionID, LLRect::null, !use_plain_text_chat_history, mEditor);
-
- //Prepare the rect for the view
- LLRect target_rect = mEditor->getDocumentView()->getRect();
- // squeeze down the widget by subtracting padding off left and right
- target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
- target_rect.mRight -= mRightWidgetPad;
- notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight());
- notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom);
+ bool create_toast = true;
+ if (notification->getName() == "OfferFriendship")
+ {
+ // We don't want multiple friendship offers to appear, this code checks if there are previous offers
+ // by iterating though all panels.
+ // Note: it might be better to simply add a "pending offer" flag somewhere
+ for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances())
+ , tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti)
+ {
+ LLToastNotifyPanel& panel = *ti;
+ LLIMToastNotifyPanel * imtoastp = dynamic_cast<LLIMToastNotifyPanel *>(&panel);
+ const std::string& notification_name = panel.getNotificationName();
+ if (notification_name == "OfferFriendship"
+ && panel.isControlPanelEnabled()
+ && imtoastp)
+ {
+ create_toast = false;
+ break;
+ }
+ }
+ }
- LLInlineViewSegment::Params params;
- params.view = notify_box;
- params.left_pad = mLeftWidgetPad;
- params.right_pad = mRightWidgetPad;
- mEditor->appendWidget(params, "\n", false);
+ if (create_toast)
+ {
+ LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel(
+ notification, chat.mSessionID, LLRect::null, !use_plain_text_chat_history, mEditor);
+
+ //Prepare the rect for the view
+ LLRect target_rect = mEditor->getDocumentView()->getRect();
+ // squeeze down the widget by subtracting padding off left and right
+ target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
+ target_rect.mRight -= mRightWidgetPad;
+ notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight());
+ notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom);
+
+ LLInlineViewSegment::Params params;
+ params.view = notify_box;
+ params.left_pad = mLeftWidgetPad;
+ params.right_pad = mRightWidgetPad;
+ mEditor->appendWidget(params, "\n", false);
+ }
}
}
- }
// usual messages showing
else