From bf6182daa8b4d7cea79310547f71d7a3155e17b0 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 29 Mar 2013 07:50:08 -0700 Subject: Update Mac and Windows breakpad builds to latest --- indra/newview/llwebprofile.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/newview/llwebprofile.cpp (limited to 'indra/newview/llwebprofile.cpp') diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp old mode 100644 new mode 100755 -- cgit v1.2.3 From 4d162e1ec2cd716f40666056bb9e2710958e3360 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 5 Jun 2013 23:52:34 +0100 Subject: added callback to post photo with actual image url --- indra/newview/llwebprofile.cpp | 48 +++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'indra/newview/llwebprofile.cpp') diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 641f338f2c..4bc4724753 100755 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -62,8 +62,8 @@ class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder LOG_CLASS(LLWebProfileResponders::ConfigResponder); public: - ConfigResponder(LLPointer imagep) - : mImagep(imagep) + ConfigResponder(LLPointer imagep, const std::string& caption, LLWebProfile::image_url_callback_t cb) + : mImagep(imagep), mImageCaption(caption), mImageCallback(cb) { } @@ -113,11 +113,13 @@ public: // Do the actual image upload using the configuration. LL_DEBUGS("Snapshots") << "Got upload config, POSTing image to " << upload_url << ", config=[" << config << "]" << llendl; - LLWebProfile::post(mImagep, config, upload_url); + LLWebProfile::post(mImagep, config, upload_url, mImageCaption, mImageCallback); } private: LLPointer mImagep; + std::string mImageCaption; + LLWebProfile::image_url_callback_t mImageCallback; }; /////////////////////////////////////////////////////////////////////////////// @@ -127,6 +129,22 @@ class LLWebProfileResponders::PostImageRedirectResponder : public LLHTTPClient:: LOG_CLASS(LLWebProfileResponders::PostImageRedirectResponder); public: + PostImageRedirectResponder(const std::string& caption, LLWebProfile::image_url_callback_t cb) + : mImageCaption(caption), mImageCallback(cb) + { + } + + /*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + if (status == 200) + { + std::string image_url = content.get("Location"); + llinfos << "Image uploaded to " << image_url << llendl; + if (!mImageCallback.empty() && !image_url.empty()) + mImageCallback(image_url, mImageCaption); + } + } + /*virtual*/ void completedRaw( U32 status, const std::string& reason, @@ -148,9 +166,10 @@ public: LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << body << "]" << llendl; LLWebProfile::reportImageUploadStatus(true); } - + private: - LLPointer mImagep; + std::string mImageCaption; + LLWebProfile::image_url_callback_t mImageCallback; }; @@ -161,6 +180,11 @@ class LLWebProfileResponders::PostImageResponder : public LLHTTPClient::Responde LOG_CLASS(LLWebProfileResponders::PostImageResponder); public: + PostImageResponder(const std::string& caption, LLWebProfile::image_url_callback_t cb) + : mImageCaption(caption), mImageCallback(cb) + { + } + /*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content) { // Viewer seems to fail to follow a 303 redirect on POST request @@ -172,7 +196,7 @@ public: headers["Cookie"] = LLWebProfile::getAuthCookie(); const std::string& redir_url = content["location"]; LL_DEBUGS("Snapshots") << "Got redirection URL: " << redir_url << llendl; - LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder, headers); + LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder(mImageCaption, mImageCallback), headers); } else { @@ -188,6 +212,10 @@ public: const LLIOPipe::buffer_ptr_t& buffer) { } + +private: + std::string mImageCaption; + LLWebProfile::image_url_callback_t mImageCallback; }; /////////////////////////////////////////////////////////////////////////////// @@ -197,7 +225,7 @@ std::string LLWebProfile::sAuthCookie; LLWebProfile::status_callback_t LLWebProfile::mStatusCallback; // static -void LLWebProfile::uploadImage(LLPointer image, const std::string& caption, bool add_location) +void LLWebProfile::uploadImage(LLPointer image, const std::string& caption, bool add_location, LLWebProfile::image_url_callback_t cb) { // Get upload configuration data. std::string config_url(getProfileURL(LLStringUtil::null) + "snapshots/s3_upload_config"); @@ -207,7 +235,7 @@ void LLWebProfile::uploadImage(LLPointer image, const std::str LL_DEBUGS("Snapshots") << "Requesting " << config_url << llendl; LLSD headers = LLViewerMedia::getHeaders(); headers["Cookie"] = getAuthCookie(); - LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image), headers); + LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image, caption, cb), headers); } // static @@ -218,7 +246,7 @@ void LLWebProfile::setAuthCookie(const std::string& cookie) } // static -void LLWebProfile::post(LLPointer image, const LLSD& config, const std::string& url) +void LLWebProfile::post(LLPointer image, const LLSD& config, const std::string& url, const std::string& caption, LLWebProfile::image_url_callback_t cb) { if (dynamic_cast(image.get()) == 0) { @@ -284,7 +312,7 @@ void LLWebProfile::post(LLPointer image, const LLSD& config, c memcpy(data, body.str().data(), size); // Send request, successful upload will trigger posting metadata. - LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(), headers); + LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(caption, cb), headers); } // static -- cgit v1.2.3 From 9232d919c8571743d9f5c899b80e2807f131f4d3 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 6 Jun 2013 00:09:59 +0100 Subject: removed unnecessary passing of image caption --- indra/newview/llwebprofile.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'indra/newview/llwebprofile.cpp') diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 4bc4724753..6923724de2 100755 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -62,8 +62,8 @@ class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder LOG_CLASS(LLWebProfileResponders::ConfigResponder); public: - ConfigResponder(LLPointer imagep, const std::string& caption, LLWebProfile::image_url_callback_t cb) - : mImagep(imagep), mImageCaption(caption), mImageCallback(cb) + ConfigResponder(LLPointer imagep, LLWebProfile::image_url_callback_t cb) + : mImagep(imagep), mImageCallback(cb) { } @@ -113,12 +113,11 @@ public: // Do the actual image upload using the configuration. LL_DEBUGS("Snapshots") << "Got upload config, POSTing image to " << upload_url << ", config=[" << config << "]" << llendl; - LLWebProfile::post(mImagep, config, upload_url, mImageCaption, mImageCallback); + LLWebProfile::post(mImagep, config, upload_url, mImageCallback); } private: LLPointer mImagep; - std::string mImageCaption; LLWebProfile::image_url_callback_t mImageCallback; }; @@ -129,8 +128,8 @@ class LLWebProfileResponders::PostImageRedirectResponder : public LLHTTPClient:: LOG_CLASS(LLWebProfileResponders::PostImageRedirectResponder); public: - PostImageRedirectResponder(const std::string& caption, LLWebProfile::image_url_callback_t cb) - : mImageCaption(caption), mImageCallback(cb) + PostImageRedirectResponder(LLWebProfile::image_url_callback_t cb) + : mImageCallback(cb) { } @@ -141,7 +140,7 @@ public: std::string image_url = content.get("Location"); llinfos << "Image uploaded to " << image_url << llendl; if (!mImageCallback.empty() && !image_url.empty()) - mImageCallback(image_url, mImageCaption); + mImageCallback(image_url); } } @@ -168,7 +167,6 @@ public: } private: - std::string mImageCaption; LLWebProfile::image_url_callback_t mImageCallback; }; @@ -180,8 +178,8 @@ class LLWebProfileResponders::PostImageResponder : public LLHTTPClient::Responde LOG_CLASS(LLWebProfileResponders::PostImageResponder); public: - PostImageResponder(const std::string& caption, LLWebProfile::image_url_callback_t cb) - : mImageCaption(caption), mImageCallback(cb) + PostImageResponder(LLWebProfile::image_url_callback_t cb) + : mImageCallback(cb) { } @@ -196,7 +194,7 @@ public: headers["Cookie"] = LLWebProfile::getAuthCookie(); const std::string& redir_url = content["location"]; LL_DEBUGS("Snapshots") << "Got redirection URL: " << redir_url << llendl; - LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder(mImageCaption, mImageCallback), headers); + LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder(mImageCallback), headers); } else { @@ -214,7 +212,6 @@ public: } private: - std::string mImageCaption; LLWebProfile::image_url_callback_t mImageCallback; }; @@ -235,7 +232,7 @@ void LLWebProfile::uploadImage(LLPointer image, const std::str LL_DEBUGS("Snapshots") << "Requesting " << config_url << llendl; LLSD headers = LLViewerMedia::getHeaders(); headers["Cookie"] = getAuthCookie(); - LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image, caption, cb), headers); + LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image, cb), headers); } // static @@ -246,7 +243,7 @@ void LLWebProfile::setAuthCookie(const std::string& cookie) } // static -void LLWebProfile::post(LLPointer image, const LLSD& config, const std::string& url, const std::string& caption, LLWebProfile::image_url_callback_t cb) +void LLWebProfile::post(LLPointer image, const LLSD& config, const std::string& url, LLWebProfile::image_url_callback_t cb) { if (dynamic_cast(image.get()) == 0) { @@ -312,7 +309,7 @@ void LLWebProfile::post(LLPointer image, const LLSD& config, c memcpy(data, body.str().data(), size); // Send request, successful upload will trigger posting metadata. - LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(caption, cb), headers); + LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(cb), headers); } // static -- cgit v1.2.3 From fa1e0e486a2c32911e6bfe9d72264c3d9ebe1d9f Mon Sep 17 00:00:00 2001 From: Cho Date: Mon, 1 Jul 2013 23:27:52 +0100 Subject: Removed image URL callback from LLWebProfile for ACME-657 --- indra/newview/llwebprofile.cpp | 44 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 36 deletions(-) (limited to 'indra/newview/llwebprofile.cpp') diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 6923724de2..69255af179 100755 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -62,8 +62,8 @@ class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder LOG_CLASS(LLWebProfileResponders::ConfigResponder); public: - ConfigResponder(LLPointer imagep, LLWebProfile::image_url_callback_t cb) - : mImagep(imagep), mImageCallback(cb) + ConfigResponder(LLPointer imagep) + : mImagep(imagep) { } @@ -113,12 +113,11 @@ public: // Do the actual image upload using the configuration. LL_DEBUGS("Snapshots") << "Got upload config, POSTing image to " << upload_url << ", config=[" << config << "]" << llendl; - LLWebProfile::post(mImagep, config, upload_url, mImageCallback); + LLWebProfile::post(mImagep, config, upload_url); } private: LLPointer mImagep; - LLWebProfile::image_url_callback_t mImageCallback; }; /////////////////////////////////////////////////////////////////////////////// @@ -128,22 +127,6 @@ class LLWebProfileResponders::PostImageRedirectResponder : public LLHTTPClient:: LOG_CLASS(LLWebProfileResponders::PostImageRedirectResponder); public: - PostImageRedirectResponder(LLWebProfile::image_url_callback_t cb) - : mImageCallback(cb) - { - } - - /*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content) - { - if (status == 200) - { - std::string image_url = content.get("Location"); - llinfos << "Image uploaded to " << image_url << llendl; - if (!mImageCallback.empty() && !image_url.empty()) - mImageCallback(image_url); - } - } - /*virtual*/ void completedRaw( U32 status, const std::string& reason, @@ -165,9 +148,6 @@ public: LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << body << "]" << llendl; LLWebProfile::reportImageUploadStatus(true); } - -private: - LLWebProfile::image_url_callback_t mImageCallback; }; @@ -178,11 +158,6 @@ class LLWebProfileResponders::PostImageResponder : public LLHTTPClient::Responde LOG_CLASS(LLWebProfileResponders::PostImageResponder); public: - PostImageResponder(LLWebProfile::image_url_callback_t cb) - : mImageCallback(cb) - { - } - /*virtual*/ void completedHeader(U32 status, const std::string& reason, const LLSD& content) { // Viewer seems to fail to follow a 303 redirect on POST request @@ -194,7 +169,7 @@ public: headers["Cookie"] = LLWebProfile::getAuthCookie(); const std::string& redir_url = content["location"]; LL_DEBUGS("Snapshots") << "Got redirection URL: " << redir_url << llendl; - LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder(mImageCallback), headers); + LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder(), headers); } else { @@ -210,9 +185,6 @@ public: const LLIOPipe::buffer_ptr_t& buffer) { } - -private: - LLWebProfile::image_url_callback_t mImageCallback; }; /////////////////////////////////////////////////////////////////////////////// @@ -222,7 +194,7 @@ std::string LLWebProfile::sAuthCookie; LLWebProfile::status_callback_t LLWebProfile::mStatusCallback; // static -void LLWebProfile::uploadImage(LLPointer image, const std::string& caption, bool add_location, LLWebProfile::image_url_callback_t cb) +void LLWebProfile::uploadImage(LLPointer image, const std::string& caption, bool add_location) { // Get upload configuration data. std::string config_url(getProfileURL(LLStringUtil::null) + "snapshots/s3_upload_config"); @@ -232,7 +204,7 @@ void LLWebProfile::uploadImage(LLPointer image, const std::str LL_DEBUGS("Snapshots") << "Requesting " << config_url << llendl; LLSD headers = LLViewerMedia::getHeaders(); headers["Cookie"] = getAuthCookie(); - LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image, cb), headers); + LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image), headers); } // static @@ -243,7 +215,7 @@ void LLWebProfile::setAuthCookie(const std::string& cookie) } // static -void LLWebProfile::post(LLPointer image, const LLSD& config, const std::string& url, LLWebProfile::image_url_callback_t cb) +void LLWebProfile::post(LLPointer image, const LLSD& config, const std::string& url) { if (dynamic_cast(image.get()) == 0) { @@ -309,7 +281,7 @@ void LLWebProfile::post(LLPointer image, const LLSD& config, c memcpy(data, body.str().data(), size); // Send request, successful upload will trigger posting metadata. - LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(cb), headers); + LLHTTPClient::postRaw(url, data, size, new LLWebProfileResponders::PostImageResponder(), headers); } // static -- cgit v1.2.3