diff options
author | Eugene Sandulenko | 2016-07-22 15:38:24 +0300 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | d57fca4665e65bca1cf487fb109d020d1233e800 (patch) | |
tree | c5a8b0e88f4c55e0f2e2afb2f78a4cd1f89d66f3 /backends/cloud/box/boxstorage.cpp | |
parent | cccfe7c247fed9b00c100e64433439386d6ef077 (diff) | |
download | scummvm-rg350-d57fca4665e65bca1cf487fb109d020d1233e800.tar.gz scummvm-rg350-d57fca4665e65bca1cf487fb109d020d1233e800.tar.bz2 scummvm-rg350-d57fca4665e65bca1cf487fb109d020d1233e800.zip |
CLOUD: JANITORIAL: Fix code formatting
Diffstat (limited to 'backends/cloud/box/boxstorage.cpp')
-rw-r--r-- | backends/cloud/box/boxstorage.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp index cd61e042da..2b2be70e55 100644 --- a/backends/cloud/box/boxstorage.cpp +++ b/backends/cloud/box/boxstorage.cpp @@ -57,16 +57,17 @@ BoxStorage::BoxStorage(Common::String accessToken, Common::String refreshToken): BoxStorage::BoxStorage(Common::String code) { getAccessToken( - new Common::Callback<BoxStorage, BoolResponse>(this, &BoxStorage::codeFlowComplete), - new Common::Callback<BoxStorage, Networking::ErrorResponse>(this, &BoxStorage::codeFlowFailed), - code + new Common::Callback<BoxStorage, BoolResponse>(this, &BoxStorage::codeFlowComplete), + new Common::Callback<BoxStorage, Networking::ErrorResponse>(this, &BoxStorage::codeFlowFailed), + code ); } BoxStorage::~BoxStorage() {} void BoxStorage::getAccessToken(BoolCallback callback, Networking::ErrorCallback errorCallback, Common::String code) { - if (!KEY || !SECRET) loadKeyAndSecret(); + if (!KEY || !SECRET) + loadKeyAndSecret(); bool codeFlow = (code != ""); if (!codeFlow && _refreshToken == "") { @@ -76,7 +77,9 @@ void BoxStorage::getAccessToken(BoolCallback callback, Networking::ErrorCallback } Networking::JsonCallback innerCallback = new Common::CallbackBridge<BoxStorage, BoolResponse, Networking::JsonResponse>(this, &BoxStorage::tokenRefreshed, callback); - if (errorCallback == nullptr) errorCallback = getErrorPrintingCallback(); + if (errorCallback == nullptr) + errorCallback = getErrorPrintingCallback(); + Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, errorCallback, "https://api.box.com/oauth2/token"); if (codeFlow) { request->addPostField("grant_type=authorization_code"); @@ -109,12 +112,14 @@ void BoxStorage::tokenRefreshed(BoolCallback callback, Networking::JsonResponse if (!result.contains("access_token") || !result.contains("refresh_token")) { warning("Bad response, no token passed"); debug("%s", json->stringify().c_str()); - if (callback) (*callback)(BoolResponse(nullptr, false)); + if (callback) + (*callback)(BoolResponse(nullptr, false)); } else { _token = result.getVal("access_token")->asString(); _refreshToken = result.getVal("refresh_token")->asString(); CloudMan.save(); //ask CloudManager to save our new refreshToken - if (callback) (*callback)(BoolResponse(nullptr, true)); + if (callback) + (*callback)(BoolResponse(nullptr, true)); } delete json; } @@ -190,8 +195,10 @@ void BoxStorage::infoInnerCallback(StorageInfoCallback outerCallback, Networking } Networking::Request *BoxStorage::listDirectoryById(Common::String id, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback) { - if (!errorCallback) errorCallback = getErrorPrintingCallback(); - if (!callback) callback = getPrintFilesCallback(); + if (!errorCallback) + errorCallback = getErrorPrintingCallback(); + if (!callback) + callback = getPrintFilesCallback(); return addRequest(new BoxListDirectoryByIdRequest(this, id, callback, errorCallback)); } @@ -213,7 +220,8 @@ void BoxStorage::createDirectoryInnerCallback(BoolCallback outerCallback, Networ } Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) { - if (!errorCallback) errorCallback = getErrorPrintingCallback(); + if (!errorCallback) + errorCallback = getErrorPrintingCallback(); Common::String url = "https://api.box.com/2.0/folders"; Networking::JsonCallback innerCallback = new Common::CallbackBridge<BoxStorage, BoolResponse, Networking::JsonResponse>(this, &BoxStorage::createDirectoryInnerCallback, callback); @@ -235,13 +243,15 @@ Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String pare } Networking::Request *BoxStorage::upload(Common::String remotePath, Common::String localPath, UploadCallback callback, Networking::ErrorCallback errorCallback) { - if (!errorCallback) errorCallback = getErrorPrintingCallback(); + if (!errorCallback) + errorCallback = getErrorPrintingCallback(); return addRequest(new BoxUploadRequest(this, remotePath, localPath, callback, errorCallback)); } Networking::Request *BoxStorage::upload(Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) { warning("BoxStorage::upload(ReadStream) not implemented"); - if (errorCallback) (*errorCallback)(Networking::ErrorResponse(nullptr, false, true, "BoxStorage::upload(ReadStream) not implemented", -1)); + if (errorCallback) + (*errorCallback)(Networking::ErrorResponse(nullptr, false, true, "BoxStorage::upload(ReadStream) not implemented", -1)); delete callback; delete errorCallback; return nullptr; |