summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/file_transfer.h
blob: 1c0a511e471e56b038e6e41d9094b80e9cf3deb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef _FILE_TRANSFER_H_
#define _FILE_TRANSFER_H_

#include "common.h"

struct FileTransfer
{
	HANDLE hProcess;
	MCONTACT hContact;
	PROTOFILETRANSFERSTATUS pfts;

	int totalFolders;
	char **pszFolders;
	int relativePathStart;

	FileTransfer()
	{
		totalFolders = 0;
		pszFolders = NULL;
		relativePathStart = 0;

		pfts.cbSize = sizeof(this->pfts);
		pfts.flags = PFTS_UTF;
		pfts.currentFileNumber = 0;
		pfts.currentFileProgress = 0;
		pfts.currentFileSize = 0;
		pfts.totalBytes = 0;
		pfts.totalFiles = 0;
		pfts.totalProgress = 0;
		pfts.pszFiles = NULL;
		pfts.tszWorkingDir = NULL;
		pfts.wszCurrentFile = NULL;
	}

	~FileTransfer()
	{
		if (pfts.pszFiles)
		{
			for (int i = 0; pfts.pszFiles[i]; i++)
			{
				if (pfts.pszFiles[i]) mir_free(pfts.pszFiles[i]);
			}
			delete pfts.pszFiles;
		}

		if (pszFolders)
		{
			for (int i = 0; pszFolders[i]; i++)
			{
				if (pszFolders[i]) mir_free(pszFolders[i]);
			}
			delete pszFolders;
		}
	}
};

#endif //_FILE_TRANSFER_H_