summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/cloud_service.h
blob: 705330e386df463d0fc6a54f6a4e564e5002ca12 (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
#ifndef _CLOUD_SERVICE_H_
#define _CLOUD_SERVICE_H_

class CCloudService
{
protected:
	int id;
	HNETLIBUSER hConnection;

	// utils
	char* PreparePath(const char *oldPath, char *newPath);
	char* PreparePath(const wchar_t *oldPath, char *newPath);

	virtual char* HttpStatusToError(int status = 0);
	virtual void HandleHttpError(NETLIBHTTPREQUEST *response);
	virtual void HandleJsonError(JSONNode &node) = 0;

	JSONNode GetJsonResponse(NETLIBHTTPREQUEST *response);

public:
	std::map<MCONTACT, HWND> InterceptedContacts;

	CCloudService(HNETLIBUSER hConnection);

	virtual const char* GetModule() const = 0;
	virtual const wchar_t* GetText() const = 0;
	virtual int GetIconId() const = 0;

	virtual bool IsLoggedIn() = 0;
	virtual void Login() = 0;
	virtual void Logout() = 0;

	virtual UINT Upload(FileTransferParam *ftp) = 0;

	void SendToContact(MCONTACT hContact, const wchar_t *data);
	void PasteToInputArea(MCONTACT hContact, const wchar_t *data);
	void PasteToClipboard(const wchar_t *data);

	void Report(MCONTACT hContact, const wchar_t *data);
};

#endif //_CLOUD_SERVICE_H_