CLOUD: Add DropboxStorage::listDirectory sketch

It doesn't support any "has_more", doesn't call user's callback and just
prints JSON instead of parsing in into an array of files.

I believe it would become DropboxListDirectoryRequest in the next
commit.
This commit is contained in:
Alexander Tkachev 2016-05-23 12:21:45 +06:00
parent a439bd4c33
commit 735db74b90
4 changed files with 36 additions and 8 deletions

View file

@ -70,10 +70,12 @@ bool CurlJsonRequest::handle() {
if (_stream->eos()) {
if (_stream->httpResponseCode() != 200)
warning("HTTP response code is not 200 OK");
warning("HTTP response code is not 200 OK (it's %d)", _stream->httpResponseCode());
if (_callback) {
char *contents = getPreparedContents();
char *contents = getPreparedContents();
if (_stream->httpResponseCode() != 200)
debug("%s", contents);
Common::JSONValue *json = Common::JSON::parse(contents);
(*_callback)(json); //potential memory leak, free it in your callbacks!
}