diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/cloud/box/boxstorage.cpp | 40 | ||||
-rw-r--r-- | backends/cloud/box/boxstorage.h | 2 | ||||
-rw-r--r-- | backends/cloud/googledrive/googledrivestorage.cpp | 32 | ||||
-rw-r--r-- | backends/cloud/googledrive/googledrivestorage.h | 2 | ||||
-rw-r--r-- | backends/cloud/onedrive/onedrivestorage.cpp | 22 | ||||
-rw-r--r-- | backends/cloud/storagefile.cpp | 8 | ||||
-rw-r--r-- | backends/cloud/storagefile.h | 2 |
7 files changed, 54 insertions, 54 deletions
diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp index 598ca55c15..fb01521016 100644 --- a/backends/cloud/box/boxstorage.cpp +++ b/backends/cloud/box/boxstorage.cpp @@ -67,8 +67,8 @@ void BoxStorage::loadKeyAndSecret() { #endif } -BoxStorage::BoxStorage(Common::String accessToken, Common::String refreshToken): - _token(accessToken), _refreshToken(refreshToken) {} +BoxStorage::BoxStorage(Common::String token, Common::String refreshToken): + _token(token), _refreshToken(refreshToken) {} BoxStorage::BoxStorage(Common::String code) { getAccessToken( @@ -191,36 +191,36 @@ void BoxStorage::infoInnerCallback(StorageInfoCallback outerCallback, Networking return; } - Common::JSONObject info = json->asObject(); + Common::JSONObject jsonInfo = json->asObject(); - Common::String uid, name, email; + Common::String uid, displayName, email; uint64 quotaUsed = 0, quotaAllocated = 0; // can check that "type": "user" // there is also "max_upload_size", "phone" and "avatar_url" - if (Networking::CurlJsonRequest::jsonContainsString(info, "id", "BoxStorage::infoInnerCallback")) - uid = info.getVal("id")->asString(); + if (Networking::CurlJsonRequest::jsonContainsString(jsonInfo, "id", "BoxStorage::infoInnerCallback")) + uid = jsonInfo.getVal("id")->asString(); - if (Networking::CurlJsonRequest::jsonContainsString(info, "name", "BoxStorage::infoInnerCallback")) - name = info.getVal("name")->asString(); + if (Networking::CurlJsonRequest::jsonContainsString(jsonInfo, "name", "BoxStorage::infoInnerCallback")) + displayName = jsonInfo.getVal("name")->asString(); - if (Networking::CurlJsonRequest::jsonContainsString(info, "login", "BoxStorage::infoInnerCallback")) - email = info.getVal("login")->asString(); + if (Networking::CurlJsonRequest::jsonContainsString(jsonInfo, "login", "BoxStorage::infoInnerCallback")) + email = jsonInfo.getVal("login")->asString(); - if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(info, "space_amount", "BoxStorage::infoInnerCallback")) - quotaAllocated = info.getVal("space_amount")->asIntegerNumber(); + if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(jsonInfo, "space_amount", "BoxStorage::infoInnerCallback")) + quotaAllocated = jsonInfo.getVal("space_amount")->asIntegerNumber(); - if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(info, "space_used", "BoxStorage::infoInnerCallback")) - quotaUsed = info.getVal("space_used")->asIntegerNumber(); + if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(jsonInfo, "space_used", "BoxStorage::infoInnerCallback")) + quotaUsed = jsonInfo.getVal("space_used")->asIntegerNumber(); Common::String username = email; - if (username == "") username = name; + if (username == "") username = displayName; if (username == "") username = uid; CloudMan.setStorageUsername(kStorageBoxId, username); if (outerCallback) { - (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, name, email, quotaUsed, quotaAllocated))); + (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, displayName, email, quotaUsed, quotaAllocated))); delete outerCallback; } @@ -245,8 +245,8 @@ void BoxStorage::createDirectoryInnerCallback(BoolCallback outerCallback, Networ if (outerCallback) { if (Networking::CurlJsonRequest::jsonIsObject(json, "BoxStorage::createDirectoryInnerCallback")) { - Common::JSONObject info = json->asObject(); - (*outerCallback)(BoolResponse(nullptr, info.contains("id"))); + Common::JSONObject jsonInfo = json->asObject(); + (*outerCallback)(BoolResponse(nullptr, jsonInfo.contains("id"))); } else { (*outerCallback)(BoolResponse(nullptr, false)); } @@ -256,7 +256,7 @@ void BoxStorage::createDirectoryInnerCallback(BoolCallback outerCallback, Networ delete json; } -Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) { +Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback) { if (!errorCallback) errorCallback = getErrorPrintingCallback(); @@ -270,7 +270,7 @@ Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String pare parentObject.setVal("id", new Common::JSONValue(parentId)); Common::JSONObject jsonRequestParameters; - jsonRequestParameters.setVal("name", new Common::JSONValue(name)); + jsonRequestParameters.setVal("name", new Common::JSONValue(directoryName)); jsonRequestParameters.setVal("parent", new Common::JSONValue(parentObject)); Common::JSONValue value(jsonRequestParameters); diff --git a/backends/cloud/box/boxstorage.h b/backends/cloud/box/boxstorage.h index 27bf60e39b..a641669b2a 100644 --- a/backends/cloud/box/boxstorage.h +++ b/backends/cloud/box/boxstorage.h @@ -74,7 +74,7 @@ public: /** Public Cloud API comes down there. */ virtual Networking::Request *listDirectoryById(Common::String id, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback); - virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback); + virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback); /** Returns UploadStatus struct with info about uploaded file. */ virtual Networking::Request *upload(Common::String remotePath, Common::String localPath, UploadCallback callback, Networking::ErrorCallback errorCallback); diff --git a/backends/cloud/googledrive/googledrivestorage.cpp b/backends/cloud/googledrive/googledrivestorage.cpp index ec4c84400c..c00d954966 100644 --- a/backends/cloud/googledrive/googledrivestorage.cpp +++ b/backends/cloud/googledrive/googledrivestorage.cpp @@ -68,8 +68,8 @@ void GoogleDriveStorage::loadKeyAndSecret() { #endif } -GoogleDriveStorage::GoogleDriveStorage(Common::String accessToken, Common::String refreshToken): - _token(accessToken), _refreshToken(refreshToken) {} +GoogleDriveStorage::GoogleDriveStorage(Common::String token, Common::String refreshToken): + _token(token), _refreshToken(refreshToken) {} GoogleDriveStorage::GoogleDriveStorage(Common::String code) { getAccessToken( @@ -192,28 +192,28 @@ void GoogleDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Ne return; } - Common::JSONObject info = json->asObject(); + Common::JSONObject jsonInfo = json->asObject(); - Common::String uid, name, email; + Common::String uid, displayName, email; uint64 quotaUsed = 0, quotaAllocated = 0; - if (Networking::CurlJsonRequest::jsonContainsAttribute(info, "user", "GoogleDriveStorage::infoInnerCallback") && - Networking::CurlJsonRequest::jsonIsObject(info.getVal("user"), "GoogleDriveStorage::infoInnerCallback")) { + if (Networking::CurlJsonRequest::jsonContainsAttribute(jsonInfo, "user", "GoogleDriveStorage::infoInnerCallback") && + Networking::CurlJsonRequest::jsonIsObject(jsonInfo.getVal("user"), "GoogleDriveStorage::infoInnerCallback")) { //"me":true, "kind":"drive#user","photoLink": "", //"displayName":"Alexander Tkachev","emailAddress":"alexander@tkachov.ru","permissionId":"" - Common::JSONObject user = info.getVal("user")->asObject(); + Common::JSONObject user = jsonInfo.getVal("user")->asObject(); if (Networking::CurlJsonRequest::jsonContainsString(user, "permissionId", "GoogleDriveStorage::infoInnerCallback")) uid = user.getVal("permissionId")->asString(); //not sure it's user's id, but who cares anyway? if (Networking::CurlJsonRequest::jsonContainsString(user, "displayName", "GoogleDriveStorage::infoInnerCallback")) - name = user.getVal("displayName")->asString(); + displayName = user.getVal("displayName")->asString(); if (Networking::CurlJsonRequest::jsonContainsString(user, "emailAddress", "GoogleDriveStorage::infoInnerCallback")) email = user.getVal("emailAddress")->asString(); } - if (Networking::CurlJsonRequest::jsonContainsAttribute(info, "storageQuota", "GoogleDriveStorage::infoInnerCallback") && - Networking::CurlJsonRequest::jsonIsObject(info.getVal("storageQuota"), "GoogleDriveStorage::infoInnerCallback")) { + if (Networking::CurlJsonRequest::jsonContainsAttribute(jsonInfo, "storageQuota", "GoogleDriveStorage::infoInnerCallback") && + Networking::CurlJsonRequest::jsonIsObject(jsonInfo.getVal("storageQuota"), "GoogleDriveStorage::infoInnerCallback")) { //"usageInDrive":"6332462","limit":"18253611008","usage":"6332462","usageInDriveTrash":"0" - Common::JSONObject storageQuota = info.getVal("storageQuota")->asObject(); + Common::JSONObject storageQuota = jsonInfo.getVal("storageQuota")->asObject(); if (Networking::CurlJsonRequest::jsonContainsString(storageQuota, "usage", "GoogleDriveStorage::infoInnerCallback")) { Common::String usage = storageQuota.getVal("usage")->asString(); @@ -229,7 +229,7 @@ void GoogleDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Ne CloudMan.setStorageUsername(kStorageGoogleDriveId, email); if (outerCallback) { - (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, name, email, quotaUsed, quotaAllocated))); + (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, displayName, email, quotaUsed, quotaAllocated))); delete outerCallback; } @@ -246,8 +246,8 @@ void GoogleDriveStorage::createDirectoryInnerCallback(BoolCallback outerCallback if (outerCallback) { if (Networking::CurlJsonRequest::jsonIsObject(json, "GoogleDriveStorage::createDirectoryInnerCallback")) { - Common::JSONObject info = json->asObject(); - (*outerCallback)(BoolResponse(nullptr, info.contains("id"))); + Common::JSONObject jsonInfo = json->asObject(); + (*outerCallback)(BoolResponse(nullptr, jsonInfo.contains("id"))); } else { (*outerCallback)(BoolResponse(nullptr, false)); } @@ -289,7 +289,7 @@ void GoogleDriveStorage::printInfo(StorageInfoResponse response) { debug(9, "\tdisk usage: %lu/%lu", response.value.used(), response.value.available()); } -Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) { +Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback) { if (!errorCallback) errorCallback = getErrorPrintingCallback(); @@ -304,7 +304,7 @@ Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::Str Common::JSONObject jsonRequestParameters; jsonRequestParameters.setVal("mimeType", new Common::JSONValue("application/vnd.google-apps.folder")); - jsonRequestParameters.setVal("name", new Common::JSONValue(name)); + jsonRequestParameters.setVal("name", new Common::JSONValue(directoryName)); jsonRequestParameters.setVal("parents", new Common::JSONValue(parentsArray)); Common::JSONValue value(jsonRequestParameters); diff --git a/backends/cloud/googledrive/googledrivestorage.h b/backends/cloud/googledrive/googledrivestorage.h index 457369dc90..d0585bc403 100644 --- a/backends/cloud/googledrive/googledrivestorage.h +++ b/backends/cloud/googledrive/googledrivestorage.h @@ -86,7 +86,7 @@ public: virtual Networking::Request *streamFileById(Common::String id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback); /** Calls the callback when finished. */ - virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback); + virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String directoryName, BoolCallback callback, Networking::ErrorCallback errorCallback); /** Returns the StorageInfo struct. */ virtual Networking::Request *info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback); diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index 8799f3d69f..14e803d980 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -67,8 +67,8 @@ void OneDriveStorage::loadKeyAndSecret() { #endif } -OneDriveStorage::OneDriveStorage(Common::String accessToken, Common::String userId, Common::String refreshToken): - _token(accessToken), _uid(userId), _refreshToken(refreshToken) {} +OneDriveStorage::OneDriveStorage(Common::String token, Common::String uid, Common::String refreshToken): + _token(token), _uid(uid), _refreshToken(refreshToken) {} OneDriveStorage::OneDriveStorage(Common::String code) { getAccessToken( @@ -193,35 +193,35 @@ void OneDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Netwo return; } - Common::JSONObject info = json->asObject(); + Common::JSONObject jsonInfo = json->asObject(); - Common::String uid, name, email; + Common::String uid, displayName, email; uint64 quotaUsed = 0, quotaAllocated = 26843545600LL; // 25 GB, because I actually don't know any way to find out the real one - if (Networking::CurlJsonRequest::jsonContainsObject(info, "createdBy", "OneDriveStorage::infoInnerCallback")) { - Common::JSONObject createdBy = info.getVal("createdBy")->asObject(); + if (Networking::CurlJsonRequest::jsonContainsObject(jsonInfo, "createdBy", "OneDriveStorage::infoInnerCallback")) { + Common::JSONObject createdBy = jsonInfo.getVal("createdBy")->asObject(); if (Networking::CurlJsonRequest::jsonContainsObject(createdBy, "user", "OneDriveStorage::infoInnerCallback")) { Common::JSONObject user = createdBy.getVal("user")->asObject(); if (Networking::CurlJsonRequest::jsonContainsString(user, "id", "OneDriveStorage::infoInnerCallback")) uid = user.getVal("id")->asString(); if (Networking::CurlJsonRequest::jsonContainsString(user, "displayName", "OneDriveStorage::infoInnerCallback")) - name = user.getVal("displayName")->asString(); + displayName = user.getVal("displayName")->asString(); } } - if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(info, "size", "OneDriveStorage::infoInnerCallback")) { - quotaUsed = info.getVal("size")->asIntegerNumber(); + if (Networking::CurlJsonRequest::jsonContainsIntegerNumber(jsonInfo, "size", "OneDriveStorage::infoInnerCallback")) { + quotaUsed = jsonInfo.getVal("size")->asIntegerNumber(); } Common::String username = email; if (username == "") - username = name; + username = displayName; if (username == "") username = uid; CloudMan.setStorageUsername(kStorageOneDriveId, username); if (outerCallback) { - (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, name, email, quotaUsed, quotaAllocated))); + (*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, displayName, email, quotaUsed, quotaAllocated))); delete outerCallback; } diff --git a/backends/cloud/storagefile.cpp b/backends/cloud/storagefile.cpp index 2428d8ff80..90ec7da120 100644 --- a/backends/cloud/storagefile.cpp +++ b/backends/cloud/storagefile.cpp @@ -56,10 +56,10 @@ StorageFile::StorageFile(Common::String pth, uint32 sz, uint32 ts, bool dir) { _isDirectory = dir; } -StorageFile::StorageFile(Common::String id, Common::String path, Common::String name, uint32 sz, uint32 ts, bool dir) { - _id = id; - _path = path; - _name = name; +StorageFile::StorageFile(Common::String fileId, Common::String filePath, Common::String fileName, uint32 sz, uint32 ts, bool dir) { + _id = fileId; + _path = filePath; + _name = fileName; _size = sz; _timestamp = ts; _isDirectory = dir; diff --git a/backends/cloud/storagefile.h b/backends/cloud/storagefile.h index 44f16c3689..c29ac77dd1 100644 --- a/backends/cloud/storagefile.h +++ b/backends/cloud/storagefile.h @@ -48,7 +48,7 @@ class StorageFile { public: StorageFile(); //invalid empty file StorageFile(Common::String pth, uint32 sz, uint32 ts, bool dir); - StorageFile(Common::String id, Common::String path, Common::String name, uint32 sz, uint32 ts, bool dir); + StorageFile(Common::String fileId, Common::String filePath, Common::String fileName, uint32 sz, uint32 ts, bool dir); Common::String id() const { return _id; } Common::String path() const { return _path; } |