diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llscreenchannel.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llscreenchannel.h | 11 | ||||
-rw-r--r-- | indra/newview/lltoast.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 30 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 8 |
5 files changed, 76 insertions, 11 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index f66f725070..790be83e74 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -151,6 +151,33 @@ LLScreenChannel::~LLScreenChannel() } +std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher) +{ + std::list<LLToast*> res; + + // collect stored toasts + for (std::vector<ToastElem>::iterator it = mStoredToastList.begin(); it + != mStoredToastList.end(); it++) + { + if (matcher.matches(it->toast->getNotification())) + { + res.push_back(it->toast); + } + } + + // collect displayed toasts + for (std::vector<ToastElem>::iterator it = mToastList.begin(); it + != mToastList.end(); it++) + { + if (matcher.matches(it->toast->getNotification())) + { + res.push_back(it->toast); + } + } + + return res; +} + //-------------------------------------------------------------------------- void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { @@ -375,6 +402,16 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id) } } +void LLScreenChannel::killMatchedToasts(const Matcher& matcher) +{ + std::list<LLToast*> to_delete = findToasts(matcher); + for (std::list<LLToast*>::iterator it = to_delete.begin(); it + != to_delete.end(); it++) + { + killToastByNotificationID((*it)-> getNotificationID()); + } +} + //-------------------------------------------------------------------------- void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel) { diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index b8efbb148f..321fb244a1 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -151,6 +151,16 @@ public: LLScreenChannel(LLUUID& id); virtual ~LLScreenChannel(); + class Matcher + { + public: + Matcher(){} + virtual ~Matcher() {} + virtual bool matches(const LLNotificationPtr) const = 0; + }; + + std::list<LLToast*> findToasts(const Matcher& matcher); + // Channel's outfit-functions // update channel's size and position in the World View void updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect); @@ -162,6 +172,7 @@ public: void addToast(const LLToast::Params& p); // kill or modify a toast by its ID void killToastByNotificationID(LLUUID id); + void killMatchedToasts(const Matcher& matcher); void modifyToastByNotificationID(LLUUID id, LLPanel* panel); // hide all toasts from screen, but not remove them from a channel void hideToastsFromScreen(); diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 0c3c598704..3d25fd4f02 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -139,6 +139,7 @@ public: // set whether this toast considered as hidden or not void setIsHidden( bool is_toast_hidden ) { mIsHidden = is_toast_hidden; } + const LLNotificationPtr& getNotification() { return mNotification;} // Registers signals/callbacks for events toast_signal_t mOnFadeSignal; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 31bd264e3a..93d040844c 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -926,34 +926,40 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f void inventory_offer_mute_callback(const LLUUID& blocked_id, const std::string& first_name, const std::string& last_name, - BOOL is_group) + BOOL is_group, LLOfferInfo* offer = NULL) { std::string from_name; LLMute::EType type; - if (is_group) { type = LLMute::GROUP; from_name = first_name; } + else if(offer && offer->mFromObject) + { + //we have to block object by name because blocked_id is an id of owner + type = LLMute::BY_NAME; + from_name = offer->mFromName; + } else { type = LLMute::AGENT; from_name = first_name + " " + last_name; } - LLMute mute(blocked_id, from_name, type); + // id should be null for BY_NAME mute, see LLMuteList::add for details + LLMute mute(type == LLMute::BY_NAME ? LLUUID::null : blocked_id, from_name, type); if (LLMuteList::getInstance()->add(mute)) { LLPanelBlockedList::showPanelAndSelect(blocked_id); } // purge the message queue of any previously queued inventory offers from the same source. - class OfferMatcher : public LLNotifyBoxView::Matcher + class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher { public: OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {} - BOOL matches(const LLNotificationPtr notification) const + bool matches(const LLNotificationPtr notification) const { if(notification->getName() == "ObjectGiveItem" || notification->getName() == "ObjectGiveItemUnknownUser" @@ -966,7 +972,17 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, private: const LLUUID& blocked_id; }; - gNotifyBoxView->purgeMessagesMatching(OfferMatcher(blocked_id)); + + using namespace LLNotificationsUI; + LLChannelManager* channel_manager = LLChannelManager::getInstance(); + LLScreenChannel + * screen_channel = + dynamic_cast<LLScreenChannel*> (channel_manager->findChannelByID( + LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + if (screen_channel != NULL) + { + screen_channel->killMatchedToasts(OfferMatcher(blocked_id)); + } } LLOfferInfo::LLOfferInfo(const LLSD& sd) @@ -1196,7 +1212,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const // * we can't build two messages at once. if (2 == button) { - gCacheName->get(mFromID, mFromGroup, &inventory_offer_mute_callback); + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this)); } LLMessageSystem* msg = gMessageSystem; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index a6ed1f4c86..8c69699bb5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5027,13 +5027,13 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you [O name="Keep" text="Keep"/> <button - index="4" - name="Show" - text="Show"/> - <button index="1" name="Discard" text="Discard"/> + <button + index="2" + name="Mute" + text="Block"/> </form> </notification> |