diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2016-02-25 15:49:58 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2016-02-25 15:49:58 +0000 |
commit | 048e1f421b84529aa2b29da09027ce997573afd7 (patch) | |
tree | 230bde579a4622d6def27b4961639d3377f9cca3 /plugins/Dropbox/src/dropbox_utils.cpp | |
parent | 8bf03133314064ec052873b01647c79b69a5b681 (diff) |
Dropbox: reworked files sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@16337 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_utils.cpp')
-rw-r--r-- | plugins/Dropbox/src/dropbox_utils.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp index fbc48ae395..c6f029be0d 100644 --- a/plugins/Dropbox/src/dropbox_utils.cpp +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -1,19 +1,17 @@ #include "stdafx.h"
-CMStringA CDropbox::PreparePath(const char *path)
+char* CDropbox::PreparePath(const char *oldPath, char *newPath)
{
CMStringA result("/");
- result.Append(path);
+ result.Append(oldPath);
result.Replace("\\", "/");
- return result;
+ mir_strcpy(newPath, result);
+ return newPath;
}
-CMStringA CDropbox::PreparePath(const TCHAR *path)
+char* CDropbox::PreparePath(const TCHAR *oldPath, char *newPath)
{
- CMStringA result("/");
- result.Append(ptrA(mir_utf8encodeW(path)));
- result.Replace("\\", "/");
- return result;
+ return PreparePath(ptrA(mir_utf8encodeW(oldPath)), newPath);
}
char* CDropbox::HttpStatusToText(HTTP_STATUS status)
@@ -49,13 +47,19 @@ void CDropbox::HandleJsonResponseError(NETLIBHTTPREQUEST *response) if (response == NULL)
throw DropboxException(HttpStatusToText(HTTP_STATUS_ERROR));
- JSONNode root = JSONNode::parse(response->pData);
- if (root.empty()) {
+ if (response->resultCode == HTTP_STATUS_OK)
+ return;
+
+ if (response->resultCode != HTTP_STATUS_CONFLICT) {
if (response->dataLength)
throw DropboxException(response->pData);
throw DropboxException(HttpStatusToText((HTTP_STATUS)response->resultCode));
}
+ JSONNode root = JSONNode::parse(response->pData);
+ if (root.empty())
+ throw DropboxException(HttpStatusToText(HTTP_STATUS_ERROR));
+
JSONNode error = root.at("error_summary");
if (error.empty())
return;
|