From 51c837dda7661ad7b9d90d96e35117eacc7a113a Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 19 Aug 2011 19:53:44 +0300 Subject: STORM-1543 WIP Fixed dropping nventory offers in busy mode. When auto-discarding inventory offers we looked up missing Busy button (i.e. a button having index=3) in the inventory offer notification dialog template. Failure to find the button resulted in ignoring inventory offers. Fixed that by "auto-clicking" the existing Discard button. --- indra/newview/llviewermessage.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 321d02aaf1..8177446778 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1495,6 +1495,13 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& LLChat chat; std::string log_message; S32 button = LLNotificationsUtil::getSelectedOption(notification, response); + + // The offer notification has no Busy button, + // so if we're in busy mode, assume busy response (STORM-1543). + if (gAgent.getBusy()) + { + button = IOR_BUSY; + } LLInventoryObserver* opener = NULL; LLViewerInventoryCategory* catp = NULL; @@ -2667,7 +2674,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { // Until throttling is implemented, busy mode should reject inventory instead of silently // accepting it. SEE SL-39554 - info->forceResponse(IOR_BUSY); + info->forceResponse(IOR_DECLINE); } else { -- cgit v1.2.3 From 1ed945b5a08a40399ff63ed657c66416c3baf7cf Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 19 Aug 2011 19:58:00 +0300 Subject: STORM-1543 WIP Fixed auto-moving offered inventory items to trash. It turned out impossible to properly remove an inventory item from within LLDiscardAgentOffer::done(), because that would lead to nested LLInventoryModel::notifyObservers() calls. Fixed that by deferring removal until the next LLAppViewer::idle() iteration. Also elimiteed duplicated code. --- indra/newview/llviewermessage.cpp | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 8177446778..2c783cd4b6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1058,37 +1058,9 @@ public: virtual void done() { LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL; - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - bool notify = false; - if(trash_id.notNull() && mObjectID.notNull()) - { - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(mFolderID, -1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - gInventory.moveObject(mObjectID, trash_id); - LLInventoryObject* obj = gInventory.getObject(mObjectID); - if(obj) - { - // no need to restamp since this is already a freshly - // stamped item. - obj->updateParentOnServer(FALSE); - notify = true; - } - } - else - { - LL_WARNS("Messaging") << "DiscardAgentOffer unable to find: " - << (trash_id.isNull() ? "trash " : "") - << (mObjectID.isNull() ? "object" : "") << LL_ENDL; - } + + LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeItem, &gInventory, mObjectID)); gInventory.removeObserver(this); - if(notify) - { - gInventory.notifyObservers(); - } delete this; } protected: -- cgit v1.2.3 From e0b5ff5c5289f965c943dcba93f0b5d94d1ba1f9 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 19 Aug 2011 19:59:13 +0300 Subject: STORM-1543 WIP Minor cleanup. --- indra/newview/llviewermessage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2c783cd4b6..22966015c8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1049,12 +1049,13 @@ void start_new_inventory_observer() class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver { LOG_CLASS(LLDiscardAgentOffer); + public: LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) : LLInventoryFetchItemsObserver(object_id), mFolderID(folder_id), mObjectID(object_id) {} - virtual ~LLDiscardAgentOffer() {} + virtual void done() { LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL; @@ -1063,6 +1064,7 @@ public: gInventory.removeObserver(this); delete this; } + protected: LLUUID mFolderID; LLUUID mObjectID; -- cgit v1.2.3 From 5578c285d866488d06f99f5e72e3fb9291d37eca Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 22 Aug 2011 14:01:18 +0300 Subject: STORM-1543 WIP More cleanup and comments. --- indra/newview/llviewermessage.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 22966015c8..793abb1c9d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1060,6 +1060,10 @@ public: { LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL; + // We're invoked from LLInventoryModel::notifyObservers(). + // If we now try to remove the inventory item, it will cause a nested + // notifyObservers() call, which won't work. + // So defer moving the item to trash until viewer gets idle (in a moment). LLAppViewer::instance()->addOnIdleCallback(boost::bind(&LLInventoryModel::removeItem, &gInventory, mObjectID)); gInventory.removeObserver(this); delete this; -- cgit v1.2.3 From a4f132f1b88b151db1e834069bc6e9b49f9c5a17 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 26 Aug 2011 00:19:33 +0300 Subject: STORM-1543 WIP Removed invalid IOR_BUSY response option. Addressing review feedback. --- indra/newview/llviewermessage.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 793abb1c9d..64aeb750c6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1474,13 +1474,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& std::string log_message; S32 button = LLNotificationsUtil::getSelectedOption(notification, response); - // The offer notification has no Busy button, - // so if we're in busy mode, assume busy response (STORM-1543). - if (gAgent.getBusy()) - { - button = IOR_BUSY; - } - LLInventoryObserver* opener = NULL; LLViewerInventoryCategory* catp = NULL; catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID); @@ -1512,7 +1505,7 @@ 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; - bool busy=FALSE; + bool busy = gAgent.getBusy(); switch(button) { @@ -1571,9 +1564,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& } break; - case IOR_BUSY: - //Busy falls through to decline. Says to make busy message. - busy=TRUE; case IOR_MUTE: // MUTE falls through to decline case IOR_DECLINE: @@ -1719,7 +1709,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const from_string = chatHistory_string = mFromName; } - bool busy=FALSE; + bool busy = gAgent.getBusy(); switch(button) { @@ -1765,9 +1755,6 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const } // end switch (mIM) break; - case IOR_BUSY: - //Busy falls through to decline. Says to make busy message. - busy=TRUE; case IOR_MUTE: // MUTE falls through to decline case IOR_DECLINE: -- cgit v1.2.3