From 6d789f59f8d8b3d195090f972f783727037790c2 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 21 Jul 2011 17:07:05 -0700 Subject: Added handling for RemoveInventoryObjects message. Fixed handling of RemoveInventoryFolder --- indra/newview/llinventorymodel.cpp | 80 ++++++++++++++++++++++++++++---------- indra/newview/llinventorymodel.h | 3 ++ 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 21d5de9a5b..50b5a2a5e5 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2168,6 +2168,9 @@ void LLInventoryModel::registerCallbacks(LLMessageSystem* msg) msg->setHandlerFuncFast(_PREHASH_RemoveInventoryFolder, processRemoveInventoryFolder, NULL); + msg->setHandlerFuncFast(_PREHASH_RemoveInventoryObjects, + processRemoveInventoryObjects, + NULL); //msg->setHandlerFuncFast(_PREHASH_ExchangeCallingCard, // processExchangeCallingcard, // NULL); @@ -2284,17 +2287,9 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) } // static -void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) +void LLInventoryModel::removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg) { - lldebugs << "LLInventoryModel::processRemoveInventoryItem()" << llendl; - LLUUID agent_id, item_id; - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); - if(agent_id != gAgent.getID()) - { - llwarns << "Got a RemoveInventoryItem for the wrong agent." - << llendl; - return; - } + LLUUID item_id; S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); uuid_vec_t item_ids; update_map_t update; @@ -2316,6 +2311,21 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) { gInventory.deleteObject(*it); } +} + +// static +void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) +{ + lldebugs << "LLInventoryModel::processRemoveInventoryItem()" << llendl; + LLUUID agent_id, item_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + if(agent_id != gAgent.getID()) + { + llwarns << "Got a RemoveInventoryItem for the wrong agent." + << llendl; + return; + } + LLInventoryModel::removeInventoryItem(agent_id, msg); gInventory.notifyObservers(); } @@ -2380,18 +2390,10 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, } // static -void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, - void**) +void LLInventoryModel::removeInventoryFolder(LLUUID agent_id, + LLMessageSystem* msg) { - lldebugs << "LLInventoryModel::processRemoveInventoryFolder()" << llendl; - LLUUID agent_id, folder_id; - msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); - if(agent_id != gAgent.getID()) - { - llwarns << "Got a RemoveInventoryFolder for the wrong agent." - << llendl; - return; - } + LLUUID folder_id; uuid_vec_t folder_ids; update_map_t update; S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); @@ -2410,6 +2412,42 @@ void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, { gInventory.deleteObject(*it); } +} + +// static +void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, + void**) +{ + lldebugs << "LLInventoryModel::processRemoveInventoryFolder()" << llendl; + LLUUID agent_id, session_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id); + if(agent_id != gAgent.getID()) + { + llwarns << "Got a RemoveInventoryFolder for the wrong agent." + << llendl; + return; + } + LLInventoryModel::removeInventoryFolder( agent_id, msg ); + gInventory.notifyObservers(); +} + +// static +void LLInventoryModel::processRemoveInventoryObjects(LLMessageSystem* msg, + void**) +{ + lldebugs << "LLInventoryModel::processRemoveInventoryObjects()" << llendl; + LLUUID agent_id, session_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id); + if(agent_id != gAgent.getID()) + { + llwarns << "Got a RemoveInventoryObjects for the wrong agent." + << llendl; + return; + } + LLInventoryModel::removeInventoryFolder( agent_id, msg ); + LLInventoryModel::removeInventoryItem( agent_id, msg ); gInventory.notifyObservers(); } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 15da09990f..c3775ac088 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -492,9 +492,12 @@ protected: //-------------------------------------------------------------------- public: static void processUpdateCreateInventoryItem(LLMessageSystem* msg, void**); + static void removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg); static void processRemoveInventoryItem(LLMessageSystem* msg, void**); static void processUpdateInventoryFolder(LLMessageSystem* msg, void**); + static void removeInventoryFolder(LLUUID agent_id, LLMessageSystem* msg); static void processRemoveInventoryFolder(LLMessageSystem* msg, void**); + static void processRemoveInventoryObjects(LLMessageSystem* msg, void**); static void processSaveAssetIntoInventory(LLMessageSystem* msg, void**); static void processBulkUpdateInventory(LLMessageSystem* msg, void**); static void processInventoryDescendents(LLMessageSystem* msg, void**); -- cgit v1.2.3