aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/onedrive/onedrivestorage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/cloud/onedrive/onedrivestorage.cpp')
-rw-r--r--backends/cloud/onedrive/onedrivestorage.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp
index 82681756c4..178d43c8be 100644
--- a/backends/cloud/onedrive/onedrivestorage.cpp
+++ b/backends/cloud/onedrive/onedrivestorage.cpp
@@ -139,28 +139,31 @@ void OneDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Netwo
delete outerCallback;
return;
}
-
- if (outerCallback) {
- Common::JSONObject info = json->asObject();
-
- Common::String uid, name, email;
- uint64 quotaUsed = 0, quotaAllocated = 26843545600L; // 25 GB, because I actually don't know any way to find out the real one
-
- if (info.contains("createdBy") && info.getVal("createdBy")->isObject()) {
- Common::JSONObject createdBy = info.getVal("createdBy")->asObject();
- if (createdBy.contains("user") && createdBy.getVal("user")->isObject()) {
- Common::JSONObject user = createdBy.getVal("user")->asObject();
- uid = user.getVal("id")->asString();
- name = user.getVal("displayName")->asString();
- }
+
+ Common::JSONObject info = json->asObject();
+
+ Common::String uid, name, email;
+ uint64 quotaUsed = 0, quotaAllocated = 26843545600L; // 25 GB, because I actually don't know any way to find out the real one
+
+ if (info.contains("createdBy") && info.getVal("createdBy")->isObject()) {
+ Common::JSONObject createdBy = info.getVal("createdBy")->asObject();
+ if (createdBy.contains("user") && createdBy.getVal("user")->isObject()) {
+ Common::JSONObject user = createdBy.getVal("user")->asObject();
+ uid = user.getVal("id")->asString();
+ name = user.getVal("displayName")->asString();
}
+ }
- if (info.contains("size") && info.getVal("size")->isIntegerNumber()) {
- quotaUsed = info.getVal("size")->asIntegerNumber();
- }
+ if (info.contains("size") && info.getVal("size")->isIntegerNumber()) {
+ quotaUsed = info.getVal("size")->asIntegerNumber();
+ }
+
+ Common::String username = email;
+ if (username == "") username = name;
+ if (username == "") username = uid;
+ CloudMan.setStorageUsername(kStorageOneDriveId, username);
- CloudMan.setStorageUsedSpace(kStorageOneDriveId, quotaUsed); //TODO that's not ScummVM's actually
- CloudMan.setStorageUsername(kStorageOneDriveId, email);
+ if (outerCallback) {
(*outerCallback)(StorageInfoResponse(nullptr, StorageInfo(uid, name, email, quotaUsed, quotaAllocated)));
delete outerCallback;
}