STORM-1297 WIP Block object inventory offer by the object's owner ID.

Submitting a fix by Jonathan Yap that I have cleaned up.
meow-7.2.2
Vadim ProductEngine 2011-08-30 20:09:39 +03:00
parent 1ac369afe5
commit 4e220af01d
3 changed files with 32 additions and 25 deletions

View File

@ -566,6 +566,7 @@ Jonathan Yap
STORM-1276
STORM-1462
STORM-1459
STORM-1297
Kadah Coba
STORM-1060
Jondan Lundquist

View File

@ -1299,29 +1299,12 @@ bool highlight_offered_object(const LLUUID& obj_id)
void inventory_offer_mute_callback(const LLUUID& blocked_id,
const std::string& full_name,
bool is_group,
boost::shared_ptr<LLNotificationResponderInterface> offer_ptr)
bool is_group)
{
LLOfferInfo* offer = dynamic_cast<LLOfferInfo*>(offer_ptr.get());
std::string from_name = full_name;
LLMute::EType type;
if (is_group)
{
type = LLMute::GROUP;
}
else if(offer && offer->mFromObject)
{
//we have to block object by name because blocked_id is an id of owner
type = LLMute::BY_NAME;
}
else
{
type = LLMute::AGENT;
}
// *NOTE: blocks owner if the offer came from an object
LLMute::EType mute_type = is_group ? LLMute::GROUP : LLMute::AGENT;
// 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);
LLMute mute(blocked_id, full_name, mute_type);
if (LLMuteList::getInstance()->add(mute))
{
LLPanelBlockedList::showPanelAndSelect(blocked_id);
@ -1335,6 +1318,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id,
bool matches(const LLNotificationPtr notification) const
{
if(notification->getName() == "ObjectGiveItem"
|| notification->getName() == "OwnObjectGiveItem"
|| notification->getName() == "UserGiveItem")
{
return (notification->getPayload()["from_id"].asUUID() == blocked_id);
@ -1495,7 +1479,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
llassert(notification_ptr != NULL);
if (notification_ptr != NULL)
{
gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr()));
gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
}
}
@ -1640,7 +1624,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const
llassert(notification_ptr != NULL);
if (notification_ptr != NULL)
{
gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr()));
gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
}
}
@ -1818,6 +1802,7 @@ void LLOfferInfo::initRespondFunctionMap()
if(mRespondFunctions.empty())
{
mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
mRespondFunctions["OwnObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2);
}
}
@ -1915,7 +1900,10 @@ void inventory_offer_handler(LLOfferInfo* info)
// Note: sets inventory_task_offer_callback as the callback
p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
info->mPersist = true;
p.name = "ObjectGiveItem";
// Offers from your own objects need a special notification template.
p.name = info->mFromID == gAgentID ? "OwnObjectGiveItem" : "ObjectGiveItem";
// Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory.
LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE);
}

View File

@ -5916,7 +5916,25 @@ An object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; owned by [NAME_SLU
<button
index="2"
name="Mute"
text="Block"/>
text="Block Owner"/>
</form>
</notification>
<notification
icon="notify.tga"
name="OwnObjectGiveItem"
type="offer">
Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you this [OBJECTTYPE]:
&lt;nolink&gt;[ITEM_SLURL]&lt;/nolink&gt;
<form name="form">
<button
index="0"
name="Keep"
text="Keep"/>
<button
index="1"
name="Discard"
text="Discard"/>
</form>
</notification>