diff options
-rw-r--r-- | indra/newview/llfacebookconnect.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llfacebookconnect.h | 1 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.cpp | 23 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.h | 4 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/menu_viewer.xml | 6 |
5 files changed, 51 insertions, 1 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 5013a5cb40..668ba04406 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -275,6 +275,24 @@ void LLFacebookConnect::loadFacebookFriends() LLSD(), timeout, follow_redirects); } +void LLFacebookConnect::postCheckin(const std::string& location, const std::string& name, const std::string& description, const std::string& image, const std::string& message) +{ + LLSD body; + if (!location.empty()) + 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; + + // Note: we can use that route for different publish action. We should be able to use the same responder. + LLHTTPClient::post(getFacebookConnectURL("/share/checkin"), body, new LLFacebookPostResponder()); +} + void LLFacebookConnect::postCheckinMessage(const std::string& message, const std::string& link, const std::string& name, const std::string& caption, const std::string& description, const std::string& picture) { LLSD body; diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h index faa60b0f34..2dba182267 100644 --- a/indra/newview/llfacebookconnect.h +++ b/indra/newview/llfacebookconnect.h @@ -46,6 +46,7 @@ public: void getConnectionToFacebook(); 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 postCheckinMessage(const std::string& message, const std::string& link, const std::string& name, const std::string& caption, const std::string& description, const std::string& picture); void sharePhoto(const std::string& image_url, const std::string& caption); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index bb9ad8c606..eb100a3f9b 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -45,6 +45,7 @@ #include "llagent.h" #include "llagentaccess.h" #include "llagentcamera.h" +#include "llagentui.h" #include "llagentwearables.h" #include "llagentpilot.h" #include "llcompilequeue.h" @@ -5983,6 +5984,26 @@ void handle_facebook_connect() } } +void handle_facebook_checkin() +{ + + // Get the location SLURL + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + std::string slurl_string = slurl.getSLURLString(); + + //Get the location name + LLViewerParcelMgr * parcel = LLViewerParcelMgr::getInstance(); + std::string parcel_string = parcel->getAgentParcelName(); + + //Get the location description + LLVector3 agent_pos = gAgent.getPositionAgent(); + std::string description; + LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_FULL, agent_pos); + + LLFacebookConnect::instance().postCheckin(slurl_string, parcel_string, description, "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQDL4jdC_vCh0ow-QCXZjN-WNojEXWiz0APEa6Qhpl8cxawjkoC7w", ""); +} + //bool is_facebook_connected(); @@ -8738,4 +8759,6 @@ void initialize_menus() // Facebook Connect commit.add("Facebook.Connect", boost::bind(&handle_facebook_connect)); + // Facebook Checkin + commit.add("Facebook.Checkin", boost::bind(&handle_facebook_checkin)); } diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index b916d95b7a..9c3f13f843 100755 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -137,7 +137,9 @@ bool handle_go_to(); // Facebook Connect void handle_facebook_connect(); -//bool is_facebook_connected(); + +//Facebook Checkin +void handle_facebook_checkin(); // Export to XML or Collada void handle_export_selected( void * ); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index b34816fb14..5061842c7f 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -21,6 +21,12 @@ <menu_item_call.on_click function="Facebook.Connect" /> </menu_item_call> + <menu_item_call + label="Check in to Facebook" + name="CheckinToFacebook"> + <menu_item_call.on_click + function="Facebook.Checkin" /> + </menu_item_call> <menu_item_separator/> <menu_item_call label="Appearance..." |