From b4e9e35e07538a118588742aff6fd4a7a2b4d600 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Thu, 14 Jul 2016 09:19:12 +0600 Subject: CLOUD: Cleanup in Storages --- backends/cloud/onedrive/onedrivestorage.cpp | 65 ----------------------------- backends/cloud/onedrive/onedrivestorage.h | 20 --------- 2 files changed, 85 deletions(-) (limited to 'backends/cloud/onedrive') diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp index 0d2f91c3a8..3c8ea5fe81 100644 --- a/backends/cloud/onedrive/onedrivestorage.cpp +++ b/backends/cloud/onedrive/onedrivestorage.cpp @@ -174,17 +174,6 @@ void OneDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Netwo delete json; } -void OneDriveStorage::printJson(Networking::JsonResponse response) { - Common::JSONValue *json = response.value; - if (!json) { - warning("printJson: NULL"); - return; - } - - debug("%s", json->stringify().c_str()); - delete json; -} - void OneDriveStorage::fileInfoCallback(Networking::NetworkReadStreamCallback outerCallback, Networking::JsonResponse response) { if (!response.value) { warning("fileInfoCallback: NULL"); @@ -224,29 +213,6 @@ Networking::Request *OneDriveStorage::streamFileById(Common::String path, Networ return addRequest(request); } -void OneDriveStorage::fileDownloaded(BoolResponse response) { - if (response.value) debug("file downloaded!"); - else debug("download failed!"); -} - -void OneDriveStorage::printFiles(FileArrayResponse response) { - debug("files:"); - Common::Array &files = response.value; - for (uint32 i = 0; i < files.size(); ++i) - debug("\t%s", files[i].path().c_str()); -} - -void OneDriveStorage::printBool(BoolResponse response) { - debug("bool: %s", response.value ? "true" : "false"); -} - -void OneDriveStorage::printFile(UploadResponse response) { - debug("\nuploaded file info:"); - debug("\tpath: %s", response.value.path().c_str()); - debug("\tsize: %u", response.value.size()); - debug("\ttimestamp: %u", response.value.timestamp()); -} - Networking::Request *OneDriveStorage::createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) { if (!errorCallback) errorCallback = getErrorPrintingCallback(); return addRequest(new OneDriveCreateDirectoryRequest(this, path, callback, errorCallback)); @@ -285,36 +251,5 @@ OneDriveStorage *OneDriveStorage::loadFromConfig(Common::String keyPrefix) { return new OneDriveStorage(accessToken, userId, refreshToken); } -Common::String OneDriveStorage::getAuthLink() { - Common::String url = "https://login.live.com/oauth20_authorize.srf"; - url += "?response_type=code"; - url += "&redirect_uri=http://localhost:12345/"; //that's for copy-pasting - //url += "&redirect_uri=http%3A%2F%2Flocalhost%3A12345%2F"; //that's "http://localhost:12345/" for automatic opening - url += "&client_id="; url += KEY; - url += "&scope=onedrive.appfolder%20offline_access"; //TODO - return url; -} - -void OneDriveStorage::authThroughConsole() { - if (!ConfMan.hasKey("ONEDRIVE_KEY", ConfMan.kCloudDomain) || !ConfMan.hasKey("ONEDRIVE_SECRET", ConfMan.kCloudDomain)) { - warning("No OneDrive keys available, cannot do auth"); - return; - } - - loadKeyAndSecret(); - - if (ConfMan.hasKey("onedrive_code", ConfMan.kCloudDomain)) { - //phase 2: get access_token using specified code - new OneDriveStorage(ConfMan.get("onedrive_code", ConfMan.kCloudDomain)); - return; - } - - debug("Navigate to this URL and press \"Allow\":"); - debug("%s\n", getAuthLink().c_str()); - debug("Then, add onedrive_code key in [cloud] section of configuration file. You should copy the value from URL and put it as value for that key.\n"); - debug("Navigate to this URL to get more information on ScummVM's configuration files:"); - debug("http://wiki.scummvm.org/index.php/User_Manual/Configuring_ScummVM#Using_the_configuration_file_to_configure_ScummVM\n"); -} - } // End of namespace OneDrive } // End of namespace Cloud diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h index 061d0fa172..650c240aef 100644 --- a/backends/cloud/onedrive/onedrivestorage.h +++ b/backends/cloud/onedrive/onedrivestorage.h @@ -24,7 +24,6 @@ #define BACKENDS_CLOUD_ONEDRIVE_ONEDRIVESTORAGE_H #include "backends/cloud/storage.h" -#include "common/callback.h" #include "backends/networking/curl/curljsonrequest.h" namespace Cloud { @@ -46,12 +45,6 @@ class OneDriveStorage: public Cloud::Storage { /** Constructs StorageInfo based on JSON response from cloud. */ void infoInnerCallback(StorageInfoCallback outerCallback, Networking::JsonResponse json); - void printJson(Networking::JsonResponse response); - void fileDownloaded(BoolResponse response); - void printFiles(FileArrayResponse response); - void printBool(BoolResponse response); - void printFile(UploadResponse response); - void fileInfoCallback(Networking::NetworkReadStreamCallback outerCallback, Networking::JsonResponse response); public: /** This constructor uses OAuth code flow to get tokens. */ @@ -88,9 +81,6 @@ public: /** Returns pointer to Networking::NetworkReadStream. */ virtual Networking::Request *streamFileById(Common::String path, 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 *createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback); @@ -106,16 +96,6 @@ public: */ static OneDriveStorage *loadFromConfig(Common::String keyPrefix); - /** - * Returns OneDrive auth link. - */ - static Common::String getAuthLink(); - - /** - * Show message with OneDrive auth instructions. (Temporary) - */ - static void authThroughConsole(); - /** * Gets new access_token. If passed is "", refresh_token is used. * Use "" in order to refresh token and pass a callback, so you could -- cgit v1.2.3