aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/googledrive
diff options
context:
space:
mode:
Diffstat (limited to 'backends/cloud/googledrive')
-rw-r--r--backends/cloud/googledrive/googledrivestorage.cpp12
-rw-r--r--backends/cloud/googledrive/googledrivestorage.h6
-rw-r--r--backends/cloud/googledrive/googledrivetokenrefresher.cpp6
-rw-r--r--backends/cloud/googledrive/googledriveuploadrequest.cpp2
4 files changed, 10 insertions, 16 deletions
diff --git a/backends/cloud/googledrive/googledrivestorage.cpp b/backends/cloud/googledrive/googledrivestorage.cpp
index c4264099fd..77ac8989f1 100644
--- a/backends/cloud/googledrive/googledrivestorage.cpp
+++ b/backends/cloud/googledrive/googledrivestorage.cpp
@@ -229,10 +229,10 @@ Networking::Request *GoogleDriveStorage::streamFileById(Common::String id, Netwo
}
void GoogleDriveStorage::printInfo(StorageInfoResponse response) {
- debug("\nuser info:");
- debug("\tname: %s", response.value.name().c_str());
- debug("\temail: %s", response.value.email().c_str());
- debug("\tdisk usage: %llu/%llu", response.value.used(), response.value.available());
+ debug(9, "\nuser info:");
+ debug(9, "\tname: %s", response.value.name().c_str());
+ debug(9, "\temail: %s", response.value.email().c_str());
+ debug(9, "\tdisk usage: %llu/%llu", response.value.used(), response.value.available());
}
Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) {
@@ -273,12 +273,12 @@ GoogleDriveStorage *GoogleDriveStorage::loadFromConfig(Common::String keyPrefix)
if (!ConfMan.hasKey(keyPrefix + "access_token", ConfMan.kCloudDomain)) {
warning("No access_token found");
- return 0;
+ return nullptr;
}
if (!ConfMan.hasKey(keyPrefix + "refresh_token", ConfMan.kCloudDomain)) {
warning("No refresh_token found");
- return 0;
+ return nullptr;
}
Common::String accessToken = ConfMan.get(keyPrefix + "access_token", ConfMan.kCloudDomain);
diff --git a/backends/cloud/googledrive/googledrivestorage.h b/backends/cloud/googledrive/googledrivestorage.h
index eee4de90b0..4c164dd91d 100644
--- a/backends/cloud/googledrive/googledrivestorage.h
+++ b/backends/cloud/googledrive/googledrivestorage.h
@@ -24,7 +24,6 @@
#define BACKENDS_CLOUD_GOOGLEDRIVE_GOOGLEDRIVESTORAGE_H
#include "backends/cloud/id/idstorage.h"
-#include "common/callback.h"
#include "backends/networking/curl/curljsonrequest.h"
namespace Cloud {
@@ -87,9 +86,6 @@ public:
virtual Networking::Request *streamFileById(Common::String id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback);
/** Calls the callback when finished. */
- virtual Networking::Request *remove(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) { return nullptr; } //TODO
-
- /** Calls the callback when finished. */
virtual Networking::Request *createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback);
/** Returns the StorageInfo struct. */
@@ -113,7 +109,7 @@ public:
*/
void getAccessToken(BoolCallback callback, Networking::ErrorCallback errorCallback = nullptr, Common::String code = "");
- Common::String accessToken() { return _token; }
+ Common::String accessToken() const { return _token; }
};
} // End of namespace GoogleDrive
diff --git a/backends/cloud/googledrive/googledrivetokenrefresher.cpp b/backends/cloud/googledrive/googledrivetokenrefresher.cpp
index 3dfb8436e9..9e26e62149 100644
--- a/backends/cloud/googledrive/googledrivetokenrefresher.cpp
+++ b/backends/cloud/googledrive/googledrivetokenrefresher.cpp
@@ -67,7 +67,7 @@ void GoogleDriveTokenRefresher::finishJson(Common::JSONValue *json) {
if (result.contains("error")) {
//new token needed => request token & then retry original request
if (_stream) {
- debug("code %ld", _stream->httpResponseCode());
+ debug(9, "code %ld", _stream->httpResponseCode());
}
Common::JSONObject error = result.getVal("error")->asObject();
@@ -77,12 +77,12 @@ void GoogleDriveTokenRefresher::finishJson(Common::JSONValue *json) {
Common::String message;
if (error.contains("code") && error.getVal("code")->isIntegerNumber()) {
code = error.getVal("code")->asIntegerNumber();
- debug("code = %u", code);
+ debug(9, "code = %u", code);
}
if (error.contains("message")) {
message = error.getVal("message")->asString();
- debug("message = %s", message.c_str());
+ debug(9, "message = %s", message.c_str());
}
if (code == 401 || message == "Invalid Credentials")
diff --git a/backends/cloud/googledrive/googledriveuploadrequest.cpp b/backends/cloud/googledrive/googledriveuploadrequest.cpp
index dfff46c0d2..b63e989df8 100644
--- a/backends/cloud/googledrive/googledriveuploadrequest.cpp
+++ b/backends/cloud/googledrive/googledriveuploadrequest.cpp
@@ -28,7 +28,6 @@
#include "backends/networking/curl/curljsonrequest.h"
#include "backends/networking/curl/networkreadstream.h"
#include "common/json.h"
-#include "common/debug.h"
#include "googledrivetokenrefresher.h"
namespace Cloud {
@@ -201,7 +200,6 @@ void GoogleDriveUploadRequest::uploadNextPart() {
uint32 size = _contentsStream->read(buffer, UPLOAD_PER_ONE_REQUEST);
if (size != 0) request->setBuffer(buffer, size);
- //request->addHeader(Common::String::format("Content-Length: %u", size));
if (_uploadUrl != "") {
if (_contentsStream->pos() == 0)
request->addHeader(Common::String::format("Content-Length: 0"));