From 780c14fcaaaca8029322b80ceeda08685a276bca Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 1 May 2018 18:53:43 +0200 Subject: [PATCH] Transplant "MAINT-8498 Fixed item offers not appearing after friednship offer" and missing fix "MAINT-2575 FIXED Resident can accept unlimited number of friendship requests if they were sent before his first accept" --- indra/newview/fschathistory.cpp | 54 ++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/indra/newview/fschathistory.cpp b/indra/newview/fschathistory.cpp index 4da29a4aa7..5fe68d3227 100644 --- a/indra/newview/fschathistory.cpp +++ b/indra/newview/fschathistory.cpp @@ -54,6 +54,7 @@ #include "llstylemap.h" #include "llslurl.h" #include "lllayoutstack.h" +#include "llnotifications.h" #include "llnotificationsutil.h" #include "lltoastnotifypanel.h" #include "lltooltip.h" @@ -1536,22 +1537,47 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); if (notification != NULL) { - LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( - notification, chat.mSessionID, LLRect::null, true, this); + 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(&panel); + const std::string& notification_name = panel.getNotificationName(); + if (notification_name == "OfferFriendship" + && panel.isControlPanelEnabled() + && imtoastp) + { + create_toast = false; + break; + } + } + } - //Prepare the rect for the view - LLRect target_rect = getDocumentView()->getRect(); // FIRE-8600: TAB out of chat history - // squeeze down the widget by subtracting padding off left and right - target_rect.mLeft += mLeftWidgetPad + getHPad(); // FIRE-8600: TAB out of chat history - target_rect.mRight -= mRightWidgetPad; - notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight()); - notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom); + if (create_toast) + { + LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( + notification, chat.mSessionID, LLRect::null, true, this); - LLInlineViewSegment::Params params; - params.view = notify_box; - params.left_pad = mLeftWidgetPad; - params.right_pad = mRightWidgetPad; - appendWidget(params, "\n", false); // FIRE-8600: TAB out of chat history + //Prepare the rect for the view + LLRect target_rect = getDocumentView()->getRect(); + // squeeze down the widget by subtracting padding off left and right + target_rect.mLeft += mLeftWidgetPad + 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; + appendWidget(params, "\n", false); + } } }