summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerinventory.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2009-05-08 21:08:08 +0000
committerNat Goodspeed <nat@lindenlab.com>2009-05-08 21:08:08 +0000
commit3800c0df910c83e987184d541b868168fc2b5bec (patch)
tree91bcf4e13972ae02b9d6500c1d14de7bb8d37dc4 /indra/newview/llviewerinventory.cpp
parent5da967dc744f35d5270c7cb0b8b23b993ecda3e1 (diff)
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
Diffstat (limited to 'indra/newview/llviewerinventory.cpp')
-rw-r--r--indra/newview/llviewerinventory.cpp63
1 files changed, 23 insertions, 40 deletions
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);
}