summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/FMessage.h
blob: e53b7d88dde2db7a3dd4f7986780b35dd90d9255 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * FMessage.h
 *
 *  Created on: 02/07/2012
 *      Author: Antonio
 */



#ifndef FMESSAGE_H_
#define FMESSAGE_H_

#include <string>
//#include <SDL.h>
#include <time.h>
#include "IMutex.h"

struct Key
{
	std::string remote_jid;
	bool from_me;
	std::string id;

	Key(const std::string& remote_jid, bool from_me, const std::string& id);
	std::string toString();

};

struct FMessage
{
	Key key;
	unsigned char media_wa_type;
	std::string data;
	long long timestamp;
	std::string remote_resource;
	bool wants_receipt;
	unsigned char status;
	std::string notifyname;
	bool offline;
	std::string media_url;
	std::string media_name;
	long long media_size;
	int media_duration_seconds;
	double latitude;
	double longitude;

	enum {
		WA_TYPE_UNDEFINED = 0,
		WA_TYPE_IMAGE = 1,
		WA_TYPE_AUDIO = 2,
		WA_TYPE_VIDEO = 3,
		WA_TYPE_CONTACT = 4,
		WA_TYPE_LOCATION = 5,
		WA_TYPE_SYSTEM = 7
	};

	enum {
		STATUS_UNSENT = 0,
		STATUS_UPLOADING = 1,
		STATUS_UPLOADED = 2,
		STATUS_SENT_BY_CLIENT = 3,
		STATUS_RECEIVED_BY_SERVER = 4,
		STATUS_RECEIVED_BY_TARGET = 5,
		STATUS_NEVER_SEND = 6,
		STATUS_SERVER_BOUNCE = 7,

		STATUS_USER_ADDED = 191,
		STATUS_USER_REMOVED = 192,
		STATUS_SUBJECT_CHANGED = 193,
		STATUS_PICTURE_CHANGED_SET = 194,
		STATUS_PICTURE_CHANGED_DELETE = 195
	};

	static std::string getMessage_WA_Type_StrValue(unsigned char type);
	static unsigned char getMessage_WA_Type(const std::string &typeString);

	FMessage();
	FMessage(const std::string &remote_jid, bool from_me, const std::string &id);
	virtual ~FMessage();
};

#endif /* FMESSAGE_H_ */