From 22bd85441b488dd9576bbdeffe9936650f010d78 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 22 Jul 2015 09:33:21 -0700 Subject: Clean up for postcard post. --- indra/newview/llpanelsnapshotpostcard.cpp | 52 ++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpanelsnapshotpostcard.cpp') diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index 8e37b1418c..e4f39aac04 100755 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -40,6 +40,7 @@ #include "llpostcard.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewerwindow.h" +#include "llviewerregion.h" #include @@ -67,7 +68,8 @@ private: /*virtual*/ void updateControls(const LLSD& info); bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response); - void sendPostcard(); + static void sendPostcardFinished(LLSD result); + void sendPostcard(); void onMsgFormFocusRecieved(); void onFormatComboCommit(LLUICtrl* ctrl); @@ -166,24 +168,44 @@ bool LLPanelSnapshotPostcard::missingSubjMsgAlertCallback(const LLSD& notificati } -void LLPanelSnapshotPostcard::sendPostcard() +void LLPanelSnapshotPostcard::sendPostcardFinished(LLSD result) { - std::string to(getChild("to_form")->getValue().asString()); - std::string subject(getChild("subject_form")->getValue().asString()); + LL_WARNS() << result << LL_ENDL; - LLSD postcard = LLSD::emptyMap(); - postcard["pos-global"] = LLFloaterSnapshot::getPosTakenGlobal().getValue(); - postcard["to"] = to; - postcard["from"] = mAgentEmail; - postcard["name"] = getChild("name_form")->getValue().asString(); - postcard["subject"] = subject; - postcard["msg"] = getChild("msg_form")->getValue().asString(); - LLPostCard::send(LLFloaterSnapshot::getImageData(), postcard); + std::string state = result["state"].asString(); - // Give user feedback of the event. - gViewerWindow->playSnapshotAnimAndSound(); + LLPostCard::reportPostResult((state == "complete")); +} - LLFloaterSnapshot::postSave(); + +void LLPanelSnapshotPostcard::sendPostcard() +{ + // upload the image + std::string url = gAgent.getRegion()->getCapability("SendPostcard"); + if (!url.empty()) + { + LLResourceUploadInfo::ptr_t uploadInfo(new LLPostcardUploadInfo( + mAgentEmail, + getChild("name_form")->getValue().asString(), + getChild("to_form")->getValue().asString(), + getChild("subject_form")->getValue().asString(), + getChild("msg_form")->getValue().asString(), + LLFloaterSnapshot::getPosTakenGlobal(), + LLFloaterSnapshot::getImageData(), + boost::bind(&LLPanelSnapshotPostcard::sendPostcardFinished, _4))); + + LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); + } + else + { + LL_WARNS() << "Postcards unavailable in this region." << LL_ENDL; + } + + + // Give user feedback of the event. + gViewerWindow->playSnapshotAnimAndSound(); + + LLFloaterSnapshot::postSave(); } void LLPanelSnapshotPostcard::onMsgFormFocusRecieved() -- cgit v1.2.3