made it optional to autoconnect in LLFacebookConnect::getConnectionToFacebook() for ACME-648
parent
fc05dc5114
commit
0e50cbc2ed
|
|
@ -201,9 +201,9 @@ class LLFacebookConnectedResponder : public LLHTTPClient::Responder
|
|||
LOG_CLASS(LLFacebookConnectedResponder);
|
||||
public:
|
||||
|
||||
LLFacebookConnectedResponder()
|
||||
LLFacebookConnectedResponder(bool auto_connect) : mAutoConnect(auto_connect)
|
||||
{
|
||||
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS);
|
||||
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS);
|
||||
}
|
||||
|
||||
virtual void completed(U32 status, const std::string& reason, const LLSD& content)
|
||||
|
|
@ -223,7 +223,14 @@ public:
|
|||
// show the facebook login page if not connected yet
|
||||
if (status == 404)
|
||||
{
|
||||
LLFacebookConnect::instance().connectToFacebook();
|
||||
if (mAutoConnect)
|
||||
{
|
||||
LLFacebookConnect::instance().connectToFacebook();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -234,6 +241,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
bool mAutoConnect;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -304,13 +312,13 @@ void LLFacebookConnect::disconnectFromFacebook()
|
|||
LLHTTPClient::del(getFacebookConnectURL("/connection"), new LLFacebookDisconnectResponder());
|
||||
}
|
||||
|
||||
void LLFacebookConnect::getConnectionToFacebook()
|
||||
void LLFacebookConnect::getConnectionToFacebook(bool auto_connect)
|
||||
{
|
||||
if ((mConnectionState == FB_NOT_CONNECTED) || (mConnectionState == FB_CONNECTION_FAILED))
|
||||
{
|
||||
const bool follow_redirects=false;
|
||||
const F32 timeout=HTTP_REQUEST_EXPIRY_SECS;
|
||||
LLHTTPClient::get(getFacebookConnectURL("/connection"), new LLFacebookConnectedResponder(),
|
||||
LLHTTPClient::get(getFacebookConnectURL("/connection"), new LLFacebookConnectedResponder(auto_connect),
|
||||
LLSD(), timeout, follow_redirects);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
void connectToFacebook(const std::string& auth_code = ""); // Initiate the complete FB connection. Please use getConnectionToFacebook() in normal use.
|
||||
void disconnectFromFacebook(); // Disconnect from the FBC service.
|
||||
void getConnectionToFacebook(); // Check if an access token is available on the FBC service. If not, call connectToFacebook().
|
||||
void getConnectionToFacebook(bool auto_connect = false); // Check if an access token is available on the FBC service. If not, call connectToFacebook().
|
||||
|
||||
void loadFacebookFriends();
|
||||
void postCheckin(const std::string& location, const std::string& name, const std::string& description, const std::string& picture, const std::string& message);
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ void LLFloaterSocial::onCancel()
|
|||
BOOL LLFloaterSocial::postBuild()
|
||||
{
|
||||
// Initiate a connection to Facebook (getConnectionToFacebook() handles the already connected state)
|
||||
LLFacebookConnect::instance().getConnectionToFacebook();
|
||||
LLFacebookConnect::instance().getConnectionToFacebook(true);
|
||||
// Keep tab of the Photo Panel
|
||||
mSocialPhotoPanel = static_cast<LLSocialPhotoPanel*>(getChild<LLUICtrl>("panel_social_photo"));
|
||||
return LLFloater::postBuild();
|
||||
|
|
|
|||
|
|
@ -1683,7 +1683,7 @@ void LLPanelPeople::onLoginFbcButtonClicked()
|
|||
}
|
||||
else
|
||||
{
|
||||
LLFacebookConnect::instance().getConnectionToFacebook();
|
||||
LLFacebookConnect::instance().getConnectionToFacebook(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void LLPanelSnapshotFacebook::onOpen(const LLSD& key)
|
|||
{
|
||||
if (!LLFacebookConnect::instance().isConnected())
|
||||
{
|
||||
LLFacebookConnect::instance().getConnectionToFacebook();
|
||||
LLFacebookConnect::instance().getConnectionToFacebook(true);
|
||||
}
|
||||
updateControls(key);
|
||||
LLPanelSnapshot::onOpen(key);
|
||||
|
|
|
|||
|
|
@ -5957,7 +5957,7 @@ void handle_facebook_connect()
|
|||
{
|
||||
if (!LLFacebookConnect::instance().isConnected())
|
||||
{
|
||||
LLFacebookConnect::instance().getConnectionToFacebook();
|
||||
LLFacebookConnect::instance().getConnectionToFacebook(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue