From ba90f3a8e4afb5eb303dab5f590db713ff82ec0e Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 24 Apr 2019 02:24:42 +0300 Subject: SL-10994 Removed Facebook In-world Sharing SL-11024 Fixed Twitter connect failure --- indra/newview/CMakeLists.txt | 4 - indra/newview/app_settings/commands.xml | 10 - indra/newview/app_settings/toolbars.xml | 1 - indra/newview/llfacebookconnect.cpp | 714 ------------ indra/newview/llfacebookconnect.h | 116 -- indra/newview/llfloaterfacebook.cpp | 1132 -------------------- indra/newview/llfloaterfacebook.h | 185 ---- indra/newview/llfloateroutfitsnapshot.cpp | 2 - indra/newview/llfloatersnapshot.cpp | 5 +- indra/newview/llfloaterwebcontent.cpp | 22 +- indra/newview/llnotificationscripthandler.cpp | 1 - indra/newview/llpanelpeople.cpp | 86 +- indra/newview/llpanelpeople.h | 7 - indra/newview/llpanelpeoplemenus.cpp | 33 - indra/newview/llpanelpeoplemenus.h | 13 - indra/newview/llpanelsnapshotoptions.cpp | 15 - indra/newview/llsnapshotlivepreview.cpp | 5 +- indra/newview/lltwitterconnect.cpp | 44 + indra/newview/llviewerfloaterreg.cpp | 3 - indra/newview/llviewermedia.cpp | 2 +- indra/newview/llviewermenu.cpp | 1 - indra/newview/llviewerregion.cpp | 1 - indra/newview/skins/default/textures/textures.xml | 4 - .../skins/default/xui/en/floater_facebook.xml | 95 -- .../skins/default/xui/en/floater_snapshot.xml | 12 - indra/newview/skins/default/xui/en/menu_viewer.xml | 7 - .../newview/skins/default/xui/en/notifications.xml | 7 - .../default/xui/en/panel_facebook_friends.xml | 73 -- .../skins/default/xui/en/panel_facebook_photo.xml | 169 --- .../skins/default/xui/en/panel_facebook_place.xml | 113 -- .../skins/default/xui/en/panel_facebook_status.xml | 130 --- .../newview/skins/default/xui/en/panel_people.xml | 19 +- .../default/xui/en/panel_snapshot_options.xml | 17 - indra/newview/skins/default/xui/en/strings.xml | 13 +- .../skins/default/xui/en/widgets/person_view.xml | 10 - 35 files changed, 53 insertions(+), 3018 deletions(-) delete mode 100644 indra/newview/llfacebookconnect.cpp delete mode 100644 indra/newview/llfacebookconnect.h delete mode 100644 indra/newview/llfloaterfacebook.cpp delete mode 100644 indra/newview/llfloaterfacebook.h delete mode 100644 indra/newview/skins/default/xui/en/floater_facebook.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_facebook_friends.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_facebook_photo.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_facebook_place.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_facebook_status.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2c52b400e4..46fd0f3fd1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -201,7 +201,6 @@ set(viewer_SOURCE_FILES llexperiencelog.cpp llexternaleditor.cpp llface.cpp - llfacebookconnect.cpp llfasttimerview.cpp llfavoritesbar.cpp llfeaturemanager.cpp @@ -245,7 +244,6 @@ set(viewer_SOURCE_FILES llfloaterexperiencepicker.cpp llfloaterexperienceprofile.cpp llfloaterexperiences.cpp - llfloaterfacebook.cpp llfloaterflickr.cpp llfloaterfonttest.cpp llfloatergesture.cpp @@ -828,7 +826,6 @@ set(viewer_HEADER_FILES llexperiencelog.h llexternaleditor.h llface.h - llfacebookconnect.h llfasttimerview.h llfavoritesbar.h llfeaturemanager.h @@ -872,7 +869,6 @@ set(viewer_HEADER_FILES llfloaterexperiencepicker.h llfloaterexperienceprofile.h llfloaterexperiences.h - llfloaterfacebook.h llfloaterflickr.h llfloaterfonttest.h llfloatergesture.h diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 412d3a53b3..cab0c523b2 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -228,16 +228,6 @@ is_running_function="Floater.IsOpen" is_running_parameters="snapshot" /> - - diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp deleted file mode 100644 index 43b01fa2f1..0000000000 --- a/indra/newview/llfacebookconnect.cpp +++ /dev/null @@ -1,714 +0,0 @@ -/** - * @file llfacebookconnect.h - * @author Merov, Cho, Gil - * @brief Connection to Facebook Service - * - * $LicenseInfo:firstyear=2013&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2013, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfacebookconnect.h" -#include "llflickrconnect.h" -#include "lltwitterconnect.h" - -#include "llagent.h" -#include "llcallingcard.h" // for LLAvatarTracker -#include "llcommandhandler.h" -#include "llnotificationsutil.h" -#include "llurlaction.h" -#include "llimagepng.h" -#include "llimagejpeg.h" -#include "lltrans.h" -#include "llevents.h" -#include "llviewerregion.h" -#include "llviewercontrol.h" - -#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")); -boost::scoped_ptr LLFacebookConnect::sContentWatcher(new LLEventStream("FacebookConnectContent")); - -// Local functions -void log_facebook_connect_error(const std::string& request, U32 status, const std::string& reason, const std::string& code, const std::string& description) -{ - // Note: 302 (redirect) is *not* an error that warrants logging - if (status != 302) - { - LL_WARNS("FacebookConnect") << request << " request failed with a " << status << " " << reason << ". Reason: " << code << " (" << description << ")" << LL_ENDL; - } -} - -void toast_user_for_facebook_success() -{ - LLSD args; - args["MESSAGE"] = LLTrans::getString("facebook_post_success"); - LLNotificationsUtil::add("FacebookConnect", args); -} - -LLCore::HttpHeaders::ptr_t get_headers() -{ - 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 - // 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; -} - -/////////////////////////////////////////////////////////////////////////////// -// -class LLFacebookConnectHandler : public LLCommandHandler -{ -public: - LLFacebookConnectHandler() : LLCommandHandler("fbc", UNTRUSTED_THROTTLE) { } - - bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) - { - if (tokens.size() >= 1) - { - if (tokens[0].asString() == "connect") - { - if (tokens.size() >= 2 && tokens[1].asString() == "flickr") - { - // this command probably came from the flickr_web browser, so close it - LLFloaterReg::hideInstance("flickr_web"); - - // connect to flickr - if (query_map.has("oauth_token")) - { - LLFlickrConnect::instance().connectToFlickr(query_map["oauth_token"], query_map.get("oauth_verifier")); - } - return true; - } - else if (tokens.size() >= 2 && tokens[1].asString() == "twitter") - { - // this command probably came from the twitter_web browser, so close it - LLFloaterReg::hideInstance("twitter_web"); - - // connect to twitter - if (query_map.has("oauth_token")) - { - LLTwitterConnect::instance().connectToTwitter(query_map["oauth_token"], query_map.get("oauth_verifier")); - } - return true; - } - else //if (tokens.size() >= 2 && tokens[1].asString() == "facebook") - { - // this command probably came from the fbc_web browser, so close it - LLFloaterReg::hideInstance("fbc_web"); - - // connect to facebook - if (query_map.has("code")) - { - LLFacebookConnect::instance().connectToFacebook(query_map["code"], query_map.get("state")); - } - return true; - } - } - } - return false; - } -}; -LLFacebookConnectHandler gFacebookConnectHandler; - -/////////////////////////////////////////////////////////////////////////////// -// -void LLFacebookConnect::facebookConnectCoro(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); - httpOpts->setFollowRedirects(false); - - 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); - 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); - } - -} - -/////////////////////////////////////////////////////////////////////////////// -// -bool LLFacebookConnect::testShareStatus(LLSD &result) -{ - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::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(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); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - - httpOpts->setWantHeaders(true); - httpOpts->setFollowRedirects(false); - - LLSD result = httpAdapter->postAndSuspend(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); - - if (testShareStatus(result)) - { - toast_user_for_facebook_success(); - LL_DEBUGS("FacebookConnect") << "Post successful. " << LL_ENDL; - setConnectionState(LLFacebookConnect::FB_POSTED); - } -} - -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 - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders(get_headers()); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - - httpOpts->setWantHeaders(true); - httpOpts->setFollowRedirects(false); - - 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()); // - 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->postAndSuspend(httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); - - if (testShareStatus(result)) - { - toast_user_for_facebook_success(); - LL_DEBUGS("FacebookConnect") << "Post successful. " << LL_ENDL; - setConnectionState(LLFacebookConnect::FB_POSTED); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// -void LLFacebookConnect::facebookDisconnectCoro() -{ - 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); - - httpOpts->setFollowRedirects(false); - - LLSD result = httpAdapter->deleteAndSuspend(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); - - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::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); - } - -} - -/////////////////////////////////////////////////////////////////////////////// -// -void LLFacebookConnect::facebookConnectedCheckCoro(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); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - - setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - - httpOpts->setFollowRedirects(false); - - 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); - - 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); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// -void LLFacebookConnect::facebookConnectInfoCoro() -{ - 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); - - httpOpts->setWantHeaders(true); - httpOpts->setFollowRedirects(false); - - 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); - - 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); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// -void LLFacebookConnect::facebookConnectFriendsCoro() -{ - 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); - - httpOpts->setFollowRedirects(false); - - 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); - - 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); - } -} - -/////////////////////////////////////////////////////////////////////////////// -// -LLFacebookConnect::LLFacebookConnect() -: mConnectionState(FB_NOT_CONNECTED), - mConnected(false), - mInfo(), - mContent(), - mRefreshInfo(false), - mRefreshContent(false), - mReadFromMaster(false) -{ -} - -void LLFacebookConnect::openFacebookWeb(std::string url) -{ - LLFloaterWebContent::Params p; - p.url(url); - p.show_chrome(true); - p.allow_back_forward_navigation(false); - p.clean_browser(true); - LLFloater *floater = LLFloaterReg::showInstance("fbc_web", p); - //the internal web browser has a bug that prevents it from gaining focus unless a mouse event occurs first (it seems). - //So when showing the internal web browser, set focus to it's containing floater "fbc_web". When a mouse event - //occurs on the "webbrowser" panel part of the floater, a mouse cursor will properly show and the "webbrowser" will gain focus. - //fbc_web floater contains the "webbrowser" panel. JIRA: ACME-744 - gFocusMgr.setKeyboardFocus( floater ); - - //LLUrlAction::openURLExternal(url); -} - -std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, bool include_read_from_master) -{ - std::string url(""); - LLViewerRegion *regionp = gAgent.getRegion(); - if (regionp) - { - //url = "http://pdp15.lindenlab.com/fbc/agent/" + gAgentID.asString(); // TEMPORARY FOR TESTING - CHO - url = regionp->getCapability("FacebookConnect"); - url += route; - - if (include_read_from_master && mReadFromMaster) - { - url += "?read_from_master=true"; - } - } - return url; -} - -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)); -} - -void LLFacebookConnect::disconnectFromFacebook() -{ - LLCoros::instance().launch("LLFacebookConnect::facebookDisconnectCoro", - boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this)); -} - -void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) -{ - setConnectionState(LLFacebookConnect::FB_DISCONNECTING); - - LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", - boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, auto_connect)); -} - -void LLFacebookConnect::loadFacebookInfo() -{ - if(mRefreshInfo) - { - LLCoros::instance().launch("LLFacebookConnect::facebookConnectInfoCoro", - boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this)); - } -} - -void LLFacebookConnect::loadFacebookFriends() -{ - if(mRefreshContent) - { - LLCoros::instance().launch("LLFacebookConnect::facebookConnectFriendsCoro", - boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this)); - } -} - -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()) - { - body["location"] = location; - } - if (!name.empty()) - { - body["name"] = name; - } - if (!description.empty()) - { - body["description"] = description; - } - if (!image.empty()) - { - body["image"] = image; - } - if (!message.empty()) - { - body["message"] = message; - } - - LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/checkin", body)); -} - -void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) -{ - setConnectionState(LLFacebookConnect::FB_POSTING); - - LLSD body; - body["image"] = image_url; - body["caption"] = caption; - - LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/photo", body)); -} - -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)); -} - -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)); -} - -void LLFacebookConnect::storeInfo(const LLSD& info) -{ - mInfo = info; - mRefreshInfo = false; - - sInfoWatcher->post(info); -} - -const LLSD& LLFacebookConnect::getInfo() const -{ - return mInfo; -} - -void LLFacebookConnect::clearInfo() -{ - mInfo = LLSD(); -} - -void LLFacebookConnect::storeContent(const LLSD& content) -{ - mContent = content; - mRefreshContent = false; - - sContentWatcher->post(content); -} - -const LLSD& LLFacebookConnect::getContent() const -{ - return mContent; -} - -void LLFacebookConnect::clearContent() -{ - mContent = LLSD(); -} - -void LLFacebookConnect::setDataDirty() -{ - mRefreshInfo = true; - mRefreshContent = true; -} - -void LLFacebookConnect::setConnectionState(LLFacebookConnect::EConnectionState connection_state) -{ - if(connection_state == FB_CONNECTED) - { - mReadFromMaster = true; - setConnected(true); - setDataDirty(); - } - else if(connection_state == FB_NOT_CONNECTED) - { - setConnected(false); - } - else if(connection_state == FB_POSTED) - { - mReadFromMaster = false; - } - - if (mConnectionState != connection_state) - { - // set the connection state before notifying watchers - mConnectionState = connection_state; - - LLSD state_info; - state_info["enum"] = connection_state; - sStateWatcher->post(state_info); - } -} - -void LLFacebookConnect::setConnected(bool connected) -{ - mConnected = connected; -} diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h deleted file mode 100644 index 7fd4070f54..0000000000 --- a/indra/newview/llfacebookconnect.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @file llfacebookconnect.h - * @author Merov, Cho, Gil - * @brief Connection to Facebook Service - * - * $LicenseInfo:firstyear=2013&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2013, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFACEBOOKCONNECT_H -#define LL_LLFACEBOOKCONNECT_H - -#include "llsingleton.h" -#include "llimage.h" -#include "llcoros.h" -#include "lleventcoro.h" - -class LLEventPump; - -/** - * @class LLFacebookConnect - * - * Manages authentication to, and interaction with, a web service allowing the - * the viewer to get Facebook OpenGraph data. - */ -class LLFacebookConnect : public LLSingleton -{ - LLSINGLETON(LLFacebookConnect); - ~LLFacebookConnect() {}; - LOG_CLASS(LLFacebookConnect); -public: - enum EConnectionState - { - FB_NOT_CONNECTED = 0, - FB_CONNECTION_IN_PROGRESS = 1, - FB_CONNECTED = 2, - FB_CONNECTION_FAILED = 3, - FB_POSTING = 4, - FB_POSTED = 5, - FB_POST_FAILED = 6, - FB_DISCONNECTING = 7, - FB_DISCONNECT_FAILED = 8 - }; - - void connectToFacebook(const std::string& auth_code = "", const std::string& auth_state = ""); // Initiate the complete FB connection. Please use checkConnectionToFacebook() in normal use. - void disconnectFromFacebook(); // Disconnect from the FBC service. - void checkConnectionToFacebook(bool auto_connect = false); // Check if an access token is available on the FBC service. If not, call connectToFacebook(). - - void loadFacebookInfo(); - void loadFacebookFriends(); - void postCheckin(const std::string& location, const std::string& name, const std::string& description, const std::string& picture, const std::string& message); - void sharePhoto(const std::string& image_url, const std::string& caption); - void sharePhoto(LLPointer image, const std::string& caption); - void updateStatus(const std::string& message); - - void storeInfo(const LLSD& info); - const LLSD& getInfo() const; - void clearInfo(); - void storeContent(const LLSD& content); - const LLSD& getContent() const; - void clearContent(); - void setDataDirty(); - - void setConnectionState(EConnectionState connection_state); - void setConnected(bool connected); - bool isConnected() { return mConnected; } - bool isTransactionOngoing() { return ((mConnectionState == FB_CONNECTION_IN_PROGRESS) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_DISCONNECTING)); } - EConnectionState getConnectionState() { return mConnectionState; } - - void openFacebookWeb(std::string url); - -private: - - std::string getFacebookConnectURL(const std::string& route = "", bool include_read_from_master = false); - - EConnectionState mConnectionState; - BOOL mConnected; - LLSD mInfo; - LLSD mContent; - bool mRefreshInfo; - bool mRefreshContent; - bool mReadFromMaster; - - static boost::scoped_ptr sStateWatcher; - static boost::scoped_ptr sInfoWatcher; - static boost::scoped_ptr sContentWatcher; - - bool testShareStatus(LLSD &results); - void facebookConnectCoro(std::string authCode, std::string authState); - void facebookConnectedCheckCoro(bool autoConnect); - void facebookDisconnectCoro(); - void facebookShareCoro(std::string route, LLSD share); - void facebookShareImageCoro(std::string route, LLPointer image, std::string caption); - void facebookConnectInfoCoro(); - void facebookConnectFriendsCoro(); -}; - -#endif // LL_LLFACEBOOKCONNECT_H diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp deleted file mode 100644 index e84cbc289f..0000000000 --- a/indra/newview/llfloaterfacebook.cpp +++ /dev/null @@ -1,1132 +0,0 @@ -/** -* @file llfloaterfacebook.cpp -* @brief Implementation of llfloaterfacebook -* @author Gilbert@lindenlab.com -* -* $LicenseInfo:firstyear=2013&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2013, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterfacebook.h" - -#include "llagent.h" -#include "llagentui.h" -#include "llcheckboxctrl.h" -#include "llcombobox.h" -#include "llfacebookconnect.h" -#include "llfloaterbigpreview.h" -#include "llfloaterreg.h" -#include "lliconctrl.h" -#include "llimagefiltersmanager.h" -#include "llresmgr.h" // LLLocale -#include "llsdserialize.h" -#include "llloadingindicator.h" -#include "llslurl.h" -#include "lltrans.h" -#include "llsnapshotlivepreview.h" -#include "llviewerregion.h" -#include "llviewercontrol.h" -#include "llviewermedia.h" -#include "lltabcontainer.h" -#include "llavatarlist.h" -#include "llpanelpeoplemenus.h" -#include "llaccordionctrl.h" -#include "llaccordionctrltab.h" - -static LLPanelInjector t_panel_status("llfacebookstatuspanel"); -static LLPanelInjector t_panel_photo("llfacebookphotopanel"); -static LLPanelInjector t_panel_checkin("llfacebookcheckinpanel"); -static LLPanelInjector t_panel_friends("llfacebookfriendspanel"); - -const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/"; -const std::string DEFAULT_CHECKIN_ICON_URL = "http://map.secondlife.com.s3.amazonaws.com/map_placeholder.png"; -const std::string DEFAULT_CHECKIN_QUERY_PARAMETERS = "?sourceid=slshare_checkin&utm_source=facebook&utm_medium=checkin&utm_campaign=slshare"; -const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=facebook&utm_medium=photo&utm_campaign=slshare"; - -const S32 MAX_QUALITY = 100; // Max quality value for jpeg images -const S32 MIN_QUALITY = 0; // Min quality value for jpeg images -const S32 TARGET_DATA_SIZE = 950000; // Size of the image (compressed) we're trying to send to Facebook - -std::string get_map_url() -{ - LLVector3d center_agent; - LLViewerRegion *regionp = gAgent.getRegion(); - if (regionp) - { - center_agent = regionp->getCenterGlobal(); - } - int x_pos = center_agent[0] / 256.0; - int y_pos = center_agent[1] / 256.0; - std::string map_url = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-1-%d-%d-objects.jpg", x_pos, y_pos); - return map_url; -} - -// Compute target jpeg quality : see https://wiki.lindenlab.com/wiki/Facebook_Image_Quality for details -S32 compute_jpeg_quality(S32 width, S32 height) -{ - F32 target_compression_ratio = (F32)(width * height * 3) / (F32)(TARGET_DATA_SIZE); - S32 quality = (S32)(110.0f - (2.0f * target_compression_ratio)); - return llclamp(quality, MIN_QUALITY, MAX_QUALITY); -} - -/////////////////////////// -//LLFacebookStatusPanel////// -/////////////////////////// - -LLFacebookStatusPanel::LLFacebookStatusPanel() : - mMessageTextEditor(NULL), - mPostButton(NULL), - mCancelButton(NULL), - mAccountCaptionLabel(NULL), - mAccountNameLabel(NULL), - mPanelButtons(NULL), - mConnectButton(NULL), - mDisconnectButton(NULL) -{ - mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLFacebookStatusPanel::onConnect, this)); - mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLFacebookStatusPanel::onDisconnect, this)); - - setVisibleCallback(boost::bind(&LLFacebookStatusPanel::onVisibilityChange, this, _2)); - - mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLFacebookStatusPanel::onSend, this)); -} - -BOOL LLFacebookStatusPanel::postBuild() -{ - mAccountCaptionLabel = getChild("account_caption_label"); - mAccountNameLabel = getChild("account_name_label"); - mPanelButtons = getChild("panel_buttons"); - mConnectButton = getChild("connect_btn"); - mDisconnectButton = getChild("disconnect_btn"); - - mMessageTextEditor = getChild("status_message"); - mPostButton = getChild("post_status_btn"); - mCancelButton = getChild("cancel_status_btn"); - - return LLPanel::postBuild(); -} - -void LLFacebookStatusPanel::draw() -{ - LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); - - //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress - bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; - mDisconnectButton->setEnabled(!disconnecting); - - //Disable the 'connect' button when a connection is in progress - bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; - mConnectButton->setEnabled(!connecting); - - if (mMessageTextEditor && mPostButton && mCancelButton) - { - bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); - std::string message = mMessageTextEditor->getValue().asString(); - mMessageTextEditor->setEnabled(no_ongoing_connection); - mCancelButton->setEnabled(no_ongoing_connection); - mPostButton->setEnabled(no_ongoing_connection && !message.empty()); - } - - LLPanel::draw(); -} - -void LLFacebookStatusPanel::onSend() -{ - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookStatusPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1)); - - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - sendStatus(); - } - else - { - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } -} - -bool LLFacebookStatusPanel::onFacebookConnectStateChange(const LLSD& data) -{ - switch (data.get("enum").asInteger()) - { - case LLFacebookConnect::FB_CONNECTED: - sendStatus(); - break; - - case LLFacebookConnect::FB_POSTED: - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); - clearAndClose(); - break; - } - - return false; -} - -bool LLFacebookStatusPanel::onFacebookConnectAccountStateChange(const LLSD& data) -{ - if (LLFacebookConnect::instance().isConnected()) - { - //In process of disconnecting so leave the layout as is - if (data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) - { - showConnectedLayout(); - } - } - else - { - showDisconnectedLayout(); - } - - return false; -} - -void LLFacebookStatusPanel::sendStatus() -{ - std::string message = mMessageTextEditor->getValue().asString(); - if (!message.empty()) - { - LLFacebookConnect::instance().updateStatus(message); - } -} - -void LLFacebookStatusPanel::onVisibilityChange(BOOL visible) -{ - if (visible) - { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectAccountStateChange, this, _1)); - - LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); - LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectInfoChange, this)); - - //Connected - if (LLFacebookConnect::instance().isConnected()) - { - showConnectedLayout(); - } - //Check if connected (show disconnected layout in meantime) - else - { - showDisconnectedLayout(); - } - if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) || - (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED)) - { - LLFacebookConnect::instance().checkConnectionToFacebook(); - } - } - else - { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); - LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); - } -} - -bool LLFacebookStatusPanel::onFacebookConnectInfoChange() -{ - LLSD info = LLFacebookConnect::instance().getInfo(); - std::string clickable_name; - - //Strings of format [http://www.somewebsite.com Click Me] become clickable text - if (info.has("link") && info.has("name")) - { - clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; - } - - mAccountNameLabel->setText(clickable_name); - - return false; -} - -void LLFacebookStatusPanel::showConnectButton() -{ - if (!mConnectButton->getVisible()) - { - mConnectButton->setVisible(TRUE); - mDisconnectButton->setVisible(FALSE); - } -} - -void LLFacebookStatusPanel::hideConnectButton() -{ - if (mConnectButton->getVisible()) - { - mConnectButton->setVisible(FALSE); - mDisconnectButton->setVisible(TRUE); - } -} - -void LLFacebookStatusPanel::showDisconnectedLayout() -{ - mAccountCaptionLabel->setText(getString("facebook_disconnected")); - mAccountNameLabel->setText(std::string("")); - showConnectButton(); -} - -void LLFacebookStatusPanel::showConnectedLayout() -{ - LLFacebookConnect::instance().loadFacebookInfo(); - - mAccountCaptionLabel->setText(getString("facebook_connected")); - hideConnectButton(); -} - -void LLFacebookStatusPanel::onConnect() -{ - LLFacebookConnect::instance().checkConnectionToFacebook(true); -} - -void LLFacebookStatusPanel::onDisconnect() -{ - LLFacebookConnect::instance().disconnectFromFacebook(); -} - -void LLFacebookStatusPanel::clearAndClose() -{ - mMessageTextEditor->setValue(""); - - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } -} - -/////////////////////////// -//LLFacebookPhotoPanel/////// -/////////////////////////// - -LLFacebookPhotoPanel::LLFacebookPhotoPanel() : - mResolutionComboBox(NULL), - mRefreshBtn(NULL), - mBtnPreview(NULL), - mWorkingLabel(NULL), - mThumbnailPlaceholder(NULL), - mCaptionTextBox(NULL), - mPostButton(NULL), - mBigPreviewFloater(NULL), - mQuality(MAX_QUALITY) -{ - mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFacebookPhotoPanel::onSend, this)); - mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLFacebookPhotoPanel::onClickNewSnapshot, this)); - mCommitCallbackRegistrar.add("SocialSharing.BigPreview", boost::bind(&LLFacebookPhotoPanel::onClickBigPreview, this)); -} - -LLFacebookPhotoPanel::~LLFacebookPhotoPanel() -{ - if (mPreviewHandle.get()) - { - mPreviewHandle.get()->die(); - } -} - -BOOL LLFacebookPhotoPanel::postBuild() -{ - setVisibleCallback(boost::bind(&LLFacebookPhotoPanel::onVisibilityChange, this, _2)); - - mResolutionComboBox = getChild("resolution_combobox"); - mResolutionComboBox->setValue("[i1200,i630]"); // hardcoded defaults ftw! - mResolutionComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); - mFilterComboBox = getChild("filters_combobox"); - mFilterComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); - mRefreshBtn = getChild("new_snapshot_btn"); - mBtnPreview = getChild("big_preview_btn"); - mWorkingLabel = getChild("working_lbl"); - mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - mCaptionTextBox = getChild("photo_caption"); - mPostButton = getChild("post_photo_btn"); - mCancelButton = getChild("cancel_photo_btn"); - mBigPreviewFloater = dynamic_cast(LLFloaterReg::getInstance("big_preview")); - - // Update filter list - std::vector filter_list = LLImageFiltersManager::getInstance()->getFiltersList(); - LLComboBox* filterbox = static_cast(mFilterComboBox); - for (U32 i = 0; i < filter_list.size(); i++) - { - filterbox->add(filter_list[i]); - } - - return LLPanel::postBuild(); -} - -// virtual -S32 LLFacebookPhotoPanel::notify(const LLSD& info) -{ - if (info.has("snapshot-updating")) - { - // Disable the Post button and whatever else while the snapshot is not updated - // updateControls(); - return 1; - } - - if (info.has("snapshot-updated")) - { - // Enable the send/post/save buttons. - updateControls(); - - // The refresh button is initially hidden. We show it after the first update, - // i.e. after snapshot is taken - LLUICtrl * refresh_button = getRefreshBtn(); - if (!refresh_button->getVisible()) - { - refresh_button->setVisible(true); - } - return 1; - } - - return 0; -} - -void LLFacebookPhotoPanel::draw() -{ - LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); - - // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts) - bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); - mCancelButton->setEnabled(no_ongoing_connection); - mCaptionTextBox->setEnabled(no_ongoing_connection); - mResolutionComboBox->setEnabled(no_ongoing_connection); - mFilterComboBox->setEnabled(no_ongoing_connection); - mRefreshBtn->setEnabled(no_ongoing_connection); - mBtnPreview->setEnabled(no_ongoing_connection); - - // Reassign the preview floater if we have the focus and the preview exists - if (hasFocus() && isPreviewVisible()) - { - attachPreview(); - } - - // Toggle the button state as appropriate - bool preview_active = (isPreviewVisible() && mBigPreviewFloater->isFloaterOwner(getParentByType())); - mBtnPreview->setToggleState(preview_active); - - // Display the thumbnail if one is available - if (previewp && previewp->getThumbnailImage()) - { - const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); - const S32 thumbnail_w = previewp->getThumbnailWidth(); - const S32 thumbnail_h = previewp->getThumbnailHeight(); - - // calc preview offset within the preview rect - const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2; - const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2; - S32 offset_x = thumbnail_rect.mLeft + local_offset_x; - S32 offset_y = thumbnail_rect.mBottom + local_offset_y; - - gGL.matrixMode(LLRender::MM_MODELVIEW); - // Apply floater transparency to the texture unless the floater is focused. - F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); - LLColor4 color = LLColor4::white; - gl_draw_scaled_image(offset_x, offset_y, - thumbnail_w, thumbnail_h, - previewp->getThumbnailImage(), color % alpha); - } - - // Update the visibility of the working (computing preview) label - mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); - - // Enable Post if we have a preview to send and no on going connection being processed - mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); - - // Draw the rest of the panel on top of it - LLPanel::draw(); -} - -LLSnapshotLivePreview* LLFacebookPhotoPanel::getPreviewView() -{ - LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); - return previewp; -} - -void LLFacebookPhotoPanel::onVisibilityChange(BOOL visible) -{ - if (visible) - { - if (mPreviewHandle.get()) - { - LLSnapshotLivePreview* preview = getPreviewView(); - if (preview) - { - LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; - preview->updateSnapshot(TRUE); - } - } - else - { - LLRect full_screen_rect = getRootView()->getRect(); - LLSnapshotLivePreview::Params p; - p.rect(full_screen_rect); - LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); - mPreviewHandle = previewp->getHandle(); - mQuality = MAX_QUALITY; - - previewp->setContainer(this); - previewp->setSnapshotType(LLSnapshotModel::SNAPSHOT_WEB); - previewp->setSnapshotFormat(LLSnapshotModel::SNAPSHOT_FORMAT_JPEG); - previewp->setSnapshotQuality(mQuality, false); - previewp->setThumbnailSubsampled(TRUE); // We want the preview to reflect the *saved* image - previewp->setAllowRenderUI(FALSE); // We do not want the rendered UI in our snapshots - previewp->setAllowFullScreenPreview(FALSE); // No full screen preview in SL Share mode - previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); - - updateControls(); - } - } -} - -void LLFacebookPhotoPanel::onClickNewSnapshot() -{ - LLSnapshotLivePreview* previewp = getPreviewView(); - if (previewp) - { - previewp->updateSnapshot(TRUE); - } -} - -void LLFacebookPhotoPanel::onClickBigPreview() -{ - // Toggle the preview - if (isPreviewVisible()) - { - LLFloaterReg::hideInstance("big_preview"); - } - else - { - attachPreview(); - LLFloaterReg::showInstance("big_preview"); - } -} - -bool LLFacebookPhotoPanel::isPreviewVisible() -{ - return (mBigPreviewFloater && mBigPreviewFloater->getVisible()); -} - -void LLFacebookPhotoPanel::attachPreview() -{ - if (mBigPreviewFloater) - { - LLSnapshotLivePreview* previewp = getPreviewView(); - mBigPreviewFloater->setPreview(previewp); - mBigPreviewFloater->setFloaterOwner(getParentByType()); - } -} - -void LLFacebookPhotoPanel::onSend() -{ - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookPhotoPanel", boost::bind(&LLFacebookPhotoPanel::onFacebookConnectStateChange, this, _1)); - - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - sendPhoto(); - } - else - { - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } -} - -bool LLFacebookPhotoPanel::onFacebookConnectStateChange(const LLSD& data) -{ - switch (data.get("enum").asInteger()) - { - case LLFacebookConnect::FB_CONNECTED: - sendPhoto(); - break; - - case LLFacebookConnect::FB_POSTED: - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); - clearAndClose(); - break; - } - - return false; -} - -void LLFacebookPhotoPanel::sendPhoto() -{ - // Get the caption - std::string caption = mCaptionTextBox->getValue().asString(); - - // Get the image - LLSnapshotLivePreview* previewp = getPreviewView(); - - // Post to Facebook - LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); - - updateControls(); -} - -void LLFacebookPhotoPanel::clearAndClose() -{ - mCaptionTextBox->setValue(""); - - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - if (mBigPreviewFloater) - { - mBigPreviewFloater->closeOnFloaterOwnerClosing(floater); - } - } -} - -void LLFacebookPhotoPanel::updateControls() -{ - LLSnapshotLivePreview* previewp = getPreviewView(); - BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); - - // *TODO: Separate maximum size for Web images from postcards - LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; - - updateResolution(FALSE); -} - -void LLFacebookPhotoPanel::updateResolution(BOOL do_update) -{ - LLComboBox* combobox = static_cast(mResolutionComboBox); - LLComboBox* filterbox = static_cast(mFilterComboBox); - - std::string sdstring = combobox->getSelectedValue(); - LLSD sdres; - std::stringstream sstream(sdstring); - LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); - - S32 width = sdres[0]; - S32 height = sdres[1]; - - // Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale - std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : ""); - - LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); - if (previewp && combobox->getCurrentIndex() >= 0) - { - S32 original_width = 0, original_height = 0; - previewp->getSize(original_width, original_height); - - if (width == 0 || height == 0) - { - // take resolution from current window size - LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; - previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); - } - else - { - // use the resolution from the selected pre-canned drop-down choice - LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL; - previewp->setSize(width, height); - } - - checkAspectRatio(width); - - previewp->getSize(width, height); - - // Recompute quality setting - mQuality = compute_jpeg_quality(width, height); - previewp->setSnapshotQuality(mQuality, false); - - if (original_width != width || original_height != height) - { - previewp->setSize(width, height); - if (do_update) - { - previewp->updateSnapshot(TRUE); - updateControls(); - } - } - // Get the old filter, compare to the current one "filter_name" and set if changed - std::string original_filter = previewp->getFilter(); - if (original_filter != filter_name) - { - previewp->setFilter(filter_name); - if (do_update) - { - previewp->updateSnapshot(FALSE, TRUE); - updateControls(); - } - } - } -} - -void LLFacebookPhotoPanel::checkAspectRatio(S32 index) -{ - LLSnapshotLivePreview *previewp = getPreviewView(); - - BOOL keep_aspect = FALSE; - - if (0 == index) // current window size - { - keep_aspect = TRUE; - } - else // predefined resolution - { - keep_aspect = FALSE; - } - - if (previewp) - { - previewp->mKeepAspectRatio = keep_aspect; - } -} - -LLUICtrl* LLFacebookPhotoPanel::getRefreshBtn() -{ - return mRefreshBtn; -} - -//////////////////////// -//LLFacebookCheckinPanel// -//////////////////////// - -LLFacebookCheckinPanel::LLFacebookCheckinPanel() : - mMapUrl(""), - mReloadingMapTexture(false) -{ - mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLFacebookCheckinPanel::onSend, this)); -} - -BOOL LLFacebookCheckinPanel::postBuild() -{ - // Keep pointers to widgets so we don't traverse the UI hierarchy too often - mPostButton = getChild("post_place_btn"); - mCancelButton = getChild("cancel_place_btn"); - mMessageTextEditor = getChild("place_caption"); - mMapLoadingIndicator = getChild("map_loading_indicator"); - mMapPlaceholder = getChild("map_placeholder"); - mMapDefault = getChild("map_default"); - mMapCheckBox = getChild("add_place_view_cb"); - - return LLPanel::postBuild(); -} - -void LLFacebookCheckinPanel::draw() -{ - bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); - mPostButton->setEnabled(no_ongoing_connection); - mCancelButton->setEnabled(no_ongoing_connection); - mMessageTextEditor->setEnabled(no_ongoing_connection); - mMapCheckBox->setEnabled(no_ongoing_connection); - - std::string map_url = get_map_url(); - // Did we change location? - if (map_url != mMapUrl) - { - mMapUrl = map_url; - // Load the map tile - mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); - mReloadingMapTexture = true; - // In the meantime, put the "loading" indicator on, hide the tile map and disable the checkbox - mMapLoadingIndicator->setVisible(true); - mMapPlaceholder->setVisible(false); - } - // Are we done loading the map tile? - if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) - { - // Don't do it again next time around - mReloadingMapTexture = false; - // Convert the map texture to the appropriate image object - LLPointer ui_image = new LLUIImage(mMapUrl, mMapTexture); - // Load the map widget with the correct map tile image - mMapPlaceholder->setImage(ui_image); - // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value - mMapLoadingIndicator->setVisible(false); - mMapPlaceholder->setVisible(true); - } - // Show the default icon if that's the checkbox value (the real one...) - // This will hide/show the loading indicator and/or tile underneath - mMapDefault->setVisible(!(mMapCheckBox->get())); - - LLPanel::draw(); -} - -void LLFacebookCheckinPanel::onSend() -{ - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookCheckinPanel", boost::bind(&LLFacebookCheckinPanel::onFacebookConnectStateChange, this, _1)); - - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - sendCheckin(); - } - else - { - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } -} - -bool LLFacebookCheckinPanel::onFacebookConnectStateChange(const LLSD& data) -{ - switch (data.get("enum").asInteger()) - { - case LLFacebookConnect::FB_CONNECTED: - sendCheckin(); - break; - - case LLFacebookConnect::FB_POSTED: - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); - clearAndClose(); - break; - } - - return false; -} - -void LLFacebookCheckinPanel::sendCheckin() -{ - // Get the location SLURL - LLSLURL slurl; - LLAgentUI::buildSLURL(slurl); - std::string slurl_string = slurl.getSLURLString(); - - // Use a valid http:// URL if the scheme is secondlife:// - LLURI slurl_uri(slurl_string); - if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME) - { - slurl_string = DEFAULT_CHECKIN_LOCATION_URL; - } - - // Add query parameters so Google Analytics can track incoming clicks! - slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS; - - // Get the region name - std::string region_name(""); - LLViewerRegion *regionp = gAgent.getRegion(); - if (regionp) - { - region_name = regionp->getName(); - } - - // Get the region description - std::string description; - LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); - - // Optionally add the region map view - bool add_map_view = mMapCheckBox->getValue().asBoolean(); - std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL); - - // Get the caption - std::string caption = mMessageTextEditor->getValue().asString(); - - // Post to Facebook - LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); -} - -void LLFacebookCheckinPanel::clearAndClose() -{ - mMessageTextEditor->setValue(""); - - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } -} - -/////////////////////////// -//LLFacebookFriendsPanel////// -/////////////////////////// - -LLFacebookFriendsPanel::LLFacebookFriendsPanel() : - mFriendsStatusCaption(NULL), - mSecondLifeFriends(NULL), - mSuggestedFriends(NULL) -{ -} - -LLFacebookFriendsPanel::~LLFacebookFriendsPanel() -{ - LLAvatarTracker::instance().removeObserver(this); -} - -BOOL LLFacebookFriendsPanel::postBuild() -{ - mFriendsStatusCaption = getChild("facebook_friends_status"); - - mSecondLifeFriends = getChild("second_life_friends"); - mSecondLifeFriends->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); - - mSuggestedFriends = getChild("suggested_friends"); - mSuggestedFriends->setContextMenu(&LLPanelPeopleMenus::gSuggestedFriendsContextMenu); - - setVisibleCallback(boost::bind(&LLFacebookFriendsPanel::updateFacebookList, this, _2)); - - LLAvatarTracker::instance().addObserver(this); - - return LLPanel::postBuild(); -} - -bool LLFacebookFriendsPanel::updateSuggestedFriendList() -{ - const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); - uuid_vec_t& second_life_friends = mSecondLifeFriends->getIDs(); - second_life_friends.clear(); - uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs(); - suggested_friends.clear(); - - //Add suggested friends - LLSD friends = LLFacebookConnect::instance().getContent(); - for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i) - { - LLUUID agent_id = (*i).asUUID(); - if (agent_id.notNull()) - { - bool second_life_buddy = av_tracker.isBuddy(agent_id); - if (second_life_buddy) - { - second_life_friends.push_back(agent_id); - } - else - { - //FB+SL but not SL friend - suggested_friends.push_back(agent_id); - } - } - } - - //Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display) - mSecondLifeFriends->setDirty(true, !mSecondLifeFriends->filterHasMatches()); - mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches()); - showFriendsAccordionsIfNeeded(); - - return false; -} - -void LLFacebookFriendsPanel::showFriendsAccordionsIfNeeded() -{ - // Show / hide the status text : needs to be done *before* showing / hidding the accordions - if (!mSecondLifeFriends->filterHasMatches() && !mSuggestedFriends->filterHasMatches()) - { - // Show some explanation text if the lists are empty... - mFriendsStatusCaption->setVisible(true); - if (LLFacebookConnect::instance().isConnected()) - { - //...you're connected to FB but have no friends :( - mFriendsStatusCaption->setText(getString("facebook_friends_empty")); - } - else - { - //...you're not connected to FB - mFriendsStatusCaption->setText(getString("facebook_friends_no_connected")); - } - // Hide the lists - getChild("friends_accordion")->setVisible(false); - getChild("tab_second_life_friends")->setVisible(false); - getChild("tab_suggested_friends")->setVisible(false); - } - else - { - // We have something in the lists, hide the explanatory text - mFriendsStatusCaption->setVisible(false); - - // Show the lists - LLAccordionCtrl* accordion = getChild("friends_accordion"); - accordion->setVisible(true); - - // Expand and show accordions if needed, else - hide them - getChild("tab_second_life_friends")->setVisible(mSecondLifeFriends->filterHasMatches()); - getChild("tab_suggested_friends")->setVisible(mSuggestedFriends->filterHasMatches()); - - // Rearrange accordions - accordion->arrange(); - } -} - -void LLFacebookFriendsPanel::changed(U32 mask) -{ - if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE)) - { - LLFacebookConnect::instance().loadFacebookFriends(); - updateFacebookList(true); - } -} - - -void LLFacebookFriendsPanel::updateFacebookList(bool visible) -{ - if (visible) - { - // We want this to be called to fetch the friends list once a connection is established - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookFriendsPanel"); - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::onConnectedToFacebook, this, _1)); - - // We then want this to be called to update the displayed lists once the list of friends is received - LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLFacebookFriendsPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::updateSuggestedFriendList, this)); - - // Try to connect to Facebook - if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) || - (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED)) - { - LLFacebookConnect::instance().checkConnectionToFacebook(); - } - // Loads FB friends - if (LLFacebookConnect::instance().isConnected()) - { - LLFacebookConnect::instance().loadFacebookFriends(); - } - // Sort the FB friends and update the lists - updateSuggestedFriendList(); - } -} - -bool LLFacebookFriendsPanel::onConnectedToFacebook(const LLSD& data) -{ - LLSD::Integer connection_state = data.get("enum").asInteger(); - - if (connection_state == LLFacebookConnect::FB_CONNECTED) - { - LLFacebookConnect::instance().loadFacebookFriends(); - } - else if (connection_state == LLFacebookConnect::FB_NOT_CONNECTED) - { - updateSuggestedFriendList(); - } - - return false; -} - -//////////////////////// -//LLFloaterFacebook/////// -//////////////////////// - -LLFloaterFacebook::LLFloaterFacebook(const LLSD& key) : LLFloater(key), - mFacebookPhotoPanel(NULL), - mStatusErrorText(NULL), - mStatusLoadingText(NULL), - mStatusLoadingIndicator(NULL) -{ - mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterFacebook::onCancel, this)); -} - -void LLFloaterFacebook::onClose(bool app_quitting) -{ - LLFloaterBigPreview* big_preview_floater = dynamic_cast(LLFloaterReg::getInstance("big_preview")); - if (big_preview_floater) - { - big_preview_floater->closeOnFloaterOwnerClosing(this); - } - LLFloater::onClose(app_quitting); -} - -void LLFloaterFacebook::onCancel() -{ - LLFloaterBigPreview* big_preview_floater = dynamic_cast(LLFloaterReg::getInstance("big_preview")); - if (big_preview_floater) - { - big_preview_floater->closeOnFloaterOwnerClosing(this); - } - closeFloater(); -} - -BOOL LLFloaterFacebook::postBuild() -{ - // Keep tab of the Photo Panel - mFacebookPhotoPanel = static_cast(getChild("panel_facebook_photo")); - // Connection status widgets - mStatusErrorText = getChild("connection_error_text"); - mStatusLoadingText = getChild("connection_loading_text"); - mStatusLoadingIndicator = getChild("connection_loading_indicator"); - return LLFloater::postBuild(); -} - -void LLFloaterFacebook::showPhotoPanel() -{ - LLTabContainer* parent = dynamic_cast(mFacebookPhotoPanel->getParent()); - if (!parent) - { - LL_WARNS() << "Cannot find panel container" << LL_ENDL; - return; - } - - parent->selectTabPanel(mFacebookPhotoPanel); -} - -void LLFloaterFacebook::draw() -{ - if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator) - { - mStatusErrorText->setVisible(false); - mStatusLoadingText->setVisible(false); - mStatusLoadingIndicator->setVisible(false); - LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); - std::string status_text; - - switch (connection_state) - { - case LLFacebookConnect::FB_NOT_CONNECTED: - // No status displayed when first opening the panel and no connection done - case LLFacebookConnect::FB_CONNECTED: - // When successfully connected, no message is displayed - case LLFacebookConnect::FB_POSTED: - // No success message to show since we actually close the floater after successful posting completion - break; - case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: - // Connection loading indicator - mStatusLoadingText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookConnecting"); - mStatusLoadingText->setValue(status_text); - mStatusLoadingIndicator->setVisible(true); - break; - case LLFacebookConnect::FB_POSTING: - // Posting indicator - mStatusLoadingText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookPosting"); - mStatusLoadingText->setValue(status_text); - mStatusLoadingIndicator->setVisible(true); - break; - case LLFacebookConnect::FB_CONNECTION_FAILED: - // Error connecting to the service - mStatusErrorText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookErrorConnecting"); - mStatusErrorText->setValue(status_text); - break; - case LLFacebookConnect::FB_POST_FAILED: - // Error posting to the service - mStatusErrorText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookErrorPosting"); - mStatusErrorText->setValue(status_text); - break; - case LLFacebookConnect::FB_DISCONNECTING: - // Disconnecting loading indicator - mStatusLoadingText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookDisconnecting"); - mStatusLoadingText->setValue(status_text); - mStatusLoadingIndicator->setVisible(true); - break; - case LLFacebookConnect::FB_DISCONNECT_FAILED: - // Error disconnecting from the service - mStatusErrorText->setVisible(true); - status_text = LLTrans::getString("SocialFacebookErrorDisconnecting"); - mStatusErrorText->setValue(status_text); - break; - } - } - LLFloater::draw(); -} - diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h deleted file mode 100644 index a4ca666b20..0000000000 --- a/indra/newview/llfloaterfacebook.h +++ /dev/null @@ -1,185 +0,0 @@ -/** -* @file llfloaterfacebook.h -* @brief Header file for llfloaterfacebook -* @author Gilbert@lindenlab.com -* -* $LicenseInfo:firstyear=2013&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2013, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ -#ifndef LL_LLFLOATERFACEBOOK_H -#define LL_LLFLOATERFACEBOOK_H - -#include "llcallingcard.h" -#include "llfloater.h" -#include "lltextbox.h" -#include "llviewertexture.h" - -class LLIconCtrl; -class LLCheckBoxCtrl; -class LLSnapshotLivePreview; -class LLAvatarList; -class LLFloaterBigPreview; - -class LLFacebookStatusPanel : public LLPanel -{ -public: - LLFacebookStatusPanel(); - BOOL postBuild(); - void draw(); - void onSend(); - bool onFacebookConnectStateChange(const LLSD& data); - bool onFacebookConnectAccountStateChange(const LLSD& data); - - void sendStatus(); - void clearAndClose(); - -private: - void onVisibilityChange(BOOL new_visibility); - bool onFacebookConnectInfoChange(); - void onConnect(); - void onUseAnotherAccount(); - void onDisconnect(); - - void showConnectButton(); - void hideConnectButton(); - void showDisconnectedLayout(); - void showConnectedLayout(); - - LLTextBox * mAccountCaptionLabel; - LLTextBox * mAccountNameLabel; - LLUICtrl * mPanelButtons; - LLUICtrl * mConnectButton; - LLUICtrl * mDisconnectButton; - LLUICtrl* mMessageTextEditor; - LLUICtrl* mPostButton; - LLUICtrl* mCancelButton; -}; - -class LLFacebookPhotoPanel : public LLPanel -{ -public: - LLFacebookPhotoPanel(); - ~LLFacebookPhotoPanel(); - - BOOL postBuild(); - void draw(); - - LLSnapshotLivePreview* getPreviewView(); - void onVisibilityChange(BOOL new_visibility); - void onClickBigPreview(); - void onClickNewSnapshot(); - void onSend(); - S32 notify(const LLSD& info); - bool onFacebookConnectStateChange(const LLSD& data); - - void sendPhoto(); - void clearAndClose(); - - void updateControls(); - void updateResolution(BOOL do_update); - void checkAspectRatio(S32 index); - LLUICtrl* getRefreshBtn(); - -private: - bool isPreviewVisible(); - void attachPreview(); - - LLHandle mPreviewHandle; - - LLUICtrl * mResolutionComboBox; - LLUICtrl * mFilterComboBox; - LLUICtrl * mRefreshBtn; - LLUICtrl * mWorkingLabel; - LLUICtrl * mThumbnailPlaceholder; - LLUICtrl * mCaptionTextBox; - LLUICtrl * mPostButton; - LLUICtrl * mCancelButton; - LLButton * mBtnPreview; - - LLFloaterBigPreview * mBigPreviewFloater; - - S32 mQuality; // Compression quality -}; - -class LLFacebookCheckinPanel : public LLPanel -{ -public: - LLFacebookCheckinPanel(); - BOOL postBuild(); - void draw(); - void onSend(); - bool onFacebookConnectStateChange(const LLSD& data); - - void sendCheckin(); - void clearAndClose(); - -private: - std::string mMapUrl; - LLPointer mMapTexture; - LLUICtrl* mPostButton; - LLUICtrl* mCancelButton; - LLUICtrl* mMessageTextEditor; - LLUICtrl* mMapLoadingIndicator; - LLIconCtrl* mMapPlaceholder; - LLIconCtrl* mMapDefault; - LLCheckBoxCtrl* mMapCheckBox; - bool mReloadingMapTexture; -}; - -class LLFacebookFriendsPanel : public LLPanel, public LLFriendObserver -{ -public: - LLFacebookFriendsPanel(); - ~LLFacebookFriendsPanel(); - BOOL postBuild(); - virtual void changed(U32 mask); - -private: - bool updateSuggestedFriendList(); - void showFriendsAccordionsIfNeeded(); - void updateFacebookList(bool visible); - bool onConnectedToFacebook(const LLSD& data); - - LLTextBox * mFriendsStatusCaption; - LLAvatarList* mSecondLifeFriends; - LLAvatarList* mSuggestedFriends; -}; - -class LLFloaterFacebook : public LLFloater -{ -public: - LLFloaterFacebook(const LLSD& key); - BOOL postBuild(); - void draw(); - void onClose(bool app_quitting); - void onCancel(); - - void showPhotoPanel(); - -private: - LLFacebookPhotoPanel* mFacebookPhotoPanel; - LLTextBox* mStatusErrorText; - LLTextBox* mStatusLoadingText; - LLUICtrl* mStatusLoadingIndicator; -}; - -#endif // LL_LLFLOATERFACEBOOK_H - diff --git a/indra/newview/llfloateroutfitsnapshot.cpp b/indra/newview/llfloateroutfitsnapshot.cpp index d80793f9e4..bfcd1b8b47 100644 --- a/indra/newview/llfloateroutfitsnapshot.cpp +++ b/indra/newview/llfloateroutfitsnapshot.cpp @@ -30,9 +30,7 @@ #include "llfloateroutfitsnapshot.h" #include "llagent.h" -#include "llfacebookconnect.h" #include "llfloaterreg.h" -#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloatertwitter.h" #include "llimagefiltersmanager.h" diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index c08aaf3f50..8e0f6f312d 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -28,9 +28,7 @@ #include "llfloatersnapshot.h" -#include "llfacebookconnect.h" #include "llfloaterreg.h" -#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloatertwitter.h" #include "llimagefiltersmanager.h" @@ -1241,11 +1239,10 @@ BOOL LLFloaterSnapshot::isWaitingState() BOOL LLFloaterSnapshotBase::ImplBase::updatePreviewList(bool initialized) { - LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance("facebook"); LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance("flickr"); LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance("twitter"); - if (!initialized && !floater_facebook && !floater_flickr && !floater_twitter) + if (!initialized && !floater_flickr && !floater_twitter) return FALSE; BOOL changed = FALSE; diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 3b17368445..13953d6be5 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -30,7 +30,6 @@ #include "lliconctrl.h" #include "llfloaterreg.h" #include "llhttpconstants.h" -#include "llfacebookconnect.h" #include "llflickrconnect.h" #include "lltwitterconnect.h" #include "lllayoutstack.h" @@ -289,17 +288,7 @@ void LLFloaterWebContent::onOpen(const LLSD& key) //virtual void LLFloaterWebContent::onClose(bool app_quitting) { - // If we close the web browsing window showing the facebook login, we need to signal to this object that the connection will not happen - // MAINT-3440 note change here to use findInstance and not getInstance - latter creates an instance if it's not there which is bad. - LLFloater* fbc_web = LLFloaterReg::findInstance("fbc_web"); - if (fbc_web == this) - { - if (!LLFacebookConnect::instance().isConnected()) - { - LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTION_FAILED); - } - } - // Same with Flickr + // If we close the web browsing window showing the Flickr login, we need to signal to this object that the connection will not happen // MAINT-3440 note change here to use findInstance and not getInstance - latter creates an instance if it's not there which is bad. LLFloater* flickr_web = LLFloaterReg::findInstance("flickr_web"); if (flickr_web == this) @@ -309,7 +298,7 @@ void LLFloaterWebContent::onClose(bool app_quitting) LLFlickrConnect::instance().setConnectionState(LLFlickrConnect::FLICKR_CONNECTION_FAILED); } } - // And Twitter + // Same with Twitter // MAINT-3440 note change here to use findInstance and not getInstance - latter creates an instance if it's not there which is bad. LLFloater* twitter_web = LLFloaterReg::findInstance("twitter_web"); if (twitter_web == this) @@ -380,13 +369,6 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent // The browser instance wants its window closed. closeFloater(); } - else if(event == MEDIA_EVENT_GEOMETRY_CHANGE) - { - if (mCurrentURL.find("facebook.com/dialog/oauth") == std::string::npos) // HACK to fix ACME-1317 - Cho - { - geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight()); - } - } else if(event == MEDIA_EVENT_STATUS_TEXT_CHANGED ) { const std::string text = self->getStatusText(); diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp index fef0631fa6..ba831ab2ed 100644 --- a/indra/newview/llnotificationscripthandler.cpp +++ b/indra/newview/llnotificationscripthandler.cpp @@ -35,7 +35,6 @@ #include "llnotificationmanager.h" #include "llnotifications.h" #include "llscriptfloater.h" -#include "llfacebookconnect.h" #include "llavatarname.h" #include "llavatarnamecache.h" diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 1cbff37287..82feadd4ed 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -54,7 +54,6 @@ #include "llcallingcard.h" // for LLAvatarTracker #include "llcallbacklist.h" #include "llerror.h" -#include "llfacebookconnect.h" #include "llfloateravatarpicker.h" #include "llfriendcard.h" #include "llgroupactions.h" @@ -536,7 +535,6 @@ public: LLPanelPeople::LLPanelPeople() : LLPanel(), - mTryToConnectToFacebook(true), mTabContainer(NULL), mOnlineFriendList(NULL), mAllFriendList(NULL), @@ -633,11 +631,9 @@ BOOL LLPanelPeople::postBuild() // updater is active only if panel is visible to user. friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2)); friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this)); - friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::updateFacebookList, this, _2)); mOnlineFriendList = friends_tab->getChild("avatars_online"); mAllFriendList = friends_tab->getChild("avatars_all"); - mSuggestedFriends = friends_tab->getChild("suggested_friends"); mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online")); mOnlineFriendList->setShowIcons("FriendsListShowIcons"); mOnlineFriendList->showPermissions("FriendsListShowPermissions"); @@ -673,7 +669,6 @@ BOOL LLPanelPeople::postBuild() mRecentList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); mOnlineFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); - mSuggestedFriends->setContextMenu(&LLPanelPeopleMenus::gSuggestedFriendsContextMenu); setSortOrder(mRecentList, (ESortOrder)gSavedSettings.getU32("RecentPeopleSortOrder"), false); setSortOrder(mAllFriendList, (ESortOrder)gSavedSettings.getU32("FriendsSortOrder"), false); @@ -752,7 +747,7 @@ void LLPanelPeople::updateFriendListHelpText() // Seems sometimes all_friends can be empty because of issue with Inventory loading (clear cache, slow connection...) // So, lets check all lists to avoid overlapping the text with online list. See EXT-6448. - bool any_friend_exists = mAllFriendList->filterHasMatches() || mOnlineFriendList->filterHasMatches() || mSuggestedFriends->filterHasMatches(); + bool any_friend_exists = mAllFriendList->filterHasMatches() || mOnlineFriendList->filterHasMatches(); no_friends_text->setVisible(!any_friend_exists); if (no_friends_text->getVisible()) { @@ -819,40 +814,9 @@ void LLPanelPeople::updateFriendList() mAllFriendList->setDirty(true, !mAllFriendList->filterHasMatches()); //update trash and other buttons according to a selected item updateButtons(); - updateSuggestedFriendList(); showFriendsAccordionsIfNeeded(); } -bool LLPanelPeople::updateSuggestedFriendList() -{ - const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); - uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs(); - suggested_friends.clear(); - - //Add suggested friends - LLSD friends = LLFacebookConnect::instance().getContent(); - for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i) - { - LLUUID agent_id = (*i).asUUID(); - bool second_life_buddy = agent_id.notNull() ? av_tracker.isBuddy(agent_id) : false; - - if(!second_life_buddy) - { - //FB+SL but not SL friend - if (agent_id.notNull()) - { - suggested_friends.push_back(agent_id); - } - } - } - - //Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display) - mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches()); - showFriendsAccordionsIfNeeded(); - - return false; -} - void LLPanelPeople::updateNearbyList() { if (!mNearbyList) @@ -876,51 +840,6 @@ void LLPanelPeople::updateRecentList() mRecentList->setDirty(); } -bool LLPanelPeople::onConnectedToFacebook(const LLSD& data) -{ - LLSD::Integer connection_state = data.get("enum").asInteger(); - - if (connection_state == LLFacebookConnect::FB_CONNECTED) - { - LLFacebookConnect::instance().loadFacebookFriends(); - } - else if(connection_state == LLFacebookConnect::FB_NOT_CONNECTED) - { - updateSuggestedFriendList(); - }; - - return false; -} - -void LLPanelPeople::updateFacebookList(bool visible) -{ - if (visible) - { - LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLPanelPeople", boost::bind(&LLPanelPeople::updateSuggestedFriendList, this)); - - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLPanelPeople", boost::bind(&LLPanelPeople::onConnectedToFacebook, this, _1)); - - if (LLFacebookConnect::instance().isConnected()) - { - LLFacebookConnect::instance().loadFacebookFriends(); - } - else if(mTryToConnectToFacebook) - { - LLFacebookConnect::instance().checkConnectionToFacebook(); - mTryToConnectToFacebook = false; - } - - updateSuggestedFriendList(); - } - else - { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople"); - LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople"); - } -} - void LLPanelPeople::updateButtons() { std::string cur_tab = getActiveTabName(); @@ -1139,11 +1058,9 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) mOnlineFriendList->setNameFilter(filter); mAllFriendList->setNameFilter(filter); - mSuggestedFriends->setNameFilter(filter); setAccordionCollapsedByUser("tab_online", false); setAccordionCollapsedByUser("tab_all", false); - setAccordionCollapsedByUser("tab_suggested_friends", false); showFriendsAccordionsIfNeeded(); // restore accordion tabs state _after_ all manipulations @@ -1571,7 +1488,6 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded() // Expand and show accordions if needed, else - hide them showAccordion("tab_online", mOnlineFriendList->filterHasMatches()); showAccordion("tab_all", mAllFriendList->filterHasMatches()); - showAccordion("tab_suggested_friends", mSuggestedFriends->filterHasMatches()); // Rearrange accordions LLAccordionCtrl* accordion = getChild("friends_accordion"); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index c72c4fc08a..14205cebe2 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -57,8 +57,6 @@ public: // when voice is available /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); - bool mTryToConnectToFacebook; - // internals class Updater; @@ -80,10 +78,8 @@ private: // methods indirectly called by the updaters void updateFriendListHelpText(); void updateFriendList(); - bool updateSuggestedFriendList(); void updateNearbyList(); void updateRecentList(); - void updateFacebookList(bool visible); bool isItemsFreeOfFriends(const uuid_vec_t& uuids); @@ -131,8 +127,6 @@ private: void onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param); - bool onConnectedToFacebook(const LLSD& data); - void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed); void setAccordionCollapsedByUser(const std::string& name, bool collapsed); bool isAccordionCollapsedByUser(LLUICtrl* acc_tab); @@ -141,7 +135,6 @@ private: LLTabContainer* mTabContainer; LLAvatarList* mOnlineFriendList; LLAvatarList* mAllFriendList; - LLAvatarList* mSuggestedFriends; LLAvatarList* mNearbyList; LLAvatarList* mRecentList; LLGroupList* mGroupList; diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 65769ff526..42cecc9986 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -52,7 +52,6 @@ namespace LLPanelPeopleMenus PeopleContextMenu gPeopleContextMenu; NearbyPeopleContextMenu gNearbyPeopleContextMenu; -SuggestedFriendsContextMenu gSuggestedFriendsContextMenu; //== PeopleContextMenu =============================================================== @@ -413,36 +412,4 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags) hide_context_entries(menu, items, disabled_items); } -//== SuggestedFriendsContextMenu =============================================================== - -LLContextMenu* SuggestedFriendsContextMenu::createMenu() -{ - // set up the callbacks for all of the avatar menu items - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; - LLContextMenu* menu; - - // Set up for one person selected menu - const LLUUID& id = mUUIDs.front(); - registrar.add("Avatar.Profile", boost::bind(&LLAvatarActions::showProfile, id)); - registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, id)); - - // create the context menu from the XUI - menu = createFromFile("menu_people_nearby.xml"); - buildContextMenu(*menu, 0x0); - - return menu; -} - -void SuggestedFriendsContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags) -{ - menuentry_vec_t items; - menuentry_vec_t disabled_items; - - items.push_back(std::string("view_profile")); - items.push_back(std::string("add_friend")); - - hide_context_entries(menu, items, disabled_items); -} - } // namespace LLPanelPeopleMenus diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h index 5ed20e0064..3bc1f8caf7 100644 --- a/indra/newview/llpanelpeoplemenus.h +++ b/indra/newview/llpanelpeoplemenus.h @@ -62,21 +62,8 @@ protected: /*virtual*/ void buildContextMenu(class LLMenuGL& menu, U32 flags); }; -/** - * Menu used in the suggested friends list. - */ -class SuggestedFriendsContextMenu : public PeopleContextMenu -{ -public: - /*virtual*/ LLContextMenu * createMenu(); - -protected: - /*virtual*/ void buildContextMenu(class LLMenuGL& menu, U32 flags); -}; - extern PeopleContextMenu gPeopleContextMenu; extern NearbyPeopleContextMenu gNearbyPeopleContextMenu; -extern SuggestedFriendsContextMenu gSuggestedFriendsContextMenu; } // namespace LLPanelPeopleMenus diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 95c14e4226..23747a8efd 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -32,7 +32,6 @@ #include "llfloatersnapshot.h" // FIXME: create a snapshot model #include "llfloaterreg.h" -#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloatertwitter.h" @@ -59,7 +58,6 @@ private: void onSaveToEmail(); void onSaveToInventory(); void onSaveToComputer(); - void onSendToFacebook(); void onSendToTwitter(); void onSendToFlickr(); @@ -74,7 +72,6 @@ LLPanelSnapshotOptions::LLPanelSnapshotOptions() mCommitCallbackRegistrar.add("Snapshot.SaveToEmail", boost::bind(&LLPanelSnapshotOptions::onSaveToEmail, this)); mCommitCallbackRegistrar.add("Snapshot.SaveToInventory", boost::bind(&LLPanelSnapshotOptions::onSaveToInventory, this)); mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this)); - mCommitCallbackRegistrar.add("Snapshot.SendToFacebook", boost::bind(&LLPanelSnapshotOptions::onSendToFacebook, this)); mCommitCallbackRegistrar.add("Snapshot.SendToTwitter", boost::bind(&LLPanelSnapshotOptions::onSendToTwitter, this)); mCommitCallbackRegistrar.add("Snapshot.SendToFlickr", boost::bind(&LLPanelSnapshotOptions::onSendToFlickr, this)); LLGlobalEconomy::getInstance()->addObserver(this); @@ -138,18 +135,6 @@ void LLPanelSnapshotOptions::onSaveToComputer() openPanel("panel_snapshot_local"); } -void LLPanelSnapshotOptions::onSendToFacebook() -{ - LLFloaterReg::hideInstance("snapshot"); - - LLFloaterFacebook* facebook_floater = dynamic_cast(LLFloaterReg::getInstance("facebook")); - if (facebook_floater) - { - facebook_floater->showPhotoPanel(); - } - LLFloaterReg::showInstance("facebook"); -} - void LLPanelSnapshotOptions::onSendToTwitter() { LLFloaterReg::hideInstance("snapshot"); diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 5a40af14a3..f5fea9dece 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -34,7 +34,6 @@ #include "lleconomy.h" #include "llfloaterperms.h" #include "llfloaterreg.h" -#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloatertwitter.h" #include "llimagefilter.h" @@ -572,7 +571,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) if (mThumbnailSubsampled) { - // The thumbnail is be a subsampled version of the preview (used in SL Share previews, i.e. Flickr, Twitter, Facebook) + // The thumbnail is be a subsampled version of the preview (used in SL Share previews, i.e. Flickr, Twitter) raw->resize( mPreviewImage->getWidth(), mPreviewImage->getHeight(), mPreviewImage->getComponents()); @@ -638,7 +637,7 @@ LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage() if (raw) { - // The big thumbnail is a new filtered version of the preview (used in SL Share previews, i.e. Flickr, Twitter, Facebook) + // The big thumbnail is a new filtered version of the preview (used in SL Share previews, i.e. Flickr, Twitter) mBigThumbnailWidth = mPreviewImage->getWidth(); mBigThumbnailHeight = mPreviewImage->getHeight(); raw->resize( mBigThumbnailWidth, diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index 5d598aaebe..b2d2fa9d77 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "lltwitterconnect.h" +#include "llflickrconnect.h" #include "llagent.h" #include "llcallingcard.h" // for LLAvatarTracker @@ -65,6 +66,49 @@ void toast_user_for_twitter_success() LLNotificationsUtil::add("TwitterConnect", args); } +class LLTwitterConnectHandler : public LLCommandHandler +{ +public: + LLTwitterConnectHandler() : LLCommandHandler("fbc", UNTRUSTED_THROTTLE) {} + + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) + { + if (tokens.size() >= 1) + { + if (tokens[0].asString() == "connect") + { + if (tokens.size() >= 2 && tokens[1].asString() == "twitter") + { + // this command probably came from the twitter_web browser, so close it + LLFloaterReg::hideInstance("twitter_web"); + + // connect to twitter + if (query_map.has("oauth_token")) + { + LLTwitterConnect::instance().connectToTwitter(query_map["oauth_token"], query_map.get("oauth_verifier")); + } + return true; + } + else if (tokens.size() >= 2 && tokens[1].asString() == "flickr") + { + // this command probably came from the flickr_web browser, so close it + LLFloaterReg::hideInstance("flickr_web"); + + // connect to flickr + if (query_map.has("oauth_token")) + { + LLFlickrConnect::instance().connectToFlickr(query_map["oauth_token"], query_map.get("oauth_verifier")); + } + return true; + } + } + } + return false; + } +}; +LLTwitterConnectHandler gTwitterConnectHandler; + + /////////////////////////////////////////////////////////////////////////////// // void LLTwitterConnect::twitterConnectCoro(std::string requestToken, std::string oauthVerifier) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 2a61c26b30..f475ab7d66 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -67,7 +67,6 @@ #include "llfloaterexperiences.h" #include "llfloaterexperiencepicker.h" #include "llfloaterevent.h" -#include "llfloaterfacebook.h" #include "llfloaterflickr.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" @@ -353,11 +352,9 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create); LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("fbc_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("flickr_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("twitter_web", "floater_fbc_web.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); - LLFloaterReg::add("facebook", "floater_facebook.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("flickr", "floater_flickr.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("twitter", "floater_twitter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("big_preview", "floater_big_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 9f02c4b17c..a27a083a2a 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1707,7 +1707,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ // HACK: we always try to keep a spare running webkit plugin around to improve launch times. // If a spare was already created before PluginAttachDebuggerToPlugins was set, don't use it. - // Do not use a spare if launching with full viewer control (e.g. Facebook, Twitter and few others) + // Do not use a spare if launching with full viewer control (e.g. Twitter and few others) if ((plugin_basename == "media_plugin_cef") && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins") && !clean_browser) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 8f7c0ee012..2b9f0f642e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -54,7 +54,6 @@ #include "lldaycyclemanager.h" #include "lldebugview.h" #include "llenvmanager.h" -#include "llfacebookconnect.h" #include "llfilepicker.h" #include "llfirstuse.h" #include "llfloaterabout.h" diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4d9288f152..90b6510c1f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2895,7 +2895,6 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("EstateAccess"); capabilityNames.append("EstateChangeInfo"); capabilityNames.append("EventQueueGet"); - capabilityNames.append("FacebookConnect"); capabilityNames.append("FlickrConnect"); capabilityNames.append("TwitterConnect"); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 2540ee148d..d45df0d630 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -133,7 +133,6 @@ with the same filename but different name - @@ -205,8 +204,6 @@ with the same filename but different name - - @@ -592,7 +589,6 @@ with the same filename but different name - diff --git a/indra/newview/skins/default/xui/en/floater_facebook.xml b/indra/newview/skins/default/xui/en/floater_facebook.xml deleted file mode 100644 index b34d70516a..0000000000 --- a/indra/newview/skins/default/xui/en/floater_facebook.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - Error - - - - Loading... - - diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index e50747cb5f..832c2ee7da 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -23,10 +23,6 @@ name="postcard_progress_str"> Sending Email - - Posting to Facebook - Posting @@ -39,10 +35,6 @@ name="local_progress_str"> Saving to Computer - - Image uploaded - Image uploaded @@ -60,10 +52,6 @@ Saved to Computer! - Failed to upload image to your Facebook timeline. - - Failed to upload image to your Profile Feed. diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 9998f33c52..87a0bb7d70 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -306,13 +306,6 @@ parameter="conversation" /> - - - diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index b7cd6517ea..77db71d536 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6705,13 +6705,6 @@ Please select at least one type of content to search (General, Moderate, or Adul [MESSAGE] - -[MESSAGE] - - - - - - - - - - - - - - Not connected to Facebook. - - diff --git a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml deleted file mode 100644 index 97355f4689..0000000000 --- a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - Refreshing... - - - - - - Comment (optional): - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_facebook_place.xml b/indra/newview/skins/default/xui/en/panel_facebook_place.xml deleted file mode 100644 index f87b008c4e..0000000000 --- a/indra/newview/skins/default/xui/en/panel_facebook_place.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - Say something about where you are: - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_facebook_status.xml b/indra/newview/skins/default/xui/en/panel_facebook_status.xml deleted file mode 100644 index fe0f3c9279..0000000000 --- a/indra/newview/skins/default/xui/en/panel_facebook_status.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Not connected to Facebook. - - - - - - - - [http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Share-Facebook/ta-p/2149711 Learn about posting to Facebook] - - - - - What's on your mind? - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 8fc0f6f642..a47121ae99 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -367,24 +367,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M show_permissions_granted="true" top="0" width="307" /> - - - - + -