diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2016-02-25 16:30:28 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2016-02-25 16:30:28 +0000 |
commit | c600be64cf8246cf9054bbb775fec21cf1ecdba9 (patch) | |
tree | 5e9106e44bf6115673d3e3fd21c669c343a7190a /plugins/Dropbox/src/dropbox_services.cpp | |
parent | b7ed1f2179ca045c16a007f1fabb1a44587d9426 (diff) |
Dropbox: transfer refactiring
git-svn-id: http://svn.miranda-ng.org/main/trunk@16339 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_services.cpp')
-rw-r--r-- | plugins/Dropbox/src/dropbox_services.cpp | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 81f77683ba..d679059c43 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -58,52 +58,11 @@ INT_PTR CDropbox::ProtoSendFile(WPARAM, LPARAM lParam) hTransferContact = 0;
TCHAR **paths = (TCHAR**)pccsd->lParam;
-
+ ftp->SetWorkingDirectory(paths[0]);
for (int i = 0; paths[i]; i++) {
if (PathIsDirectory(paths[i]))
- ftp->totalFolders++;
- else
- ftp->pfts.totalFiles++;
- }
-
- ftp->ptszFolders = (TCHAR**)mir_alloc(sizeof(TCHAR*) * (ftp->totalFolders + 1));
- ftp->ptszFolders[ftp->totalFolders] = NULL;
-
- ftp->pfts.ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*) * (ftp->pfts.totalFiles + 1));
- ftp->pfts.ptszFiles[ftp->pfts.totalFiles] = NULL;
-
- for (int i = 0, j = 0, k = 0; paths[i]; i++) {
- if (PathIsDirectory(paths[i])) {
- if (!ftp->relativePathStart) {
- TCHAR *rootFolder = paths[j];
- TCHAR *relativePath = _tcsrchr(rootFolder, '\\') + 1;
- ftp->relativePathStart = relativePath - rootFolder;
- }
-
- ftp->ptszFolders[j] = mir_tstrdup(&paths[i][ftp->relativePathStart]);
-
- j++;
- }
- else {
- if (!ftp->pfts.tszWorkingDir) {
- TCHAR *path = paths[j];
- int length = _tcsrchr(path, '\\') - path;
- ftp->pfts.tszWorkingDir = (TCHAR*)mir_alloc(sizeof(TCHAR) * (length + 1));
- mir_tstrncpy(ftp->pfts.tszWorkingDir, paths[j], length + 1);
- ftp->pfts.tszWorkingDir[length] = '\0';
-
- }
-
- ftp->pfts.ptszFiles[k] = mir_wstrdup(paths[i]);
-
- FILE *hFile = _wfopen(paths[i], L"rb");
- if (hFile != NULL) {
- _fseeki64(hFile, 0, SEEK_END);
- ftp->pfts.totalBytes += _ftelli64(hFile);
- fclose(hFile);
- }
- k++;
- }
+ continue;
+ ftp->AddFile(paths[i]);
}
ULONG fileId = InterlockedIncrement(&hFileProcess);
|