From b41aa1e0b2460f917d4d6cf4ddb2d641312455b5 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 1 Jun 2010 14:13:56 +0300 Subject: =?UTF-8?q?EXT-6710=20FIXED=20Added=20inventory=20items=20sharing?= =?UTF-8?q?=20confirmation=20and=20modified=20alert=20about=20non-copy=20o?= =?UTF-8?q?bjects=20sharing.=20Current=20behavior:=20*=20user=20will=20be?= =?UTF-8?q?=20prompted=20about=20sharing=20items=20regardless=20is=20it=20?= =?UTF-8?q?one=20or=20more=20items;=20*=20user=20will=20be=20prompted=20ab?= =?UTF-8?q?out=20trying=20to=20share=20one=20ore=20more=20non-copy=20items?= =?UTF-8?q?;=20*=20in=20case=20user=20tries=20to=20share=20non-copy=20item?= =?UTF-8?q?s=20among=20with=20copy=20items=20=E2=80=94=20copy=20=20tems=20?= =?UTF-8?q?will=20be=20shared=20and=20user=20will=20be=20prompted=20about?= =?UTF-8?q?=20sharing=20non-copy=20items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/475/ --HG-- branch : product-engine --- indra/newview/llgiveinventory.cpp | 46 ++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'indra/newview/llgiveinventory.cpp') diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index d83d895dd0..4a13e1e504 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -192,15 +192,16 @@ bool LLGiveInventory::isInventoryGroupGiveAcceptable(const LLInventoryItem* item } // static -void LLGiveInventory::doGiveInventoryItem(const LLUUID& to_agent, +bool LLGiveInventory::doGiveInventoryItem(const LLUUID& to_agent, const LLInventoryItem* item, const LLUUID& im_session_id/* = LLUUID::null*/) { + bool res = true; llinfos << "LLGiveInventory::giveInventory()" << llendl; if (!isInventoryGiveAcceptable(item)) { - return; + return false; } if (item->getPermissions().allowCopyBy(gAgentID)) { @@ -210,12 +211,19 @@ void LLGiveInventory::doGiveInventoryItem(const LLUUID& to_agent, else { // ask if the agent is sure. + LLSD substitutions; + substitutions["ITEMS"] = item->getName(); LLSD payload; payload["agent_id"] = to_agent; - payload["item_id"] = item->getUUID(); - LLNotificationsUtil::add("CannotCopyWarning", LLSD(), payload, + LLSD items = LLSD::emptyArray(); + items.append(item->getUUID()); + payload["items"] = items; + LLNotificationsUtil::add("CannotCopyWarning", substitutions, payload, &LLGiveInventory::handleCopyProtectedItem); + res = false; } + + return res; } void LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, @@ -318,25 +326,29 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im bool LLGiveInventory::handleCopyProtectedItem(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLSD itmes = notification["payload"]["items"]; LLInventoryItem* item = NULL; switch(option) { case 0: // "Yes" - item = gInventory.getItem(notification["payload"]["item_id"].asUUID()); - if (item) - { - LLGiveInventory::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(), - item); - // delete it for now - it will be deleted on the server - // quickly enough. - gInventory.deleteObject(notification["payload"]["item_id"].asUUID()); - gInventory.notifyObservers(); - } - else + for (LLSD::array_iterator it = itmes.beginArray(); it != itmes.endArray(); it++) { - LLNotificationsUtil::add("CannotGiveItem"); + item = gInventory.getItem((*it).asUUID()); + if (item) + { + LLGiveInventory::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(), + item); + // delete it for now - it will be deleted on the server + // quickly enough. + gInventory.deleteObject(item->getUUID()); + gInventory.notifyObservers(); + } + else + { + LLNotificationsUtil::add("CannotGiveItem"); + } + break; } - break; default: // no, cancel, whatever, who cares, not yes. LLNotificationsUtil::add("TransactionCancelled"); -- cgit v1.2.3 From 91ae0a1f1629b67ffbb11415a4ea4723578db1db Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 1 Jun 2010 15:22:05 +0300 Subject: EXT-6710 ADDITIONAL FIX win build fixed --HG-- branch : product-engine --- indra/newview/llgiveinventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llgiveinventory.cpp') diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index 4a13e1e504..aebf1b4c26 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -347,8 +347,8 @@ bool LLGiveInventory::handleCopyProtectedItem(const LLSD& notification, const LL { LLNotificationsUtil::add("CannotGiveItem"); } - break; } + break; default: // no, cancel, whatever, who cares, not yes. LLNotificationsUtil::add("TransactionCancelled"); -- cgit v1.2.3