From c4bcc83336c623b97e982443ce2f91d82d1a187d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 16 Apr 2015 17:01:10 -0700 Subject: Facebook conversion. --- indra/newview/llfacebookconnect.cpp | 396 +++++++++++++++++++++++++++++++++++- 1 file changed, 393 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 28319564e4..dc50ec81f1 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -45,6 +45,7 @@ #include "llfloaterwebcontent.h" #include "llfloaterreg.h" +#include "llcorehttputil.h" boost::scoped_ptr LLFacebookConnect::sStateWatcher(new LLEventStream("FacebookConnectState")); boost::scoped_ptr LLFacebookConnect::sInfoWatcher(new LLEventStream("FacebookConnectInfo")); @@ -125,6 +126,58 @@ LLFacebookConnectHandler gFacebookConnectHandler; /////////////////////////////////////////////////////////////////////////////// // +#if 1 + +void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string authCode, std::string authState) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + + LLSD putData; + if (!authCode.empty()) + { + putData["code"] = authCode; + } + if (!authState.empty()) + { + putData["state"] = authState; + } + + httpOpts->setWantHeaders(true); + + setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); + + LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + if (!status) + { + if (status == LLCore::HttpStatus(HTTP_FOUND)) + { + std::string location = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS][HTTP_IN_HEADER_LOCATION]; + if (location.empty()) + { + LL_WARNS("FacebookConnect") << "Missing Location header " << LL_ENDL; + } + else + { + openFacebookWeb(location); + } + } + } + else + { + LL_INFOS("FacebookConnect") << "Connect successful. " << LL_ENDL; + setConnectionState(LLFacebookConnect::FB_CONNECTED); + } + +} + +#else class LLFacebookConnectResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookConnectResponder); @@ -166,9 +219,129 @@ public: } } }; +#endif /////////////////////////////////////////////////////////////////////////////// // +#if 1 +bool LLFacebookConnect::testShareStatus(LLSD &result) +{ + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + + if (status) + return true; + + if (status == LLCore::HttpStatus(HTTP_FOUND)) + { + std::string location = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS][HTTP_IN_HEADER_LOCATION]; + if (location.empty()) + { + LL_WARNS("FacebookConnect") << "Missing Location header " << LL_ENDL; + } + else + { + openFacebookWeb(location); + } + } + if (status == LLCore::HttpStatus(HTTP_NOT_FOUND)) + { + LL_DEBUGS("FacebookConnect") << "Not connected. " << LL_ENDL; + connectToFacebook(); + } + else + { + LL_WARNS("FacebookConnect") << "HTTP Status error " << status.toString() << LL_ENDL; + setConnectionState(LLFacebookConnect::FB_POST_FAILED); + log_facebook_connect_error("Share", status.getStatus(), status.toString(), + result.get("error_code"), result.get("error_description")); + } + return false; +} + +void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route, LLSD share) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + + setConnectionState(LLFacebookConnect::FB_POSTING); + + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share); + + if (testShareStatus(result)) + { + toast_user_for_facebook_success(); + LL_DEBUGS("FacebookConnect") << "Post successful. " << LL_ENDL; + setConnectionState(LLFacebookConnect::FB_POSTED); + } +} + +void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string route, LLPointer image, std::string caption) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + + std::string imageFormat; + if (dynamic_cast(image.get())) + { + imageFormat = "png"; + } + else if (dynamic_cast(image.get())) + { + imageFormat = "jpg"; + } + else + { + LL_WARNS() << "Image to upload is not a PNG or JPEG" << LL_ENDL; + return; + } + + // All this code is mostly copied from LLWebProfile::post() + static const std::string boundary = "----------------------------0123abcdefab"; + + std::string contentType = "multipart/form-data; boundary=" + boundary; + httpHeaders->append("Content-Type", contentType.c_str()); + + LLCore::BufferArray::ptr_t raw = LLCore::BufferArray::ptr_t(new LLCore::BufferArray(), false); // + LLCore::BufferArrayStream body(raw.get()); + + // *NOTE: The order seems to matter. + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"caption\"\r\n\r\n" + << caption << "\r\n"; + + body << "--" << boundary << "\r\n" + << "Content-Disposition: form-data; name=\"image\"; filename=\"Untitled." << imageFormat << "\"\r\n" + << "Content-Type: image/" << imageFormat << "\r\n\r\n"; + + // Insert the image data. + // *FIX: Treating this as a string will probably screw it up ... + U8* image_data = image->getData(); + for (S32 i = 0; i < image->getDataSize(); ++i) + { + body << image_data[i]; + } + + body << "\r\n--" << boundary << "--\r\n"; + + setConnectionState(LLFacebookConnect::FB_POSTING); + + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), raw, httpHeaders); + + if (testShareStatus(result)) + { + toast_user_for_facebook_success(); + LL_DEBUGS("FacebookConnect") << "Post successful. " << LL_ENDL; + setConnectionState(LLFacebookConnect::FB_POSTED); + } +} + +#else class LLFacebookShareResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookShareResponder); @@ -215,9 +388,43 @@ public: } } }; +#endif /////////////////////////////////////////////////////////////////////////////// // +#if 1 +void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + + setConnectionState(LLFacebookConnect::FB_DISCONNECTING); + + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection")); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + if (!status && (status != LLCore::HttpStatus(HTTP_FOUND))) + { + LL_WARNS("FacebookConnect") << "Failed to disconnect:" << status.toTerseString() << LL_ENDL; + setConnectionState(LLFacebookConnect::FB_DISCONNECT_FAILED); + log_facebook_connect_error("Disconnect", status.getStatus(), status.toString(), + result.get("error_code"), result.get("error_description")); + } + else + { + LL_DEBUGS("FacebookConnect") << "Facebook Disconnect successful. " << LL_ENDL; + clearInfo(); + clearContent(); + //Notify state change + setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED); + } + +} + +#else class LLFacebookDisconnectResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookDisconnectResponder); @@ -261,9 +468,56 @@ public: } } }; +#endif /////////////////////////////////////////////////////////////////////////////// // +#if 1 +void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool autoConnect) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + + setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); + + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true)); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + + if (!status) + { + if ( status == LLCore::HttpStatus(HTTP_NOT_FOUND) ) + { + LL_DEBUGS("FacebookConnect") << "Not connected. " << LL_ENDL; + if (autoConnect) + { + connectToFacebook(); + } + else + { + setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED); + } + } + else + { + LL_WARNS("FacebookConnect") << "Failed to test connection:" << status.toTerseString() << LL_ENDL; + + setConnectionState(LLFacebookConnect::FB_DISCONNECT_FAILED); + log_facebook_connect_error("Connected", status.getStatus(), status.toString(), + result.get("error_code"), result.get("error_description")); + } + } + else + { + LL_DEBUGS("FacebookConnect") << "Connect successful. " << LL_ENDL; + setConnectionState(LLFacebookConnect::FB_CONNECTED); + } +} + +#else class LLFacebookConnectedResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookConnectedResponder); @@ -308,9 +562,50 @@ public: private: bool mAutoConnect; }; +#endif /////////////////////////////////////////////////////////////////////////////// // +#if 1 +void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true)); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + + if (status == LLCore::HttpStatus(HTTP_FOUND)) + { + std::string location = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS][HTTP_IN_HEADER_LOCATION]; + if (location.empty()) + { + LL_WARNS("FacebookConnect") << "Missing Location header " << LL_ENDL; + } + else + { + openFacebookWeb(location); + } + } + else if (!status) + { + LL_WARNS("FacebookConnect") << "Facebook Info failed: " << status.toString() << LL_ENDL; + log_facebook_connect_error("Info", status.getStatus(), status.toString(), + result.get("error_code"), result.get("error_description")); + } + else + { + LL_INFOS("FacebookConnect") << "Facebook: Info received" << LL_ENDL; + result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); + storeInfo(result); + } +} + +#else class LLFacebookInfoResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookInfoResponder); @@ -347,9 +642,51 @@ public: } } }; +#endif /////////////////////////////////////////////////////////////////////////////// // +#if 1 +void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true)); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + + if (status == LLCore::HttpStatus(HTTP_FOUND)) + { + std::string location = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS][HTTP_IN_HEADER_LOCATION]; + if (location.empty()) + { + LL_WARNS("FacebookConnect") << "Missing Location header " << LL_ENDL; + } + else + { + openFacebookWeb(location); + } + } + else if (!status) + { + LL_WARNS("FacebookConnect") << "Facebook Friends failed: " << status.toString() << LL_ENDL; + log_facebook_connect_error("Info", status.getStatus(), status.toString(), + result.get("error_code"), result.get("error_description")); + } + else + { + LL_INFOS("FacebookConnect") << "Facebook: Friends received" << LL_ENDL; + result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); + LLSD content = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT]; + storeContent(content); + } +} + +#else class LLFacebookFriendsResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookFriendsResponder); @@ -385,6 +722,7 @@ public: } } }; +#endif /////////////////////////////////////////////////////////////////////////////// // @@ -439,6 +777,11 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const std::string& auth_state) { +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookConnectCoro", + boost::bind(&LLFacebookConnect::facebookConnectCoro, this, _1, auth_code, auth_state)); + +#else LLSD body; if (!auth_code.empty()) { @@ -450,29 +793,48 @@ void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const st } LLHTTPClient::put(getFacebookConnectURL("/connection"), body, new LLFacebookConnectResponder()); +#endif } void LLFacebookConnect::disconnectFromFacebook() { - LLHTTPClient::del(getFacebookConnectURL("/connection"), new LLFacebookDisconnectResponder()); +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookDisconnectCoro", + boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this, _1)); + +#else + LLHTTPClient::del(getFacebookConnectURL("/connection"), new LLFacebookDisconnectResponder()); +#endif } void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", + boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, _1, auto_connect)); + +#else const bool follow_redirects = false; const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; LLHTTPClient::get(getFacebookConnectURL("/connection", true), new LLFacebookConnectedResponder(auto_connect), LLSD(), timeout, follow_redirects); +#endif } void LLFacebookConnect::loadFacebookInfo() { if(mRefreshInfo) { +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookConnectInfoCoro", + boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this, _1)); + +#else const bool follow_redirects = false; const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; LLHTTPClient::get(getFacebookConnectURL("/info", true), new LLFacebookInfoResponder(), LLSD(), timeout, follow_redirects); +#endif } } @@ -480,14 +842,21 @@ void LLFacebookConnect::loadFacebookFriends() { if(mRefreshContent) { +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookConnectFriendsCoro", + boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this, _1)); +#else + const bool follow_redirects = false; const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; LLHTTPClient::get(getFacebookConnectURL("/friends", true), new LLFacebookFriendsResponder(), LLSD(), timeout, follow_redirects); +#endif } } -void LLFacebookConnect::postCheckin(const std::string& location, const std::string& name, const std::string& description, const std::string& image, const std::string& message) +void LLFacebookConnect::postCheckin(const std::string& location, const std::string& name, + const std::string& description, const std::string& image, const std::string& message) { LLSD body; if (!location.empty()) @@ -511,22 +880,37 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri body["message"] = message; } +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/checkin", body)); +#else // Note: we can use that route for different publish action. We should be able to use the same responder. LLHTTPClient::post(getFacebookConnectURL("/share/checkin", true), body, new LLFacebookShareResponder()); +#endif } void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) { + // *TODO: I could not find an instace where this method is used. Remove? LLSD body; body["image"] = image_url; body["caption"] = caption; +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/photo", body)); +#else // Note: we can use that route for different publish action. We should be able to use the same responder. LLHTTPClient::post(getFacebookConnectURL("/share/photo", true), body, new LLFacebookShareResponder()); +#endif } void LLFacebookConnect::sharePhoto(LLPointer image, const std::string& caption) { +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookShareImageCoro", + boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, _1, "/share/photo", image, caption)); +#else std::string imageFormat; if (dynamic_cast(image.get())) { @@ -576,15 +960,21 @@ void LLFacebookConnect::sharePhoto(LLPointer image, const std: // Note: we can use that route for different publish action. We should be able to use the same responder. LLHTTPClient::postRaw(getFacebookConnectURL("/share/photo", true), data, size, new LLFacebookShareResponder(), headers); +#endif } void LLFacebookConnect::updateStatus(const std::string& message) { LLSD body; body["message"] = message; - + +#if 1 + LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/wall", body)); +#else // Note: we can use that route for different publish action. We should be able to use the same responder. LLHTTPClient::post(getFacebookConnectURL("/share/wall", true), body, new LLFacebookShareResponder()); +#endif } void LLFacebookConnect::storeInfo(const LLSD& info) -- cgit v1.2.3 From 6b8fecb8b084ebe054fb0314d34e04f48fe48b1e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 17 Apr 2015 08:53:08 -0700 Subject: Removed the excluded code blocks. --- indra/newview/llfacebookconnect.cpp | 381 ------------------------------------ 1 file changed, 381 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index dc50ec81f1..680b7677af 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -126,8 +126,6 @@ LLFacebookConnectHandler gFacebookConnectHandler; /////////////////////////////////////////////////////////////////////////////// // -#if 1 - void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string authCode, std::string authState) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -177,53 +175,8 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut } -#else -class LLFacebookConnectResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLFacebookConnectResponder); -public: - - LLFacebookConnectResponder() - { - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - } - - /* virtual */ void httpSuccess() - { - LL_DEBUGS("FacebookConnect") << "Connect successful. " << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTED); - } - - /* virtual */ void httpFailure() - { - if ( HTTP_FOUND == getStatus() ) - { - const std::string& location = getResponseHeader(HTTP_IN_HEADER_LOCATION); - if (location.empty()) - { - LL_WARNS("FacebookConnect") << "Missing Location header " << dumpResponse() - << "[headers:" << getResponseHeaders() << "]" << LL_ENDL; - } - else - { - LLFacebookConnect::instance().openFacebookWeb(location); - } - } - else - { - LL_WARNS("FacebookConnect") << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTION_FAILED); - const LLSD& content = getContent(); - log_facebook_connect_error("Connect", getStatus(), getReason(), - content.get("error_code"), content.get("error_description")); - } - } -}; -#endif - /////////////////////////////////////////////////////////////////////////////// // -#if 1 bool LLFacebookConnect::testShareStatus(LLSD &result) { LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -341,58 +294,8 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string } } -#else -class LLFacebookShareResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLFacebookShareResponder); -public: - - LLFacebookShareResponder() - { - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_POSTING); - } - - /* virtual */ void httpSuccess() - { - toast_user_for_facebook_success(); - LL_DEBUGS("FacebookConnect") << "Post successful. " << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_POSTED); - } - - /* virtual */ void httpFailure() - { - if ( HTTP_FOUND == getStatus() ) - { - const std::string& location = getResponseHeader(HTTP_IN_HEADER_LOCATION); - if (location.empty()) - { - LL_WARNS("FacebookConnect") << "Missing Location header " << dumpResponse() - << "[headers:" << getResponseHeaders() << "]" << LL_ENDL; - } - else - { - LLFacebookConnect::instance().openFacebookWeb(location); - } - } - else if ( HTTP_NOT_FOUND == getStatus() ) - { - LLFacebookConnect::instance().connectToFacebook(); - } - else - { - LL_WARNS("FacebookConnect") << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_POST_FAILED); - const LLSD& content = getContent(); - log_facebook_connect_error("Share", getStatus(), getReason(), - content.get("error_code"), content.get("error_description")); - } - } -}; -#endif - /////////////////////////////////////////////////////////////////////////////// // -#if 1 void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -424,55 +327,8 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) } -#else -class LLFacebookDisconnectResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLFacebookDisconnectResponder); -public: - - LLFacebookDisconnectResponder() - { - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECTING); - } - - void setUserDisconnected() - { - // Clear data - LLFacebookConnect::instance().clearInfo(); - LLFacebookConnect::instance().clearContent(); - //Notify state change - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED); - } - - /* virtual */ void httpSuccess() - { - LL_DEBUGS("FacebookConnect") << "Disconnect successful. " << dumpResponse() << LL_ENDL; - setUserDisconnected(); - } - - /* virtual */ void httpFailure() - { - //User not found so already disconnected - if ( HTTP_NOT_FOUND == getStatus() ) - { - LL_DEBUGS("FacebookConnect") << "Already disconnected. " << dumpResponse() << LL_ENDL; - setUserDisconnected(); - } - else - { - LL_WARNS("FacebookConnect") << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECT_FAILED); - const LLSD& content = getContent(); - log_facebook_connect_error("Disconnect", getStatus(), getReason(), - content.get("error_code"), content.get("error_description")); - } - } -}; -#endif - /////////////////////////////////////////////////////////////////////////////// // -#if 1 void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool autoConnect) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -517,56 +373,8 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut } } -#else -class LLFacebookConnectedResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLFacebookConnectedResponder); -public: - - LLFacebookConnectedResponder(bool auto_connect) : mAutoConnect(auto_connect) - { - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - } - - /* virtual */ void httpSuccess() - { - LL_DEBUGS("FacebookConnect") << "Connect successful. " << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTED); - } - - /* virtual */ void httpFailure() - { - // show the facebook login page if not connected yet - if ( HTTP_NOT_FOUND == getStatus() ) - { - LL_DEBUGS("FacebookConnect") << "Not connected. " << dumpResponse() << LL_ENDL; - if (mAutoConnect) - { - LLFacebookConnect::instance().connectToFacebook(); - } - else - { - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED); - } - } - else - { - LL_WARNS("FacebookConnect") << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECT_FAILED); - const LLSD& content = getContent(); - log_facebook_connect_error("Connected", getStatus(), getReason(), - content.get("error_code"), content.get("error_description")); - } - } - -private: - bool mAutoConnect; -}; -#endif - /////////////////////////////////////////////////////////////////////////////// // -#if 1 void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -605,48 +413,8 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) } } -#else -class LLFacebookInfoResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLFacebookInfoResponder); -public: - - /* virtual */ void httpSuccess() - { - LL_INFOS("FacebookConnect") << "Facebook: Info received" << LL_ENDL; - LL_DEBUGS("FacebookConnect") << "Getting Facebook info successful. " << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().storeInfo(getContent()); - } - - /* virtual */ void httpFailure() - { - if ( HTTP_FOUND == getStatus() ) - { - const std::string& location = getResponseHeader(HTTP_IN_HEADER_LOCATION); - if (location.empty()) - { - LL_WARNS("FacebookConnect") << "Missing Location header " << dumpResponse() - << "[headers:" << getResponseHeaders() << "]" << LL_ENDL; - } - else - { - LLFacebookConnect::instance().openFacebookWeb(location); - } - } - else - { - LL_WARNS("FacebookConnect") << dumpResponse() << LL_ENDL; - const LLSD& content = getContent(); - log_facebook_connect_error("Info", getStatus(), getReason(), - content.get("error_code"), content.get("error_description")); - } - } -}; -#endif - /////////////////////////////////////////////////////////////////////////////// // -#if 1 void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -686,44 +454,6 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) } } -#else -class LLFacebookFriendsResponder : public LLHTTPClient::Responder -{ - LOG_CLASS(LLFacebookFriendsResponder); -public: - - /* virtual */ void httpSuccess() - { - LL_DEBUGS("FacebookConnect") << "Getting Facebook friends successful. " << dumpResponse() << LL_ENDL; - LLFacebookConnect::instance().storeContent(getContent()); - } - - /* virtual */ void httpFailure() - { - if ( HTTP_FOUND == getStatus() ) - { - const std::string& location = getResponseHeader(HTTP_IN_HEADER_LOCATION); - if (location.empty()) - { - LL_WARNS("FacebookConnect") << "Missing Location header " << dumpResponse() - << "[headers:" << getResponseHeaders() << "]" << LL_ENDL; - } - else - { - LLFacebookConnect::instance().openFacebookWeb(location); - } - } - else - { - LL_WARNS("FacebookConnect") << dumpResponse() << LL_ENDL; - const LLSD& content = getContent(); - log_facebook_connect_error("Friends", getStatus(), getReason(), - content.get("error_code"), content.get("error_description")); - } - } -}; -#endif - /////////////////////////////////////////////////////////////////////////////// // LLFacebookConnect::LLFacebookConnect() @@ -777,64 +507,28 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const std::string& auth_state) { -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookConnectCoro", boost::bind(&LLFacebookConnect::facebookConnectCoro, this, _1, auth_code, auth_state)); - -#else - LLSD body; - if (!auth_code.empty()) - { - body["code"] = auth_code; - } - if (!auth_state.empty()) - { - body["state"] = auth_state; - } - - LLHTTPClient::put(getFacebookConnectURL("/connection"), body, new LLFacebookConnectResponder()); -#endif } void LLFacebookConnect::disconnectFromFacebook() { -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookDisconnectCoro", boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this, _1)); - -#else - LLHTTPClient::del(getFacebookConnectURL("/connection"), new LLFacebookDisconnectResponder()); -#endif } void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, _1, auto_connect)); - -#else - const bool follow_redirects = false; - const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - LLHTTPClient::get(getFacebookConnectURL("/connection", true), new LLFacebookConnectedResponder(auto_connect), - LLSD(), timeout, follow_redirects); -#endif } void LLFacebookConnect::loadFacebookInfo() { if(mRefreshInfo) { -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookConnectInfoCoro", boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this, _1)); - -#else - const bool follow_redirects = false; - const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - LLHTTPClient::get(getFacebookConnectURL("/info", true), new LLFacebookInfoResponder(), - LLSD(), timeout, follow_redirects); -#endif } } @@ -842,16 +536,8 @@ void LLFacebookConnect::loadFacebookFriends() { if(mRefreshContent) { -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookConnectFriendsCoro", boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this, _1)); -#else - - const bool follow_redirects = false; - const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; - LLHTTPClient::get(getFacebookConnectURL("/friends", true), new LLFacebookFriendsResponder(), - LLSD(), timeout, follow_redirects); -#endif } } @@ -880,13 +566,8 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri body["message"] = message; } -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/checkin", body)); -#else - // Note: we can use that route for different publish action. We should be able to use the same responder. - LLHTTPClient::post(getFacebookConnectURL("/share/checkin", true), body, new LLFacebookShareResponder()); -#endif } void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) @@ -896,71 +577,14 @@ void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::stri body["image"] = image_url; body["caption"] = caption; -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/photo", body)); -#else - // Note: we can use that route for different publish action. We should be able to use the same responder. - LLHTTPClient::post(getFacebookConnectURL("/share/photo", true), body, new LLFacebookShareResponder()); -#endif } void LLFacebookConnect::sharePhoto(LLPointer image, const std::string& caption) { -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookShareImageCoro", boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, _1, "/share/photo", image, caption)); -#else - std::string imageFormat; - if (dynamic_cast(image.get())) - { - imageFormat = "png"; - } - else if (dynamic_cast(image.get())) - { - imageFormat = "jpg"; - } - else - { - LL_WARNS() << "Image to upload is not a PNG or JPEG" << LL_ENDL; - return; - } - - // All this code is mostly copied from LLWebProfile::post() - const std::string boundary = "----------------------------0123abcdefab"; - - LLSD headers; - headers["Content-Type"] = "multipart/form-data; boundary=" + boundary; - - std::ostringstream body; - - // *NOTE: The order seems to matter. - body << "--" << boundary << "\r\n" - << "Content-Disposition: form-data; name=\"caption\"\r\n\r\n" - << caption << "\r\n"; - - body << "--" << boundary << "\r\n" - << "Content-Disposition: form-data; name=\"image\"; filename=\"Untitled." << imageFormat << "\"\r\n" - << "Content-Type: image/" << imageFormat << "\r\n\r\n"; - - // Insert the image data. - // *FIX: Treating this as a string will probably screw it up ... - U8* image_data = image->getData(); - for (S32 i = 0; i < image->getDataSize(); ++i) - { - body << image_data[i]; - } - - body << "\r\n--" << boundary << "--\r\n"; - - // postRaw() takes ownership of the buffer and releases it later. - size_t size = body.str().size(); - U8 *data = new U8[size]; - memcpy(data, body.str().data(), size); - - // Note: we can use that route for different publish action. We should be able to use the same responder. - LLHTTPClient::postRaw(getFacebookConnectURL("/share/photo", true), data, size, new LLFacebookShareResponder(), headers); -#endif } void LLFacebookConnect::updateStatus(const std::string& message) @@ -968,13 +592,8 @@ void LLFacebookConnect::updateStatus(const std::string& message) LLSD body; body["message"] = message; -#if 1 LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/wall", body)); -#else - // Note: we can use that route for different publish action. We should be able to use the same responder. - LLHTTPClient::post(getFacebookConnectURL("/share/wall", true), body, new LLFacebookShareResponder()); -#endif } void LLFacebookConnect::storeInfo(const LLSD& info) -- cgit v1.2.3 From 27258d370be634630299a59ab9bea51e55b37bbb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 20 Apr 2015 11:57:51 -0700 Subject: Flickr conversion. --- indra/newview/llfacebookconnect.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 680b7677af..ec9efe0c7d 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -218,10 +218,13 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + + httpOpts->setWantHeaders(true); setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share, httpOpts); if (testShareStatus(result)) { @@ -238,6 +241,9 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + + httpOpts->setWantHeaders(true); std::string imageFormat; if (dynamic_cast(image.get())) @@ -284,7 +290,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), raw, httpHeaders); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -381,8 +387,11 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + + httpOpts->setWantHeaders(true); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true)); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); -- cgit v1.2.3 From 3e004ce66e1fa07421c138a20eb0dba61c5b26b3 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 11 May 2015 16:52:02 -0700 Subject: Updated feature manager downloader to coroutine. Added "raw" coroutine handler (returns raw result as LLSD::Binary) and split out the guts of the get, put, etc methods. Moved getStatusFromLLSD from HttpCoroHandler into HttpCorutineAdapter --- indra/newview/llfacebookconnect.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index ec9efe0c7d..2a1614a422 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -151,7 +151,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { if (status == LLCore::HttpStatus(HTTP_FOUND)) @@ -180,7 +180,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut bool LLFacebookConnect::testShareStatus(LLSD &result) { LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (status) return true; @@ -314,7 +314,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection")); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status && (status != LLCore::HttpStatus(HTTP_FOUND))) { LL_WARNS("FacebookConnect") << "Failed to disconnect:" << status.toTerseString() << LL_ENDL; @@ -347,7 +347,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true)); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { @@ -394,7 +394,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (status == LLCore::HttpStatus(HTTP_FOUND)) { @@ -434,7 +434,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true)); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults); + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (status == LLCore::HttpStatus(HTTP_FOUND)) { -- cgit v1.2.3 From 0d3fb07bfa205b65f242ef2b761e827ff30e42fe Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 3 Jun 2015 16:04:40 -0700 Subject: Remove vestigial httpclient.h include from files that no longer need it. --- indra/newview/llfacebookconnect.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 2a1614a422..d1ed4e8ba4 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -34,7 +34,6 @@ #include "llagent.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llcommandhandler.h" -#include "llhttpclient.h" #include "llnotificationsutil.h" #include "llurlaction.h" #include "llimagepng.h" -- cgit v1.2.3 From aba8d5e488d771f3d30ee75f0fbca30747adb7d1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 9 Jun 2015 13:06:09 -0700 Subject: Removed homelocation responder (rolled into llagent) Removed sdhandler from llagent. Removed unused values from llacountingccostmgr Fixed smart pontier creation in llfacebook --- indra/newview/llfacebookconnect.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index d1ed4e8ba4..a295910379 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -131,7 +131,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); LLSD putData; if (!authCode.empty()) @@ -217,7 +217,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); @@ -239,8 +239,8 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders, false); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); @@ -386,7 +386,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); -- cgit v1.2.3 From 82e34f1683f67b8394306b1569260508a213b99e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 17 Jun 2015 14:41:28 -0700 Subject: https://jira.secondlife.com/browse/MAINT-5283 The default behavior in the HTTP layer changed to follow redirects automatically. This was causing a problem with connecting to the SL share service which was attempting to riderect to the login page at the CURL level. Connections to SL Share will no longer redirect, corrected for Facebook, Flickr and Twitter. --- indra/newview/llfacebookconnect.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index a295910379..29c5d0c673 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -144,6 +144,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut } httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); @@ -220,6 +221,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); setConnectionState(LLFacebookConnect::FB_POSTING); @@ -243,6 +245,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); std::string imageFormat; if (dynamic_cast(image.get())) @@ -307,10 +310,12 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); setConnectionState(LLFacebookConnect::FB_DISCONNECTING); + httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection")); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -340,10 +345,13 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true)); + httpOpts->setFollowRedirects(false); + + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -389,6 +397,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts); @@ -429,8 +438,11 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + + httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true)); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); -- cgit v1.2.3 From da81830f4a2de5434d2d1f6e34f904b6e4b99710 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 18 Jun 2015 17:55:37 -0400 Subject: MAINT-5200: Add debug headers to Facebook slshare-service calls. --- indra/newview/llfacebookconnect.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 29c5d0c673..ccfd7f6442 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -67,6 +67,13 @@ void toast_user_for_facebook_success() LLNotificationsUtil::add("FacebookConnect", args); } +LLCore::HttpHeaders::ptr_t get_headers() +{ + LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + httpHeaders->append("X-debug-tag", "dbgvwr"); + return httpHeaders; +} + /////////////////////////////////////////////////////////////////////////////// // class LLFacebookConnectHandler : public LLCommandHandler @@ -148,7 +155,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts); + LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -225,7 +232,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); if (testShareStatus(result)) { @@ -241,7 +248,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders, false); + LLCore::HttpHeaders::ptr_t httpHeaders(get_headers()); LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); @@ -315,7 +322,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) setConnectionState(LLFacebookConnect::FB_DISCONNECTING); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -351,7 +358,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -399,7 +406,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -442,7 +449,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); -- cgit v1.2.3 From f779c164a2da0eec3454d1d26ccd333751afcf4f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 29 Jun 2015 13:07:37 -0400 Subject: MAINT-5200: Add DebugSlshareLogTag temp setting for developers. This allows engaging slshare-service debug logging for a particular viewer session without having to twiddle the slshare-service hosts. Also fix leaky LLCore::HttpHeaders::ptr_t construction. --- indra/newview/llfacebookconnect.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index ccfd7f6442..0aaee4f961 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -41,6 +41,7 @@ #include "lltrans.h" #include "llevents.h" #include "llviewerregion.h" +#include "llviewercontrol.h" #include "llfloaterwebcontent.h" #include "llfloaterreg.h" @@ -69,8 +70,19 @@ void toast_user_for_facebook_success() LLCore::HttpHeaders::ptr_t get_headers() { - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); - httpHeaders->append("X-debug-tag", "dbgvwr"); + LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders, false); + // The DebugSlshareLogTag mechanism is intended to trigger slshare-service + // debug logging. slshare-service is coded to respond to an X-debug-tag + // header by engaging debug logging for that request only. This way a + // developer need not muck with the slshare-service image to engage debug + // logging. Moreover, the value of X-debug-tag is embedded in each such + // log line so the developer can quickly find the log lines pertinent to + // THIS session. + std::string logtag(gSavedSettings.getString("DebugSlshareLogTag")); + if (! logtag.empty()) + { + httpHeaders->append("X-debug-tag", logtag); + } return httpHeaders; } -- cgit v1.2.3 From 80d17b2dd9cdd7a9445480fdb0e12774396751eb Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 29 Jun 2015 17:19:51 -0400 Subject: MAINT-4952: Use IntrusivePtr for BufferArray,HttpHeaders,HttpOptions. Specifically, change the ptr_t typedefs for these LLCore classes to use IntrusivePtr rather than directly using boost::intrusive_ptr. This allows us to use a simple ptr_t(raw ptr) constructor rather than having to remember to code ptr_t(raw ptr, false) everywhere. In fact, the latter form is now invalid: remove the now-extraneous 'false' constructor parameters. --- indra/newview/llfacebookconnect.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 29c5d0c673..a1700a4357 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -131,7 +131,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); LLSD putData; if (!authCode.empty()) @@ -218,7 +218,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); @@ -241,8 +241,8 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders, false); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); @@ -268,7 +268,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string std::string contentType = "multipart/form-data; boundary=" + boundary; httpHeaders->append("Content-Type", contentType.c_str()); - LLCore::BufferArray::ptr_t raw = LLCore::BufferArray::ptr_t(new LLCore::BufferArray(), false); // + LLCore::BufferArray::ptr_t raw = LLCore::BufferArray::ptr_t(new LLCore::BufferArray()); // LLCore::BufferArrayStream body(raw.get()); // *NOTE: The order seems to matter. @@ -310,7 +310,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); setConnectionState(LLFacebookConnect::FB_DISCONNECTING); httpOpts->setFollowRedirects(false); @@ -345,7 +345,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); @@ -394,7 +394,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); @@ -438,7 +438,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setFollowRedirects(false); -- cgit v1.2.3 From 45ddc6e91da8e48a21fac1d317e66524db304a17 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 29 Jun 2015 23:14:45 -0400 Subject: MAINT-5200: Correct new LLCore::HttpHeaders::ptr_t usage. The convention about how to construct an HttpHeaders::ptr_t has changed. Change new code to adapt to merged changes. --- indra/newview/llfacebookconnect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 59827c581c..87d7aacda1 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -70,7 +70,7 @@ void toast_user_for_facebook_success() LLCore::HttpHeaders::ptr_t get_headers() { - LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders, false); + LLCore::HttpHeaders::ptr_t httpHeaders(new LLCore::HttpHeaders); // The DebugSlshareLogTag mechanism is intended to trigger slshare-service // debug logging. slshare-service is coded to respond to an X-debug-tag // header by engaging debug logging for that request only. This way a -- cgit v1.2.3 From b262ded7e0cf21314524bf702b0e4fe28a3c3060 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 1 Jul 2015 18:33:29 -0400 Subject: MAINT-5351: Remove 'self' parameter from coroutine functions. lleventcoro_test.cpp runs clean (as modified for new API), and all the rest builds clean, but the resulting viewer is as yet untested. --- indra/newview/llfacebookconnect.cpp | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 87d7aacda1..136e02953c 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -144,7 +144,7 @@ LLFacebookConnectHandler gFacebookConnectHandler; /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string authCode, std::string authState) +void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string authState) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -167,7 +167,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); + LLSD result = httpAdapter->putAndYield(httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -231,7 +231,7 @@ bool LLFacebookConnect::testShareStatus(LLSD &result) return false; } -void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route, LLSD share) +void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -244,7 +244,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); + LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); if (testShareStatus(result)) { @@ -254,7 +254,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route } } -void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string route, LLPointer image, std::string caption) +void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointer image, std::string caption) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -311,7 +311,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -323,7 +323,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) +void LLFacebookConnect::facebookDisconnectCoro() { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -334,7 +334,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) setConnectionState(LLFacebookConnect::FB_DISCONNECTING); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); + LLSD result = httpAdapter->deleteAndYield(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -358,7 +358,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool autoConnect) +void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -370,7 +370,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -407,7 +407,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) +void LLFacebookConnect::facebookConnectInfoCoro() { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -418,7 +418,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -451,7 +451,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) +void LLFacebookConnect::facebookConnectFriendsCoro() { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -461,7 +461,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -547,19 +547,19 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const std::string& auth_state) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectCoro", - boost::bind(&LLFacebookConnect::facebookConnectCoro, this, _1, auth_code, auth_state)); + boost::bind(&LLFacebookConnect::facebookConnectCoro, this, auth_code, auth_state)); } void LLFacebookConnect::disconnectFromFacebook() { LLCoros::instance().launch("LLFacebookConnect::facebookDisconnectCoro", - boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this, _1)); + boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this)); } void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", - boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, _1, auto_connect)); + boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, auto_connect)); } void LLFacebookConnect::loadFacebookInfo() @@ -567,7 +567,7 @@ void LLFacebookConnect::loadFacebookInfo() if(mRefreshInfo) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectInfoCoro", - boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this, _1)); + boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this)); } } @@ -576,7 +576,7 @@ void LLFacebookConnect::loadFacebookFriends() if(mRefreshContent) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectFriendsCoro", - boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this, _1)); + boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this)); } } @@ -606,7 +606,7 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri } LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/checkin", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/checkin", body)); } void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) @@ -617,13 +617,13 @@ void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::stri body["caption"] = caption; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/photo", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/photo", body)); } void LLFacebookConnect::sharePhoto(LLPointer image, const std::string& caption) { LLCoros::instance().launch("LLFacebookConnect::facebookShareImageCoro", - boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, _1, "/share/photo", image, caption)); + boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, "/share/photo", image, caption)); } void LLFacebookConnect::updateStatus(const std::string& message) @@ -632,7 +632,7 @@ void LLFacebookConnect::updateStatus(const std::string& message) body["message"] = message; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/wall", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/wall", body)); } void LLFacebookConnect::storeInfo(const LLSD& info) -- cgit v1.2.3 From 247eb0c9c3418c10be8f2a0e3c8116758efa702f Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 7 Jul 2015 19:41:27 +0100 Subject: Backout selfles merge 738255dbbfd679d9e615baab3398e5e345bbb3c5 --- indra/newview/llfacebookconnect.cpp | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 136e02953c..87d7aacda1 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -144,7 +144,7 @@ LLFacebookConnectHandler gFacebookConnectHandler; /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string authState) +void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string authCode, std::string authState) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -167,7 +167,7 @@ void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string au setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); + LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -231,7 +231,7 @@ bool LLFacebookConnect::testShareStatus(LLSD &result) return false; } -void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) +void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route, LLSD share) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -244,7 +244,7 @@ void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); if (testShareStatus(result)) { @@ -254,7 +254,7 @@ void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) } } -void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointer image, std::string caption) +void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string route, LLPointer image, std::string caption) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -311,7 +311,7 @@ void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointerpostAndYield(httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -323,7 +323,7 @@ void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointersetFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -358,7 +358,7 @@ void LLFacebookConnect::facebookDisconnectCoro() /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) +void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool autoConnect) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -370,7 +370,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -407,7 +407,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectInfoCoro() +void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -418,7 +418,7 @@ void LLFacebookConnect::facebookConnectInfoCoro() httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -451,7 +451,7 @@ void LLFacebookConnect::facebookConnectInfoCoro() /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectFriendsCoro() +void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -461,7 +461,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro() httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -547,19 +547,19 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const std::string& auth_state) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectCoro", - boost::bind(&LLFacebookConnect::facebookConnectCoro, this, auth_code, auth_state)); + boost::bind(&LLFacebookConnect::facebookConnectCoro, this, _1, auth_code, auth_state)); } void LLFacebookConnect::disconnectFromFacebook() { LLCoros::instance().launch("LLFacebookConnect::facebookDisconnectCoro", - boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this)); + boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this, _1)); } void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", - boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, auto_connect)); + boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, _1, auto_connect)); } void LLFacebookConnect::loadFacebookInfo() @@ -567,7 +567,7 @@ void LLFacebookConnect::loadFacebookInfo() if(mRefreshInfo) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectInfoCoro", - boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this)); + boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this, _1)); } } @@ -576,7 +576,7 @@ void LLFacebookConnect::loadFacebookFriends() if(mRefreshContent) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectFriendsCoro", - boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this)); + boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this, _1)); } } @@ -606,7 +606,7 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri } LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/checkin", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/checkin", body)); } void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) @@ -617,13 +617,13 @@ void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::stri body["caption"] = caption; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/photo", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/photo", body)); } void LLFacebookConnect::sharePhoto(LLPointer image, const std::string& caption) { LLCoros::instance().launch("LLFacebookConnect::facebookShareImageCoro", - boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, "/share/photo", image, caption)); + boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, _1, "/share/photo", image, caption)); } void LLFacebookConnect::updateStatus(const std::string& message) @@ -632,7 +632,7 @@ void LLFacebookConnect::updateStatus(const std::string& message) body["message"] = message; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/wall", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/wall", body)); } void LLFacebookConnect::storeInfo(const LLSD& info) -- cgit v1.2.3 From efa9a0f99c17b2b937120bcad6e3d45944122ed9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 10 Jul 2015 19:30:10 -0400 Subject: Backed out changeset bab1000e1b2d: restore 'selfless' changes --- indra/newview/llfacebookconnect.cpp | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 87d7aacda1..136e02953c 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -144,7 +144,7 @@ LLFacebookConnectHandler gFacebookConnectHandler; /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string authCode, std::string authState) +void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string authState) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -167,7 +167,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); + LLSD result = httpAdapter->putAndYield(httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -231,7 +231,7 @@ bool LLFacebookConnect::testShareStatus(LLSD &result) return false; } -void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route, LLSD share) +void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -244,7 +244,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); + LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); if (testShareStatus(result)) { @@ -254,7 +254,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route } } -void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string route, LLPointer image, std::string caption) +void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointer image, std::string caption) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -311,7 +311,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -323,7 +323,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) +void LLFacebookConnect::facebookDisconnectCoro() { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -334,7 +334,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) setConnectionState(LLFacebookConnect::FB_DISCONNECTING); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); + LLSD result = httpAdapter->deleteAndYield(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -358,7 +358,7 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool autoConnect) +void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -370,7 +370,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -407,7 +407,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) +void LLFacebookConnect::facebookConnectInfoCoro() { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -418,7 +418,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -451,7 +451,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) +void LLFacebookConnect::facebookConnectFriendsCoro() { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -461,7 +461,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -547,19 +547,19 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const std::string& auth_state) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectCoro", - boost::bind(&LLFacebookConnect::facebookConnectCoro, this, _1, auth_code, auth_state)); + boost::bind(&LLFacebookConnect::facebookConnectCoro, this, auth_code, auth_state)); } void LLFacebookConnect::disconnectFromFacebook() { LLCoros::instance().launch("LLFacebookConnect::facebookDisconnectCoro", - boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this, _1)); + boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this)); } void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", - boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, _1, auto_connect)); + boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, auto_connect)); } void LLFacebookConnect::loadFacebookInfo() @@ -567,7 +567,7 @@ void LLFacebookConnect::loadFacebookInfo() if(mRefreshInfo) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectInfoCoro", - boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this, _1)); + boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this)); } } @@ -576,7 +576,7 @@ void LLFacebookConnect::loadFacebookFriends() if(mRefreshContent) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectFriendsCoro", - boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this, _1)); + boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this)); } } @@ -606,7 +606,7 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri } LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/checkin", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/checkin", body)); } void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) @@ -617,13 +617,13 @@ void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::stri body["caption"] = caption; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/photo", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/photo", body)); } void LLFacebookConnect::sharePhoto(LLPointer image, const std::string& caption) { LLCoros::instance().launch("LLFacebookConnect::facebookShareImageCoro", - boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, _1, "/share/photo", image, caption)); + boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, "/share/photo", image, caption)); } void LLFacebookConnect::updateStatus(const std::string& message) @@ -632,7 +632,7 @@ void LLFacebookConnect::updateStatus(const std::string& message) body["message"] = message; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/wall", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/wall", body)); } void LLFacebookConnect::storeInfo(const LLSD& info) -- cgit v1.2.3 From c7d5a4bab75b651b65e173a17079438f03695cc1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 16 Sep 2015 15:04:57 -0700 Subject: MAINT-5628: Set flicr state to "Posting" on all paths before image upload starts. Causes "Upload" button to be disabled and activity indicator to appear. Also made sure that setConnectionState is called correctly for Facebook and Twitter. --- indra/newview/llfacebookconnect.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 136e02953c..7975902f73 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -165,8 +165,6 @@ void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string au httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -242,8 +240,6 @@ void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); if (testShareStatus(result)) @@ -331,7 +327,6 @@ void LLFacebookConnect::facebookDisconnectCoro() LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - setConnectionState(LLFacebookConnect::FB_DISCONNECTING); httpOpts->setFollowRedirects(false); LLSD result = httpAdapter->deleteAndYield(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); @@ -546,6 +541,8 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const std::string& auth_state) { + setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); + LLCoros::instance().launch("LLFacebookConnect::facebookConnectCoro", boost::bind(&LLFacebookConnect::facebookConnectCoro, this, auth_code, auth_state)); } @@ -558,6 +555,8 @@ void LLFacebookConnect::disconnectFromFacebook() void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { + setConnectionState(LLFacebookConnect::FB_DISCONNECTING); + LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, auto_connect)); } @@ -583,6 +582,8 @@ void LLFacebookConnect::loadFacebookFriends() void LLFacebookConnect::postCheckin(const std::string& location, const std::string& name, const std::string& description, const std::string& image, const std::string& message) { + setConnectionState(LLFacebookConnect::FB_POSTING); + LLSD body; if (!location.empty()) { @@ -611,7 +612,8 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) { - // *TODO: I could not find an instace where this method is used. Remove? + setConnectionState(LLFacebookConnect::FB_POSTING); + LLSD body; body["image"] = image_url; body["caption"] = caption; @@ -622,6 +624,8 @@ void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::stri void LLFacebookConnect::sharePhoto(LLPointer image, const std::string& caption) { + setConnectionState(LLFacebookConnect::FB_POSTING); + LLCoros::instance().launch("LLFacebookConnect::facebookShareImageCoro", boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, "/share/photo", image, caption)); } @@ -631,6 +635,8 @@ void LLFacebookConnect::updateStatus(const std::string& message) LLSD body; body["message"] = message; + setConnectionState(LLFacebookConnect::FB_POSTING); + LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/wall", body)); } -- cgit v1.2.3 From 75c6549fde060e974c90636685962ee373f94202 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 18 Sep 2015 11:39:22 -0700 Subject: Set consistent terminology for yield/wait -> suspend for coroutines. --- indra/newview/llfacebookconnect.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfacebookconnect.cpp') diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 7975902f73..1de4102dba 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -165,7 +165,7 @@ void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string au httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->putAndYield(httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); + LLSD result = httpAdapter->putAndSuspend(httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -240,7 +240,7 @@ void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); + LLSD result = httpAdapter->postAndSuspend(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); if (testShareStatus(result)) { @@ -307,7 +307,7 @@ void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointerpostAndYield(httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndSuspend(httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -329,7 +329,7 @@ void LLFacebookConnect::facebookDisconnectCoro() httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); + LLSD result = httpAdapter->deleteAndSuspend(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -365,7 +365,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndSuspend(httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -413,7 +413,7 @@ void LLFacebookConnect::facebookConnectInfoCoro() httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndSuspend(httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -456,7 +456,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro() httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndSuspend(httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); -- cgit v1.2.3