summaryrefslogtreecommitdiff
path: root/indra/newview/llfloateravatarpicker.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2016-04-04 15:53:09 -0400
committerOz Linden <oz@lindenlab.com>2016-04-04 15:53:09 -0400
commit9be58e915a6c69de280ccabd3019e9ac40beed26 (patch)
treead6f8f1f754a865afb761d0f17744cc7e1ef8b74 /indra/newview/llfloateravatarpicker.cpp
parentab46c9226bd9048fa218f54bc8668594401529e7 (diff)
parent18928ea6c6f2830a0d45ec412c915eceff1b76b0 (diff)
merge with 4.0.3-release
Diffstat (limited to 'indra/newview/llfloateravatarpicker.cpp')
-rw-r--r--indra/newview/llfloateravatarpicker.cpp58
1 files changed, 27 insertions, 31 deletions
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index 566a3c9cd3..72892b47a4 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -42,7 +42,6 @@
#include "llavatarnamecache.h" // IDEVO
#include "llbutton.h"
#include "llcachename.h"
-#include "llhttpclient.h" // IDEVO
#include "lllineeditor.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
@@ -52,6 +51,7 @@
#include "llfocusmgr.h"
#include "lldraghandle.h"
#include "message.h"
+#include "llcorehttputil.h"
//#include "llsdserialize.h"
@@ -456,39 +456,33 @@ BOOL LLFloaterAvatarPicker::visibleItemsSelected() const
return FALSE;
}
-class LLAvatarPickerResponder : public LLHTTPClient::Responder
+/*static*/
+void LLFloaterAvatarPicker::findCoro(std::string url, LLUUID queryID, std::string name)
{
- LOG_CLASS(LLAvatarPickerResponder);
-public:
- LLUUID mQueryID;
- std::string mName;
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
- LLAvatarPickerResponder(const LLUUID& id, const std::string& name) : mQueryID(id), mName(name) { }
+ LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL;
-protected:
- /*virtual*/ void httpCompleted()
- {
- //std::ostringstream ss;
- //LLSDSerialize::toPrettyXML(content, ss);
- //LL_INFOS() << ss.str() << LL_ENDL;
+ LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ if (status || (status == LLCore::HttpStatus(HTTP_BAD_REQUEST)))
+ {
+ LLFloaterAvatarPicker* floater =
+ LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker", name);
+ if (floater)
+ {
+ result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
+ floater->processResponse(queryID, result);
+ }
+ }
+}
- // in case of invalid characters, the avatar picker returns a 400
- // just set it to process so it displays 'not found'
- if (isGoodStatus() || getStatus() == HTTP_BAD_REQUEST)
- {
- LLFloaterAvatarPicker* floater =
- LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker", mName);
- if (floater)
- {
- floater->processResponse(mQueryID, getContent());
- }
- }
- else
- {
- LL_WARNS() << "avatar picker failed " << dumpResponse() << LL_ENDL;
- }
- }
-};
void LLFloaterAvatarPicker::find()
{
@@ -517,7 +511,9 @@ void LLFloaterAvatarPicker::find()
std::replace(text.begin(), text.end(), '.', ' ');
url += LLURI::escape(text);
LL_INFOS() << "avatar picker " << url << LL_ENDL;
- LLHTTPClient::get(url, new LLAvatarPickerResponder(mQueryID, getKey().asString()));
+
+ LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro",
+ boost::bind(&LLFloaterAvatarPicker::findCoro, url, mQueryID, getKey().asString()));
}
else
{