Removed image URL callback from LLWebProfile for ACME-657

meow-7.2.2
Cho 2013-07-01 23:27:52 +01:00
parent 90b5bd5148
commit fa1e0e486a
3 changed files with 10 additions and 41 deletions

View File

@ -101,7 +101,6 @@ public:
// Grab some graph data now that we are connected
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTED);
LLFacebookConnect::instance().loadFacebookFriends();
}
else
{
@ -204,7 +203,6 @@ public:
// Grab some graph data if already connected
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTED);
LLFacebookConnect::instance().loadFacebookFriends();
}
else
{

View File

@ -62,8 +62,8 @@ class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder
LOG_CLASS(LLWebProfileResponders::ConfigResponder);
public:
ConfigResponder(LLPointer<LLImageFormatted> imagep, LLWebProfile::image_url_callback_t cb)
: mImagep(imagep), mImageCallback(cb)
ConfigResponder(LLPointer<LLImageFormatted> 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<LLImageFormatted> 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<LLImageFormatted> image, const std::string& caption, bool add_location, LLWebProfile::image_url_callback_t cb)
void LLWebProfile::uploadImage(LLPointer<LLImageFormatted> 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<LLImageFormatted> 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<LLImageFormatted> image, const LLSD& config, const std::string& url, LLWebProfile::image_url_callback_t cb)
void LLWebProfile::post(LLPointer<LLImageFormatted> image, const LLSD& config, const std::string& url)
{
if (dynamic_cast<LLImagePNG*>(image.get()) == 0)
{
@ -309,7 +281,7 @@ void LLWebProfile::post(LLPointer<LLImageFormatted> 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

View File

@ -48,9 +48,8 @@ class LLWebProfile
public:
typedef boost::function<void(bool ok)> status_callback_t;
typedef boost::function<void(const std::string& image_url)> image_url_callback_t;
static void uploadImage(LLPointer<LLImageFormatted> image, const std::string& caption, bool add_location, image_url_callback_t cb = image_url_callback_t());
static void uploadImage(LLPointer<LLImageFormatted> image, const std::string& caption, bool add_location);
static void setAuthCookie(const std::string& cookie);
static void setImageUploadResultCallback(status_callback_t cb) { mStatusCallback = cb; }
@ -59,7 +58,7 @@ private:
friend class LLWebProfileResponders::PostImageResponder;
friend class LLWebProfileResponders::PostImageRedirectResponder;
static void post(LLPointer<LLImageFormatted> image, const LLSD& config, const std::string& url, image_url_callback_t cb);
static void post(LLPointer<LLImageFormatted> image, const LLSD& config, const std::string& url);
static void reportImageUploadStatus(bool ok);
static std::string getAuthCookie();