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

Thu, 08 Jan 2015 22:10:02 +0100

author
Ansariel
date
Thu, 08 Jan 2015 22:10:02 +0100
changeset 43112
d553b6945f37
parent 43111
09b047af2751
child 43113
914e99317e51

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

indra/newview/llviewermessage.cpp file | annotate | diff | revisions
indra/newview/skins/default/xui/en/notifications.xml file | annotate | diff | revisions
     1.1 --- a/indra/newview/llviewermessage.cpp	Wed Jan 07 16:51:27 2015 +0100
     1.2 +++ b/indra/newview/llviewermessage.cpp	Thu Jan 08 22:10:02 2015 +0100
     1.3 @@ -9315,8 +9315,35 @@
     1.4  
     1.5  void LLOfferInfo::forceResponse(InventoryOfferResponse response)
     1.6  {
     1.7 -	LLNotification::Params params("UserGiveItem");
     1.8 +	// <FS:Ansariel> Now this is a hell of piece of... forceResponse() will look for the
     1.9 +	//               ELEMENT index, and NOT the button index. So if we want to force a
    1.10 +	//               response of IOR_ACCEPT, we need to pass the correct element
    1.11 +	//               index of the button. Since we have modified the button order and also
    1.12 +	//               added legacy accept/decline messages support, we want to reponse with
    1.13 +	//               the silent version. So we don't use UserGiveItem but UserGiveItemLegacy
    1.14 +	//               and map the button index to the correct element index.
    1.15 +	//LLNotification::Params params("UserGiveItem");
    1.16 +	//params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
    1.17 +	//LLNotifications::instance().forceResponse(params, response);
    1.18 +	S32 element_index;
    1.19 +	switch (response)
    1.20 +	{
    1.21 +		case IOR_ACCEPT:
    1.22 +			element_index = 4;
    1.23 +			break;
    1.24 +		case IOR_DECLINE:
    1.25 +			element_index = 5;
    1.26 +			break;
    1.27 +		case IOR_MUTE:
    1.28 +			element_index = 6;
    1.29 +			break;
    1.30 +		default:
    1.31 +			element_index = -1;
    1.32 +			break;
    1.33 +	}
    1.34 +	LLNotification::Params params("UserGiveItemLegacy");
    1.35  	params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
    1.36 -	LLNotifications::instance().forceResponse(params, response);
    1.37 -}
    1.38 -
    1.39 +	LLNotifications::instance().forceResponse(params, element_index);
    1.40 +	// </FS:Ansariel>
    1.41 +}
    1.42 +
     2.1 --- a/indra/newview/skins/default/xui/en/notifications.xml	Wed Jan 07 16:51:27 2015 +0100
     2.2 +++ b/indra/newview/skins/default/xui/en/notifications.xml	Thu Jan 08 22:10:02 2015 +0100
     2.3 @@ -7210,6 +7210,7 @@
     2.4      </form>
     2.5    </notification>
     2.6  
     2.7 +  <!-- FS:Ansariel: WARNING: Read LLOfferInfo::forceResponse in llviewermessage.cpp before changing the button order!!! -->
     2.8    <notification
     2.9     icon="notify.tga"
    2.10     name="UserGiveItemLegacy"

mercurial