summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/dropbox_transfers.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-12-22 17:13:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-12-22 17:13:27 +0000
commit020323a39b43152782541fd3897e3d2f6c72cfd1 (patch)
treeb62f0effdf2f6dc2e992e1441f7d6f3dd46b2dff /plugins/Dropbox/src/dropbox_transfers.cpp
parent8508d083487e03f6dd0371ab2c67ec0168c7b746 (diff)
Dropbox:
- contact menu to verify PF1_IMSEND flag to disable it for protocols that don't support sending IMs; - code cleaning; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15930 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_transfers.cpp')
-rw-r--r--plugins/Dropbox/src/dropbox_transfers.cpp39
1 files changed, 14 insertions, 25 deletions
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp
index e1fe957b05..09fec2daf8 100644
--- a/plugins/Dropbox/src/dropbox_transfers.cpp
+++ b/plugins/Dropbox/src/dropbox_transfers.cpp
@@ -35,7 +35,7 @@ void CDropbox::SendFileChunkedNext(const char *data, size_t size, const char *up
NLHR_PTR response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
-
+
JSONNode root = JSONNode::parse(response->pData);
if (root.empty())
return;
@@ -76,7 +76,7 @@ void CDropbox::CreateDownloadUrl(const char *path, char *url)
JSONNode root = JSONNode::parse(response->pData);
if (root.empty())
return;
-
+
JSONNode node = root.at("url");
mir_strcpy(url, node.as_string().c_str());
}
@@ -88,20 +88,16 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ftp->hProcess, 0);
- try
- {
- if (ftp->ptszFolders)
- {
- for (int i = 0; ftp->ptszFolders[i]; i++)
- {
- if(ftp->isTerminated)
+ try {
+ if (ftp->ptszFolders) {
+ for (int i = 0; ftp->ptszFolders[i]; i++) {
+ if (ftp->isTerminated)
throw TransferException("Transfer was terminated");
ptrA utf8_folderName(mir_utf8encodeW(ftp->ptszFolders[i]));
instance->CreateFolder(utf8_folderName);
- if (!strchr(utf8_folderName, '\\'))
- {
+ if (!strchr(utf8_folderName, '\\')) {
char url[MAX_PATH];
instance->CreateDownloadUrl(utf8_folderName, url);
ftp->AddUrl(url);
@@ -109,8 +105,7 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
}
}
- for (int i = 0; ftp->pfts.ptszFiles[i]; i++)
- {
+ for (int i = 0; ftp->pfts.ptszFiles[i]; i++) {
if (ftp->isTerminated)
throw TransferException("Transfer was terminated");
@@ -142,10 +137,8 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
chunkSize = DROPBOX_FILE_CHUNK_SIZE;
char *data = (char*)mir_alloc(chunkSize);
- while (!feof(hFile) && fileSize != offset)
- {
- try
- {
+ while (!feof(hFile) && fileSize != offset) {
+ try {
if (ferror(hFile))
throw TransferException("Error while file sending");
@@ -162,8 +155,7 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
ftp->pfts.currentFileProgress += size;
ftp->pfts.totalProgress += size;
}
- catch (TransferException&)
- {
+ catch (TransferException&) {
mir_free(data);
fclose(hFile);
throw;
@@ -181,8 +173,7 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
instance->SendFileChunkedLast(utf8_fileName, uploadId);
- if (!_tcschr(fileName, L'\\'))
- {
+ if (!_tcschr(fileName, L'\\')) {
char url[MAX_PATH];
instance->CreateDownloadUrl(utf8_fileName, url);
ftp->AddUrl(url);
@@ -194,8 +185,7 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ftp->hProcess, 0);
}
}
- catch (TransferException &ex)
- {
+ catch (TransferException &ex) {
Netlib_Logf(instance->hNetlibConnection, "%s: %s", MODULE, ex.what());
ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ftp->hProcess, 0);
return ACKRESULT_FAILED;
@@ -214,8 +204,7 @@ UINT CDropbox::SendFilesAndReportAsync(void *owner, void *arg)
FileTransferParam *ftp = (FileTransferParam*)arg;
int res = SendFilesAsync(owner, arg);
- if (res)
- {
+ if (res) {
instance->transfers.remove(ftp);
delete ftp;
return res;