summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI/m_cloudfile.h
blob: 505f9e3462b8262b6cbecbd5a41788fd02c7d52c (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
#ifndef M_CLOUDFILE_H_
#define M_CLOUDFILE_H_

struct CFSERVICEINFO
{
	const char *accountName;
	const wchar_t *userName;
};

// get cloud file service info by account name
// wParam = (WPARAM)(const char*)accountName (can be NULL)
// lParam = (LPARAM)(CFSERVICEINFO*)serviceInfo (can be NULL)
// returns 0 on success, nonzero on failure
#define MS_CLOUDFILE_GETSERVICE "CloudFile/GetService"

// return nonzero to stop enum
typedef int(*enumCFServiceFunc)(const CFSERVICEINFO *serviceInfo, void *param);

// get list of cloud file services
// wParam = (WPARAM)(enumCFServiceFunc)enumFunc
// lParam = (LPARAM)(void*)param (can be NULL)
// returns 0 on success, nonzero on failure
#define MS_CLOUDFILE_ENUMSERVICES "CloudFile/EnumServices"

struct CFUPLOADDATA
{
	const char *accountName; // cloud service to upload (can be NULL)
	const wchar_t *localPath; // local path
	const wchar_t *serverFolder; // server folder in witch file will be placed (can be NULL)
};

struct CFUPLOADRESULT
{
	char **links; // need to be freed manually or by calling cfur_free
	size_t linkCount;
	wchar_t *description; // need to be freed manually or by calling cfur_free
};

// frees allocated fields of CFUPLOADRESULT
__inline void cfur_free(CFUPLOADRESULT *ur)
{
	for (size_t i = 0; i < ur->linkCount; i++)
		mir_free(ur->links[0]);
	mir_free(ur->links);
	mir_free(ur->description);
}

// upload file on cloud service
// wParam = (WPARAM)(const CFUPLOADDATA*)uploadData
// lParam = (LPARAM)(char CFUPLOADRESULT*)uploadResult (can be NULL)
// returns 0 on success, nonzero on failure
#define MS_CLOUDFILE_UPLOAD "CloudFile/Upload"

#endif //M_CLOUDFILE_H_