Fix action on inventory offers when forcing a respond without user action

Ansariel 2015-01-08 22:10:02 +01:00
parent 58d6562e60
commit 01e62e7336
2 changed files with 30 additions and 2 deletions

View File

@ -9315,8 +9315,35 @@ void invalid_message_callback(LLMessageSystem* msg,
void LLOfferInfo::forceResponse(InventoryOfferResponse response)
{
LLNotification::Params params("UserGiveItem");
// <FS:Ansariel> Now this is a hell of piece of... forceResponse() will look for the
// ELEMENT index, and NOT the button index. So if we want to force a
// response of IOR_ACCEPT, we need to pass the correct element
// index of the button. Since we have modified the button order and also
// added legacy accept/decline messages support, we want to reponse with
// the silent version. So we don't use UserGiveItem but UserGiveItemLegacy
// and map the button index to the correct element index.
//LLNotification::Params params("UserGiveItem");
//params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
//LLNotifications::instance().forceResponse(params, response);
S32 element_index;
switch (response)
{
case IOR_ACCEPT:
element_index = 4;
break;
case IOR_DECLINE:
element_index = 5;
break;
case IOR_MUTE:
element_index = 6;
break;
default:
element_index = -1;
break;
}
LLNotification::Params params("UserGiveItemLegacy");
params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
LLNotifications::instance().forceResponse(params, response);
LLNotifications::instance().forceResponse(params, element_index);
// </FS:Ansariel>
}

View File

@ -7210,6 +7210,7 @@ Do you want to keep it? "Mute" will block all future offers or messages from [NA
</form>
</notification>
<!-- FS:Ansariel: WARNING: Read LLOfferInfo::forceResponse in llviewermessage.cpp before changing the button order!!! -->
<notification
icon="notify.tga"
name="UserGiveItemLegacy"