diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-27 17:52:11 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-27 17:52:11 +0300 |
commit | a05046f4c069b4bfee2dd57b558008621d36e742 (patch) | |
tree | 5ad923090162e4b4f01eca14ddc72a31c0c857a7 /indra/newview | |
parent | 22c58368315de9ed3112339e633d61d3427b80ba (diff) |
SL-11454 Exception for muted objects, such offers should get declined
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llimprocessing.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llviewermessage.h | 4 |
3 files changed, 43 insertions, 35 deletions
diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 236addac6d..5b9ef7e60a 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -896,12 +896,18 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, if (is_muted) { // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331) - LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); - fetch_item->startFetch(); - delete fetch_item; - - // Same as closing window - info->forceResponse(IOR_DECLINE); + if (IM_INVENTORY_OFFERED == dialog) + { + LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); + fetch_item->startFetch(); + delete fetch_item; + // Same as closing window + info->forceResponse(IOR_DECLINE); + } + else + { + info->forceResponse(IOR_MUTE); + } } // old logic: busy mode must not affect interaction with objects (STORM-565) // new logic: inventory offers from in-world objects should be auto-declined (CHUI-519) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a68e941c0c..3fda51f856 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1671,7 +1671,7 @@ void LLOfferInfo::fromLLSD(const LLSD& params) *this = params; } -void LLOfferInfo::sendReceiveResponse(const LLUUID &destination_folder_id) +void LLOfferInfo::sendReceiveResponse(bool accept, const LLUUID &destination_folder_id) { if(IM_INVENTORY_OFFERED == mIM) { @@ -1719,9 +1719,17 @@ void LLOfferInfo::sendReceiveResponse(const LLUUID &destination_folder_id) im = IM_GROUP_NOTICE; } - msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 1)); - msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(destination_folder_id.mData), - sizeof(destination_folder_id.mData)); + if (accept) + { + msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 1)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(destination_folder_id.mData), + sizeof(destination_folder_id.mData)); + } + else + { + msg->addU8Fast(_PREHASH_Dialog, (U8)(im + 2)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE); + } // send the message msg->sendReliable(mHost); @@ -1790,7 +1798,10 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // TODO: when task inventory offers can also be handled the new way, migrate the code that sets these strings here: from_string = chatHistory_string = mFromName; - + + // accept goes to proper folder, decline gets accepted to trash, muted gets declined + bool accept_to_trash = true; + LLNotificationFormPtr modified_form(notification_ptr ? new LLNotificationForm(*notification_ptr->getForm()) : new LLNotificationForm()); switch(button) @@ -1824,7 +1835,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& case IM_GROUP_NOTICE: case IM_GROUP_NOTICE_REQUESTED: opener = new LLOpenTaskGroupOffer; - sendReceiveResponse(mFolderID); + sendReceiveResponse(true, mFolderID); break; case IM_TASK_INVENTORY_OFFERED: // This is an offer from a task or group. @@ -1861,6 +1872,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& { modified_form->setElementEnabled("Mute", false); } + accept_to_trash = false; // for notices, but IOR_MUTE normally doesn't happen for notices // MUTE falls through to decline case IOR_DECLINE: { @@ -1874,6 +1886,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 { chat.mMuted = TRUE; + accept_to_trash = false; // will send decline message } // *NOTE dzaporozhan @@ -1896,8 +1909,9 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& else if (mIM == IM_GROUP_NOTICE) { // group notice needs to request object to trash so that user will see it later + // Note: muted agent offers go to trash, not sure if we should do same for notices LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - sendReceiveResponse(trash); + sendReceiveResponse(accept_to_trash, trash); } if (modified_form != NULL) @@ -1916,7 +1930,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& if (mIM == IM_GROUP_NOTICE) { LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - sendReceiveResponse(trash); + sendReceiveResponse(true, trash); } break; } @@ -2009,8 +2023,8 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const from_string = chatHistory_string = mFromName; } - bool is_do_not_disturb = gAgent.isDoNotDisturb(); LLUUID destination; + bool accept = true; // If user accepted, accept to proper folder, if user discarded, accept to trash. switch(button) @@ -2028,33 +2042,21 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const break; case IOR_MUTE: // MUTE falls through to decline + accept = false; case IOR_DECLINE: default: // close button probably (or any of the fall-throughs from above) destination = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - - if (is_do_not_disturb && (!mFromGroup && !mFromObject)) + if (accept && LLMuteList::getInstance()->isMuted(mFromID, mFromName)) { - LLMessageSystem* msg = gMessageSystem; - send_do_not_disturb_message(msg,mFromID); + // Note: muted offers are usually declined automatically, + // but user can mute object after receiving message + accept = false; } break; } - sendReceiveResponse(destination); - - // Purely for logging purposes. - switch (mIM) - { - case IM_INVENTORY_OFFERED: - case IM_GROUP_NOTICE: - case IM_TASK_INVENTORY_OFFERED: - case IM_GROUP_NOTICE_REQUESTED: - break; - default: - LL_WARNS("Messaging") << "inventory_task_offer_callback: unknown offer type" << LL_ENDL; - break; - } + sendReceiveResponse(accept, destination); if(!mPersist) { diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index d02ef46348..78829a6a56 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -254,7 +254,7 @@ public: /*virtual*/ void fromLLSD(const LLSD& params); /*virtual*/ void handleRespond(const LLSD& notification, const LLSD& response); - void send_auto_receive_response() { sendReceiveResponse(mFolderID); } + void send_auto_receive_response() { sendReceiveResponse(true, mFolderID); } // TODO - replace all references with handleRespond() bool inventory_offer_callback(const LLSD& notification, const LLSD& response); @@ -264,7 +264,7 @@ private: void initRespondFunctionMap(); std::string getSanitizedDescription(); - void sendReceiveResponse(const LLUUID &destination_folder_id); + void sendReceiveResponse(bool accept, const LLUUID &destination_folder_id); typedef boost::function<bool (const LLSD&, const LLSD&)> respond_function_t; typedef std::map<std::string, respond_function_t> respond_function_map_t; |