aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterpostcard.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llfloaterpostcard.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloaterpostcard.cpp48
1 files changed, 43 insertions, 5 deletions
diff --git a/linden/indra/newview/llfloaterpostcard.cpp b/linden/indra/newview/llfloaterpostcard.cpp
index d6c66e3..036ce38 100644
--- a/linden/indra/newview/llfloaterpostcard.cpp
+++ b/linden/indra/newview/llfloaterpostcard.cpp
@@ -58,6 +58,8 @@
58#include "llvfs.h" 58#include "llvfs.h"
59#include "viewer.h" 59#include "viewer.h"
60 60
61#include "llassetuploadresponders.h"
62
61///---------------------------------------------------------------------------- 63///----------------------------------------------------------------------------
62/// Local function declarations, constants, enums, and typedefs 64/// Local function declarations, constants, enums, and typedefs
63///---------------------------------------------------------------------------- 65///----------------------------------------------------------------------------
@@ -70,8 +72,8 @@ LLLinkedList<LLFloaterPostcard> LLFloaterPostcard::sInstances;
70 72
71LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global) 73LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global)
72: LLFloater("Postcard Floater"), 74: LLFloater("Postcard Floater"),
73 mViewerImage(img),
74 mJPEGImage(jpeg), 75 mJPEGImage(jpeg),
76 mViewerImage(img),
75 mImageScale(img_scale), 77 mImageScale(img_scale),
76 mPosTakenGlobal(pos_taken_global) 78 mPosTakenGlobal(pos_taken_global)
77{ 79{
@@ -157,7 +159,7 @@ LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLImag
157 gFloaterView->getNewFloaterPosition(&left, &top); 159 gFloaterView->getNewFloaterPosition(&left, &top);
158 instance->setOrigin(left, top - instance->getRect().getHeight()); 160 instance->setOrigin(left, top - instance->getRect().getHeight());
159 161
160 instance->open(); 162 instance->open(); /*Flawfinder: ignore*/
161 163
162 return instance; 164 return instance;
163} 165}
@@ -225,6 +227,23 @@ void LLFloaterPostcard::onClickCancel(void* data)
225 } 227 }
226} 228}
227 229
230class LLSendPostcardResponder : public LLAssetUploadResponder
231{
232public:
233 LLSendPostcardResponder(const LLSD &post_data,
234 const LLUUID& vfile_id,
235 LLAssetType::EType asset_type):
236 LLAssetUploadResponder(post_data, vfile_id, asset_type)
237 {
238 }
239 // *TODO define custom uploadFailed here so it's not such a generic message
240 void LLSendPostcardResponder::uploadComplete(const LLSD& content)
241 {
242 // we don't care about what the server returns from this post, just clean up the UI
243 LLUploadDialog::modalUploadFinished();
244 }
245};
246
228// static 247// static
229void LLFloaterPostcard::onClickSend(void* data) 248void LLFloaterPostcard::onClickSend(void* data)
230{ 249{
@@ -249,12 +268,31 @@ void LLFloaterPostcard::onClickSend(void* data)
249 268
250 if (self->mJPEGImage.notNull()) 269 if (self->mJPEGImage.notNull())
251 { 270 {
252 // upload the image
253 self->mTransactionID.generate(); 271 self->mTransactionID.generate();
254 self->mAssetID = self->mTransactionID.makeAssetID(gAgent.getSecureSessionID()); 272 self->mAssetID = self->mTransactionID.makeAssetID(gAgent.getSecureSessionID());
255 LLVFile::writeFile(self->mJPEGImage->getData(), self->mJPEGImage->getDataSize(), gVFS, self->mAssetID, LLAssetType::AT_IMAGE_JPEG); 273 LLVFile::writeFile(self->mJPEGImage->getData(), self->mJPEGImage->getDataSize(), gVFS, self->mAssetID, LLAssetType::AT_IMAGE_JPEG);
256 274
257 gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)self, FALSE); 275 // upload the image
276 std::string url = gAgent.getRegion()->getCapability("SendPostcard");
277 if(!url.empty())
278 {
279 llinfos << "Send Postcard via capability" << llendl;
280 LLSD body = LLSD::emptyMap();
281 // the capability already encodes: agent ID, region ID
282 body["pos-global"] = self->mPosTakenGlobal.getValue();
283 body["to"] = self->childGetValue("to_form").asString();
284 body["from"] = self->childGetValue("from_form").asString();
285 body["name"] = self->childGetValue("name_form").asString();
286 body["subject"] = self->childGetValue("subject_form").asString();
287 body["msg"] = self->childGetValue("msg_form").asString();
288 body["allow-publish"] = self->childGetValue("allow_publish_check").asBoolean();
289 body["mature-publish"] = self->childGetValue("mature_check").asBoolean();
290 LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, self->mAssetID, LLAssetType::AT_IMAGE_JPEG));
291 }
292 else
293 {
294 gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)self, FALSE);
295 }
258 296
259 LLUploadDialog::modalUploadDialog("Uploading...\n\nPostcard"); 297 LLUploadDialog::modalUploadDialog("Uploading...\n\nPostcard");
260 298