diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfacebookconnect.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llfacebookconnect.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_gear_fbc.xml | 7 |
5 files changed, 65 insertions, 0 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 39aa82dc7a..eb70cf4d10 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -96,6 +96,35 @@ public: /////////////////////////////////////////////////////////////////////////////// // +class LLFacebookPostResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLFacebookPostResponder); +public: + + virtual void completed(U32 status, const std::string& reason, const LLSD& content) + { + if (isGoodStatus(status)) + { + LL_DEBUGS("FacebookConnect") << "Post successful. content: " << content << LL_ENDL; + } + else + { + LL_WARNS("FacebookConnect") << "Failed to get a post response. reason: " << reason << " status: " << status << LL_ENDL; + } + } + + void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + if (status == 302) + { + LLFacebookConnect::instance().openFacebookWeb(content["location"]); + } + } + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class LLFacebookDisconnectResponder : public LLHTTPClient::Responder { LOG_CLASS(LLFacebookDisconnectResponder); @@ -247,6 +276,20 @@ void LLFacebookConnect::loadFacebookFriends() LLSD(), timeout, follow_redirects); } +void LLFacebookConnect::postCheckinMessage(const std::string& message, const std::string& url) +{ + // Note: We need to improve the API support to provide all the relevant data if possible + // Full set described : http://facebook-python-library.docs-library.appspot.com/facebook-python/library-manual.html + LLSD body; + if (!message.empty()) + body["message"] = message; + if (!url.empty()) + body["link"] = url; + + // Note: we can use that route for different publish action. We should be able to use the same responder. + LLHTTPClient::post(getFacebookConnectURL("/share"), body, new LLFacebookPostResponder()); +} + void LLFacebookConnect::storeContent(const LLSD& content) { mGeneration++; diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h index 8036c9ce3e..f151dd95c1 100644 --- a/indra/newview/llfacebookconnect.h +++ b/indra/newview/llfacebookconnect.h @@ -46,6 +46,7 @@ public: void getConnectionToFacebook(); void loadFacebookFriends(); + void postCheckinMessage(const std::string& message, const std::string& url); void clearContent(); void storeContent(const LLSD& content); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 0847878fb4..e0b1c3abba 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -76,6 +76,9 @@ #include "llspeakers.h" #include "llfloaterwebcontent.h" +#include "llagentui.h" +#include "llslurl.h" + #define FRIEND_LIST_UPDATE_TIMEOUT 0.5 #define NEARBY_LIST_UPDATE_INTERVAL 1 #define FBCTEST_LIST_UPDATE_INTERVAL 0.25 @@ -568,6 +571,7 @@ LLPanelPeople::LLPanelPeople() mCommitCallbackRegistrar.add("People.sendFBC", boost::bind(&LLPanelPeople::onFacebookAppSendClicked, this)); mCommitCallbackRegistrar.add("People.testaddFBC", boost::bind(&LLPanelPeople::onFacebookTestAddClicked, this)); mCommitCallbackRegistrar.add("People.testaddFBCFolderView", boost::bind(&LLPanelPeople::addTestParticipant, this)); + mCommitCallbackRegistrar.add("People.testFBCCheckin", boost::bind(&LLPanelPeople::onFacebookCheckinClicked, this)); mCommitCallbackRegistrar.add("People.AddFriend", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this)); mCommitCallbackRegistrar.add("People.AddFriendWizard", boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this)); @@ -1716,6 +1720,15 @@ void LLPanelPeople::onLoginFbcButtonClicked() } } +void LLPanelPeople::onFacebookCheckinClicked() +{ + // Get the local SLURL + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + + LLFacebookConnect::instance().postCheckinMessage("Here I am in SL!", slurl.getSLURLString()); +} + void LLPanelPeople::onFacebookAppRequestClicked() { } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index be780bec5e..f617517392 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -123,6 +123,7 @@ private: void onFacebookAppRequestClicked(); void onFacebookAppSendClicked(); void onFacebookTestAddClicked(); + void onFacebookCheckinClicked(); bool onFriendsViewSortMenuItemCheck(const LLSD& userdata); bool onRecentViewSortMenuItemCheck(const LLSD& userdata); diff --git a/indra/newview/skins/default/xui/en/menu_gear_fbc.xml b/indra/newview/skins/default/xui/en/menu_gear_fbc.xml index d73cee344b..2c341b6ecc 100644 --- a/indra/newview/skins/default/xui/en/menu_gear_fbc.xml +++ b/indra/newview/skins/default/xui/en/menu_gear_fbc.xml @@ -41,4 +41,11 @@ <menu_item_check.on_click function="People.testaddFBCFolderView"/> </menu_item_check> + <menu_item_check + label="Facebook post checkin message" + layout="topleft" + name="Facebook Checkin"> + <menu_item_check.on_click + function="People.testFBCCheckin"/> + </menu_item_check> </toggleable_menu>
\ No newline at end of file |