summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
authorDenis Serdjuk <dserduk@productengine.com>2009-12-10 21:40:46 +0200
committerDenis Serdjuk <dserduk@productengine.com>2009-12-10 21:40:46 +0200
commit1967034ca0a71f95ddcd793187a3e07d3acc6639 (patch)
tree692c138275910e1053bcee52cae1a913ea46b65b /indra/newview/llviewermessage.cpp
parent862681b53a61783d292782c2415e8c5caddde136 (diff)
implemented task EXT-2609 Implement 'block' option for inventory offers
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rw-r--r--indra/newview/llviewermessage.cpp30
1 files changed, 23 insertions, 7 deletions
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;