diff options
-rwxr-xr-x | indra/newview/llchathistory.cpp | 51 | ||||
-rwxr-xr-x | indra/newview/lltoastnotifypanel.cpp | 22 | ||||
-rwxr-xr-x | indra/newview/lltoastnotifypanel.h | 2 | ||||
-rwxr-xr-x | indra/newview/lltoastpanel.cpp | 6 | ||||
-rwxr-xr-x | indra/newview/lltoastpanel.h | 1 | ||||
-rwxr-xr-x | indra/newview/llviewermessage.cpp | 42 |
6 files changed, 95 insertions, 29 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index afa6d4eaeb..64ae01c82a 100755 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -1075,25 +1075,42 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL // notify processing if (chat.mNotifId.notNull()) { - LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); - if (notification != NULL) + bool create_toast = true; + for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances()) + , tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti) { - LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( + 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); - - LLInlineViewSegment::Params params; - params.view = notify_box; - params.left_pad = mLeftWidgetPad; - params.right_pad = mRightWidgetPad; - mEditor->appendWidget(params, "\n", false); + //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); + } } } @@ -1123,7 +1140,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (square_brackets) { message += "]"; - } + } mEditor->appendText(message, prependNewLineState, body_message_params); prependNewLineState = false; diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 94d07b37ef..3a41bf28b4 100755 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -407,6 +407,28 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) } } +bool LLToastNotifyPanel::isControlPanelEnabled() const +{ + bool cp_enabled = mControlPanel->getEnabled(); + bool some_buttons_enabled = false; + if (cp_enabled) + { + LLView::child_list_const_iter_t child_it = mControlPanel->beginChild(); + LLView::child_list_const_iter_t child_it_end = mControlPanel->endChild(); + for(; child_it != child_it_end; ++child_it) + { + LLButton * buttonp = dynamic_cast<LLButton *>(*child_it); + if (buttonp && buttonp->getEnabled()) + { + some_buttons_enabled = true; + break; + } + } + } + + return cp_enabled && some_buttons_enabled; +} + ////////////////////////////////////////////////////////////////////////// LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect /* = LLRect::null */, diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index d02171b512..fe7f1cf8f3 100755 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -69,6 +69,8 @@ public: virtual void updateNotification() {} + bool isControlPanelEnabled() const; + protected: LLButton* createButton(const LLSD& form_element, BOOL is_option); diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp index a30f841980..e1b764a943 100755 --- a/indra/newview/lltoastpanel.cpp +++ b/indra/newview/lltoastpanel.cpp @@ -53,6 +53,12 @@ std::string LLToastPanel::getTitle() } //virtual +const std::string& LLToastPanel::getNotificationName() +{ + return mNotification->getName(); +} + +//virtual const LLUUID& LLToastPanel::getID() { return mNotification->id(); diff --git a/indra/newview/lltoastpanel.h b/indra/newview/lltoastpanel.h index e4ab95007e..51630381f2 100755 --- a/indra/newview/lltoastpanel.h +++ b/indra/newview/lltoastpanel.h @@ -45,6 +45,7 @@ public: virtual ~LLToastPanel() = 0; virtual std::string getTitle(); + virtual const std::string& getNotificationName(); virtual const LLUUID& getID(); static const S32 MIN_PANEL_HEIGHT; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 151a7c6213..c6f3ef6ae3 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -45,6 +45,7 @@ #include "llsd.h" #include "llsdserialize.h" #include "llteleportflags.h" +#include "lltoastnotifypanel.h" #include "lltransactionflags.h" #include "llvfile.h" #include "llvfs.h" @@ -3214,7 +3215,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["online"] = (offline == IM_ONLINE); payload["sender"] = msg->getSender().getIPandPort(); - if (is_muted) + bool add_notification = true; + for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances()) + , tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti) + { + LLToastNotifyPanel& panel = *ti; + const std::string& notification_name = panel.getNotificationName(); + if (notification_name == "OfferFriendship" && panel.isControlPanelEnabled()) + { + add_notification = false; + break; + } + } + + if (is_muted && add_notification) { LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1); } @@ -3225,18 +3239,22 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) send_do_not_disturb_message(msg, from_id); } args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); - if(message.empty()) - { - //support for frienship offers from clients before July 2008 - LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload); - } - else + + if (add_notification) { - args["[MESSAGE]"] = message; - LLNotification::Params params("OfferFriendship"); - params.substitutions = args; - params.payload = payload; - LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false); + if(message.empty()) + { + //support for frienship offers from clients before July 2008 + LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload); + } + else + { + args["[MESSAGE]"] = message; + LLNotification::Params params("OfferFriendship"); + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false); + } } } } |