diff options
author | Alexei Arabadji <aarabadji@productengine.com> | 2010-03-04 11:35:34 +0200 |
---|---|---|
committer | Alexei Arabadji <aarabadji@productengine.com> | 2010-03-04 11:35:34 +0200 |
commit | f54bf2a1eac3bc61222e5cceba77755bd340f996 (patch) | |
tree | 4d6062c4cffac8b2995f1bd19f09029868ce65c2 /indra/newview/llnotificationofferhandler.cpp | |
parent | e84e440adc8aa24fc9c4a4c20aa6b82be71e9e60 (diff) |
fixed EXT-5904 “Offers embedding into IM windows”,
made all type offers be embedded to the IM floater;
made showing offer toast if IM floater isn't visible;
corrected IM message counter on showing offer toast;
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llnotificationofferhandler.cpp')
-rw-r--r-- | indra/newview/llnotificationofferhandler.cpp | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 8ebd5de258..42e42d4f0a 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -113,36 +113,53 @@ bool LLOfferHandler::processNotification(const LLSD& notify) session_id = LLHandlerUtil::spawnIMSession(name, from_id); } - if (LLHandlerUtil::canAddNotifPanelToIM(notification)) + bool show_toast = true; + bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification); + if (add_notid_to_im) { LLHandlerUtil::addNotifPanelToIM(notification); - LLHandlerUtil::logToIMP2P(notification, true); + if (LLHandlerUtil::isIMFloaterOpened(notification)) + { + show_toast = false; + } } - else if (notification->getPayload().has("SUPPRESS_TOAST") + + if (notification->getPayload().has("SUPPRESS_TOAST") && notification->getPayload()["SUPPRESS_TOAST"]) { - LLHandlerUtil::logToIMP2P(notification); LLNotificationsUtil::cancel(notification); } - else + else if(show_toast) { LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); - + // don't close notification on panel destroy since it will be used by IM floater + notify_box->setCloseNotificationOnDestroy(!add_notid_to_im); LLToast::Params p; p.notif_id = notification->getID(); p.notification = notification; p.panel = notify_box; p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1); + // we not save offer notifications to the syswell floater that should be added to the IM floater + p.can_be_stored = !add_notid_to_im; LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); if(channel) channel->addToast(p); - LLHandlerUtil::logToIMP2P(notification); - // send a signal to the counter manager mNewNotificationSignal(); } + + if (LLHandlerUtil::canLogToIM(notification)) + { + LLHandlerUtil::logToIMP2P(notification); + } + + // update IM floater messages if need + if (add_notid_to_im) + { + LLHandlerUtil::updateVisibleIMFLoaterMesages(notification); + } } } else if (notify["sigtype"].asString() == "delete") @@ -155,6 +172,11 @@ bool LLOfferHandler::processNotification(const LLSD& notify) } else { + if (LLHandlerUtil::canAddNotifPanelToIM(notification) + && !LLHandlerUtil::isIMFloaterOpened(notification)) + { + LLHandlerUtil::decIMMesageCounter(notification); + } mChannel->killToastByNotificationID(notification->getID()); } } @@ -181,7 +203,9 @@ void LLOfferHandler::onRejectToast(LLUUID& id) if (notification && LLNotificationManager::getInstance()->getHandlerForNotification( - notification->getType()) == this) + notification->getType()) == this + // don't delete notification since it may be used by IM floater + && !LLHandlerUtil::canAddNotifPanelToIM(notification)) { LLNotifications::instance().cancel(notification); } |