From 3800c0df910c83e987184d541b868168fc2b5bec Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 8 May 2009 21:08:08 +0000 Subject: svn merge -r114679:114681 svn+ssh://svn.lindenlab.com/svn/linden/branches/event-system/event-system-7 svn+ssh://svn.lindenlab.com/svn/linden/branches/event-system/event-system-8 --- indra/newview/llviewerinventory.cpp | 63 ++++++++++++++----------------------- 1 file changed, 23 insertions(+), 40 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 52c49dd05d..b1482d5ce4 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -762,56 +762,39 @@ void move_inventory_item( gAgent.sendReliableMessage(); } -class LLCopyInventoryFromNotecardResponder : public LLHTTPClient::Responder -{ -public: - //If we get back a normal response, handle it here - virtual void result(const LLSD& content) - { - // What do we do here? - llinfos << "CopyInventoryFromNotecard request successful." << llendl; - } - - //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason) - { - llinfos << "LLCopyInventoryFromNotecardResponder::error " - << status << ": " << reason << llendl; - } -}; - void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id) { - LLSD body; LLViewerRegion* viewer_region = NULL; - if(object_id.notNull()) - { - LLViewerObject* vo = gObjectList.findObject(object_id); - if(vo) - { - viewer_region = vo->getRegion(); - } + LLViewerObject* vo = NULL; + if (object_id.notNull() && (vo = gObjectList.findObject(object_id)) != NULL) + { + viewer_region = vo->getRegion(); } // Fallback to the agents region if for some reason the // object isn't found in the viewer. - if(!viewer_region) + if (! viewer_region) { viewer_region = gAgent.getRegion(); } - if(viewer_region) + if (! viewer_region) { - std::string url = viewer_region->getCapability("CopyInventoryFromNotecard"); - if (!url.empty()) - { - body["notecard-id"] = notecard_inv_id; - body["object-id"] = object_id; - body["item-id"] = src->getUUID(); - body["folder-id"] = gInventory.findCategoryUUIDForType(src->getType()); - body["callback-id"] = (LLSD::Integer)callback_id; - - LLHTTPClient::post(url, body, new LLCopyInventoryFromNotecardResponder()); - } - } + LL_WARNS("copy_inventory_from_notecard") << "Can't find region from object_id " + << object_id << " or gAgent" + << LL_ENDL; + return; + } + + LLSD request, body; + body["notecard-id"] = notecard_inv_id; + body["object-id"] = object_id; + body["item-id"] = src->getUUID(); + body["folder-id"] = gInventory.findCategoryUUIDForType(src->getType()); + body["callback-id"] = (LLSD::Integer)callback_id; + + request["message"] = "CopyInventoryFromNotecard"; + request["payload"] = body; + + viewer_region->getCapAPI().post(request); } -- cgit v1.2.3