summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/entities.h
blob: b9971370430b013263d97e4100f658463f3115ab (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/*

Facebook plugin for Miranda Instant Messenger
_____________________________________________

Copyright � 2009-11 Michal Zelinka, 2011-16 Robert P�sel

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

#pragma once

struct facebook_user
{
	MCONTACT handle;

	std::string user_id;
	std::string real_name;
	std::string nick;
	std::string username;

	unsigned int status_id;
	unsigned int gender;
	time_t last_active;

	std::string image_url;

	bool deleted;
	bool idle;

	bool updated;

	ClientType client;
	ContactType type;

	facebook_user()
	{
		this->handle = NULL;
		this->status_id = ID_STATUS_OFFLINE;
		this->gender = this->last_active = 0;
		this->deleted = this->idle = this->updated = false;
		this->client = CLIENT_WEB;
		this->type = CONTACT_NONE;
	}

	wchar_t *getMirVer()
	{
		switch (this->client) {
		case CLIENT_APP:
			return FACEBOOK_CLIENT_APP;
		case CLIENT_MESSENGER:
			return FACEBOOK_CLIENT_MESSENGER;
		case CLIENT_OTHER:
			return FACEBOOK_CLIENT_OTHER;
		case CLIENT_MOBILE:
			return FACEBOOK_CLIENT_MOBILE;
		case CLIENT_WEB:
		default:
			return FACEBOOK_CLIENT_WEB;
		}
	}
};

struct chatroom_participant
{
	std::string user_id;
	std::string nick;	
	ParticipantRole role;	
	bool is_former;
	bool loaded;

	chatroom_participant() : loaded(false), is_former(false), role(ROLE_NONE) {}
};

struct facebook_chatroom
{	
	std::string thread_id;
	std::wstring chat_name;
	std::map<std::string, chatroom_participant> participants;
	bool can_reply;
	bool is_archived;
	bool is_subscribed;
	bool read_only;

	facebook_chatroom(std::string thread_id) : thread_id(thread_id) {}
};

struct facebook_message
{
	std::string user_id;
	std::string message_text;	
	std::string message_id;
	std::string thread_id;
	std::string data;
	time_t time;
	bool isIncoming;
	bool isUnread;
	bool isChat;
	MessageType type;

	int flag_;

	facebook_message()
	{
		this->time = 0;
		this->isUnread = this->isIncoming = true;
		this->isChat = false;
		this->type = MESSAGE;
		this->flag_ = 0;
	}
};

struct facebook_notification
{
	std::string user_id;
	std::string text;
	std::string link;
	std::string id;
	const char *icon;
	time_t time;
	bool seen;
	HWND hWndPopup;

	facebook_notification()
	{
		this->time = 0;
		this->seen = false;
		this->hWndPopup = NULL;
	}

	void setIcon(std::string iconUrl)
	{
		if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yj/r/6WffvhOaXGY.png")
			icon = "like";
		else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/y1/r/RvGKklgAefT.png")
			icon = "love";
		else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yV/r/McJA2ZjdJmf.png")
			icon = "haha";
		else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yL/r/IfsimazVjj4.png")
			icon = "wow";
		else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yH/r/jOeSrGlcPLG.png")
			icon = "sad";
		else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yL/r/IfsimazVjj4.png")
			icon = "angry";
		else
			icon = NULL;
	}
};

struct facebook_newsfeed
{
	std::string user_id;
	std::string title;
	std::string text;
	std::string link;

	facebook_newsfeed() {}
};

struct send_chat
{
	send_chat(const std::string &chat_id,const std::string &msg) : chat_id(chat_id), msg(msg) {}
	std::string chat_id;
	std::string msg;
};

struct send_direct
{
	send_direct(MCONTACT hContact,const std::string &msg, int msgid) : hContact(hContact), msg(msg), msgid(msgid) {}
	MCONTACT hContact;
	std::string msg;
	int msgid;
};

struct send_typing
{
	send_typing(MCONTACT hContact,const int status) : hContact(hContact), status(status) {}
	MCONTACT hContact;
	int status;
};

struct popup_data
{
	popup_data(FacebookProto *proto) : proto(proto) {}
	popup_data(FacebookProto *proto, std::string url) : proto(proto), url(url) {}
	FacebookProto *proto;
	std::string url;
	std::string notification_id;
};

struct status_data
{
	status_data() {
		this->isPage = false;
	}
	std::string user_id;
	std::string text;
	std::string url;	
	std::string place;	
	std::string privacy;
	bool isPage;
	std::vector<facebook_user*> users;
};

struct wall_data
{
	wall_data() {
		this->title = NULL;
		this->isPage = false;
	}
	wall_data(std::string user_id, wchar_t *title, bool isPage = false) : user_id(user_id), title(title), isPage(isPage) {}
	std::string user_id;
	wchar_t *title;
	bool isPage;
};

struct post_status_data {
	post_status_data(FacebookProto *proto) : proto(proto) {}
	post_status_data(FacebookProto *proto, wall_data *wall) : proto(proto) {
		this->walls.push_back(wall);
	}
	FacebookProto *proto;
	std::vector<wall_data*> walls;
};

struct open_url
{
	open_url(wchar_t *browser, wchar_t *url) : browser(browser), url(url) {}
	wchar_t *browser;
	wchar_t *url;	
};