From c600be64cf8246cf9054bbb775fec21cf1ecdba9 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 25 Feb 2016 16:30:28 +0000 Subject: Dropbox: transfer refactiring git-svn-id: http://svn.miranda-ng.org/main/trunk@16339 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox_transfers.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'plugins/Dropbox/src/dropbox_transfers.cpp') diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index f97f6d2f01..ae4c50896b 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -96,26 +96,10 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) FileTransferParam *ftp = (FileTransferParam*)arg; try { - if (ftp->ptszFolders) { - for (int i = 0; ftp->ptszFolders[i]; i++) { - if (ftp->isTerminated) - throw DropboxException("Transfer was terminated"); - - char path[MAX_PATH]; - PreparePath(ftp->ptszFolders[i], path); - instance->CreateFolder(path); - if (!strchr(path, '\\')) { - char url[MAX_PATH]; - instance->CreateDownloadUrl(path, url); - ftp->AddUrl(url); - } - } - } - - ftp->First(); + ftp->FirstFile(); do { - const TCHAR *fileName = &ftp->GetCurrentFileName()[ftp->relativePathStart]; + const TCHAR *fileName = &ftp->GetCurrentFilePath()[ftp->relativePathStart]; uint64_t fileSize = ftp->GetCurrentFileSize(); int chunkSize = ftp->GetCurrentFileChunkSize(); @@ -154,7 +138,7 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) instance->CreateDownloadUrl(path, url); ftp->AddUrl(url); } - } while (ftp->Next()); + } while (ftp->NextFile()); } catch (DropboxException &ex) { Netlib_Logf(instance->hNetlibConnection, "%s: %s", MODULE, ex.what()); @@ -175,8 +159,8 @@ UINT CDropbox::SendFilesAndReportAsync(void *owner, void *arg) if (res == ACKRESULT_SUCCESS) { CMStringA urls; - for (int i = 0; i < ftp->urlList.getCount(); i++) - urls.AppendFormat("%s\r\n", ftp->urlList[i]); + for (int i = 0; i < ftp->urls.getCount(); i++) + urls.AppendFormat("%s\r\n", ftp->urls[i]); instance->Report(ftp->hContact, urls.GetBuffer()); } @@ -197,7 +181,7 @@ UINT CDropbox::SendFilesAndEventAsync(void *owner, void *arg) TRANSFERINFO ti = { 0 }; ti.hProcess = ftp->hProcess; ti.status = res; - ti.data = ftp->urlList.getArray(); + ti.data = ftp->urls.getArray(); NotifyEventHooks(instance->hFileSentEventHook, ftp->hContact, (LPARAM)&ti); -- cgit v1.2.3