diff options
author | Alexander Tkachev | 2016-05-26 17:12:40 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | eda575a660543884b1a4addd21b676a67d2c2a31 (patch) | |
tree | 0964f46167ff44daefba64cf429ea69da5512aeb /backends/cloud/dropbox/dropboxstorage.cpp | |
parent | 17fc40a94436f970af75d6717c7a63c70eafcb12 (diff) | |
download | scummvm-rg350-eda575a660543884b1a4addd21b676a67d2c2a31.tar.gz scummvm-rg350-eda575a660543884b1a4addd21b676a67d2c2a31.tar.bz2 scummvm-rg350-eda575a660543884b1a4addd21b676a67d2c2a31.zip |
CLOUD: Add Requests id
(Upgrading ConnectionManager step by step.)
Diffstat (limited to 'backends/cloud/dropbox/dropboxstorage.cpp')
-rw-r--r-- | backends/cloud/dropbox/dropboxstorage.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp index e5041466e9..9acbfc0428 100644 --- a/backends/cloud/dropbox/dropboxstorage.cpp +++ b/backends/cloud/dropbox/dropboxstorage.cpp @@ -84,8 +84,8 @@ void DropboxStorage::printFiles(Common::Array<StorageFile> files) { debug("\t%s", files[i].name().c_str()); } -void DropboxStorage::listDirectory(Common::String path, FileArrayCallback outerCallback, bool recursive) { - ConnMan.addRequest(new DropboxListDirectoryRequest(_token, path, outerCallback, recursive)); +int32 DropboxStorage::listDirectory(Common::String path, FileArrayCallback outerCallback, bool recursive) { + return ConnMan.addRequest(new DropboxListDirectoryRequest(_token, path, outerCallback, recursive)); } Networking::NetworkReadStream *DropboxStorage::streamFile(Common::String path) { @@ -101,30 +101,30 @@ Networking::NetworkReadStream *DropboxStorage::streamFile(Common::String path) { return request->execute(); } -void DropboxStorage::download(Common::String remotePath, Common::String localPath, BoolCallback callback) { +int32 DropboxStorage::download(Common::String remotePath, Common::String localPath, BoolCallback callback) { Common::DumpFile *f = new Common::DumpFile(); if (!f->open(localPath, true)) { warning("DropboxStorage: unable to open file to download into"); if (callback) (*callback)(false); delete f; - return; + return -1; } - ConnMan.addRequest(new DownloadRequest(callback, streamFile(remotePath), f)); + return ConnMan.addRequest(new DownloadRequest(callback, streamFile(remotePath), f)); } -void DropboxStorage::syncSaves(BoolCallback callback) { +int32 DropboxStorage::syncSaves(BoolCallback callback) { //this is not the real syncSaves() implementation //"" is root in Dropbox, not "/" //this must create all these directories: - download("/remote/test.jpg", "local/a/b/c/d/test.jpg", 0); + return download("/remote/test.jpg", "local/a/b/c/d/test.jpg", 0); } -void DropboxStorage::info(StorageInfoCallback outerCallback) { +int32 DropboxStorage::info(StorageInfoCallback outerCallback) { Common::BaseCallback<> *innerCallback = new Common::CallbackBridge<DropboxStorage, StorageInfo>(this, &DropboxStorage::infoInnerCallback, outerCallback); Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(innerCallback, "https://api.dropboxapi.com/1/account/info"); request->addHeader("Authorization: Bearer " + _token); - ConnMan.addRequest(request); + return ConnMan.addRequest(request); //that callback bridge wraps the outerCallback (passed in arguments from user) into innerCallback //so, when CurlJsonRequest is finished, it calls the innerCallback //innerCallback (which is DropboxStorage::infoInnerCallback in this case) processes the void *ptr |