Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9e20dc9

Browse files
committedJan 7, 2016
VERSION: update to ad2ee74b913a
1 parent 22a7068 commit 9e20dc9

File tree

5 files changed

+203
-163
lines changed

5 files changed

+203
-163
lines changed
 

‎ChangeLog‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
purple-facebook-ad2ee74b913a (2016-01-07):
2+
- Added an account option for self messages
3+
- Attempt to silently reconnect the MQTT stream
4+
- Fixed nonfunctional group chat auto-rejoining
5+
- Fixed the self contact being ignored
6+
- Fixed the timestamps on incoming messages not being preserved
7+
- Ignore messages which are sequentially duplicated
8+
- Implemented queued message sending
9+
- Minor bug fixes and refactoring
10+
- Properly handle optional Thrift fields and scoping
11+
112
purple-facebook-1852eb9052a0 (2015-12-25):
213
- Fixed broken contact counting with non-friends
314
- Trivial documentation fixes

‎VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1852eb9052a0
1+
ad2ee74b913a

‎include/purple-compat.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct _PurpleMessage
6868
#define purple_buddy_set_server_alias purple_blist_server_alias_buddy
6969
#define purple_chat_conversation_add_user purple_conv_chat_add_user
7070
#define purple_chat_conversation_get_id purple_conv_chat_get_id
71+
#define purple_chat_conversation_has_left purple_conv_chat_has_left
7172
#define purple_chat_conversation_has_user purple_conv_chat_find_user
7273
#define purple_chat_conversation_remove_user purple_conv_chat_remove_user
7374
#define purple_chat_conversation_set_topic purple_conv_chat_set_topic

‎patches/01-makefile.patch‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
diff -r 078fbf8d1a4e libpurple/protocols/facebook/Makefile.am
2-
--- a/libpurple/protocols/facebook/Makefile.am Mon Dec 21 22:29:34 2015 -0500
3-
+++ b/libpurple/protocols/facebook/Makefile.am Mon Dec 21 22:37:31 2015 -0500
1+
diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.am
2+
--- a/libpurple/protocols/facebook/Makefile.am Thu Jan 07 14:06:04 2016 -0500
3+
+++ b/libpurple/protocols/facebook/Makefile.am Thu Jan 07 15:45:09 2016 -0500
44
@@ -23,7 +23,12 @@
55
thrift.c \
66
thrift.h \
@@ -15,22 +15,23 @@ diff -r 078fbf8d1a4e libpurple/protocols/facebook/Makefile.am
1515

1616
CLEANFILES = \
1717
marshal.c \
18-
@@ -57,10 +62,9 @@
18+
@@ -57,11 +62,9 @@
1919
endif
2020

2121
AM_CPPFLAGS = \
2222
- -I$(top_srcdir)/libpurple \
2323
- -I$(top_builddir)/libpurple \
24+
- -I$(top_srcdir) \
2425
$(GLIB_CFLAGS) \
2526
$(JSON_CFLAGS) \
2627
+ $(PURPLE_CFLAGS) \
2728
$(ZLIB_CFLAGS) \
2829
- $(GPLUGIN_CFLAGS) \
2930
+ $(PLUGIN_CFLAGS) \
3031
$(DEBUG_CFLAGS)
31-
diff -r 078fbf8d1a4e libpurple/protocols/facebook/Makefile.mingw
32-
--- a/libpurple/protocols/facebook/Makefile.mingw Mon Dec 21 22:29:34 2015 -0500
33-
+++ b/libpurple/protocols/facebook/Makefile.mingw Mon Dec 21 22:37:31 2015 -0500
32+
diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.mingw
33+
--- a/libpurple/protocols/facebook/Makefile.mingw Thu Jan 07 14:06:04 2016 -0500
34+
+++ b/libpurple/protocols/facebook/Makefile.mingw Thu Jan 07 15:45:09 2016 -0500
3435
@@ -50,7 +50,9 @@
3536
json.c \
3637
mqtt.c \

‎patches/03-plugin.patch‎

Lines changed: 182 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
2-
--- a/libpurple/protocols/facebook/facebook.c Mon Dec 21 21:34:55 2015 -0500
3-
+++ b/libpurple/protocols/facebook/facebook.c Mon Dec 21 22:02:55 2015 -0500
1+
diff -r ad2ee74b913a libpurple/protocols/facebook/facebook.c
2+
--- a/libpurple/protocols/facebook/facebook.c Thu Jan 07 14:06:04 2016 -0500
3+
+++ b/libpurple/protocols/facebook/facebook.c Thu Jan 07 16:30:08 2016 -0500
44
@@ -446,7 +446,7 @@
55
id = purple_image_store_add_weak(pimg);
66

@@ -10,7 +10,7 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
1010
PURPLE_IMAGE_STORE_PROTOCOL
1111
"%u\">", id);
1212
msg->flags |= FB_API_MESSAGE_FLAG_DONE;
13-
@@ -825,7 +825,7 @@
13+
@@ -836,7 +836,7 @@
1414
GSList *select = NULL;
1515
PurpleConnection *gc;
1616

@@ -19,7 +19,7 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
1919
return;
2020
}
2121

22-
@@ -1011,7 +1011,7 @@
22+
@@ -1022,7 +1022,7 @@
2323
PurpleConnection *gc;
2424
PurpleMenuAction *act;
2525

@@ -28,7 +28,7 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
2828
return NULL;
2929
}
3030

31-
@@ -1059,7 +1059,8 @@
31+
@@ -1070,7 +1070,8 @@
3232
}
3333

3434
static gint
@@ -38,7 +38,7 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
3838
{
3939
const gchar *name;
4040
const gchar *text;
41-
@@ -1068,6 +1069,8 @@
41+
@@ -1079,6 +1080,8 @@
4242
FbId uid;
4343
gchar *sext;
4444

@@ -47,7 +47,7 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
4747
fata = purple_connection_get_protocol_data(gc);
4848
api = fb_data_get_api(fata);
4949

50-
@@ -1206,7 +1209,8 @@
50+
@@ -1217,7 +1220,8 @@
5151
}
5252

5353
static gint
@@ -57,7 +57,7 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
5757
{
5858
const gchar *name;
5959
const gchar *text;
60-
@@ -1217,6 +1221,8 @@
60+
@@ -1228,6 +1232,8 @@
6161
PurpleAccount *acct;
6262
PurpleChatConversation *chat;
6363

@@ -66,37 +66,140 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
6666
acct = purple_connection_get_account(gc);
6767
fata = purple_connection_get_protocol_data(gc);
6868
api = fb_data_get_api(fata);
69-
@@ -1385,99 +1391,6 @@
69+
@@ -1396,14 +1402,119 @@
7070
}
7171

7272
static void
7373
-facebook_protocol_init(PurpleProtocol *protocol)
74-
-{
75-
- GList *opts = NULL;
76-
- PurpleAccountOption *opt;
77-
-
74+
+fb_cmds_register(void)
75+
+{
76+
+ PurpleCmdId id;
77+
+
78+
+ static PurpleCmdFlag cflags =
79+
+ PURPLE_CMD_FLAG_CHAT |
80+
+ PURPLE_CMD_FLAG_PROTOCOL_ONLY;
81+
+
82+
+ g_return_if_fail(fb_cmds == NULL);
83+
+
84+
+ id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags,
85+
+ "prpl-facebook", fb_cmd_kick,
86+
+ _("kick: Kick someone from the chat"),
87+
+ NULL);
88+
+ fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id));
89+
+
90+
+ id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags,
91+
+ "prpl-facebook", fb_cmd_leave,
92+
+ _("leave: Leave the chat"),
93+
+ NULL);
94+
+ fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id));
95+
+}
96+
+
97+
+static void
98+
+fb_cmds_unregister_free(gpointer data)
99+
+{
100+
+ PurpleCmdId id = GPOINTER_TO_UINT(data);
101+
+ purple_cmd_unregister(id);
102+
+}
103+
+
104+
+static void
105+
+fb_cmds_unregister(void)
106+
+{
107+
+ g_slist_free_full(fb_cmds, fb_cmds_unregister_free);
108+
+}
109+
+
110+
+static gboolean
111+
+plugin_load(PurplePlugin *plugin)
112+
+{
113+
+ fb_cmds_register();
114+
+ _purple_socket_init();
115+
+ purple_http_init();
116+
+ return TRUE;
117+
+}
118+
+
119+
+static gboolean
120+
+plugin_unload(PurplePlugin *plugin)
121+
+{
122+
+ fb_cmds_unregister();
123+
+ purple_http_uninit();
124+
+ _purple_socket_uninit();
125+
+ return TRUE;
126+
+}
127+
+
128+
+G_MODULE_EXPORT gboolean
129+
+purple_init_plugin(PurplePlugin *plugin);
130+
+
131+
+G_MODULE_EXPORT gboolean
132+
+purple_init_plugin(PurplePlugin *plugin)
133+
{
134+
GList *opts = NULL;
135+
PurpleAccountOption *opt;
136+
78137
- protocol->id = FB_PROTOCOL_ID;
79138
- protocol->name = "Facebook";
80139
- protocol->options = OPT_PROTO_CHAT_TOPIC;
81-
-
82-
- opt = purple_account_option_int_new(_("Buddy list sync interval"),
83-
- "sync-interval", 30);
84-
- opts = g_list_prepend(opts, opt);
85-
-
86-
- opt = purple_account_option_bool_new(_("Mark messages as read"),
87-
- "mark-read", TRUE);
88-
- opts = g_list_prepend(opts, opt);
89-
-
90-
- opt = purple_account_option_bool_new(_("Show unread messages"),
91-
- "show-unread", TRUE);
92-
- opts = g_list_prepend(opts, opt);
93-
-
94-
- opt = purple_account_option_bool_new(_("Open new group chats with "
95-
- "incoming messages"),
96-
- "group-chat-open", TRUE);
97-
- opts = g_list_prepend(opts, opt);
140+
+ static gboolean inited = FALSE;
141+
+ static PurplePluginInfo info;
142+
+ static PurplePluginProtocolInfo pinfo;
143+
+
144+
+ (void) fb_protocol;
145+
+ plugin->info = &info;
146+
+
147+
+ if (G_LIKELY(inited)) {
148+
+ return purple_plugin_register(plugin);
149+
+ }
150+
+
151+
+ memset(&info, 0, sizeof info);
152+
+ memset(&pinfo, 0, sizeof pinfo);
153+
+
154+
+ info.magic = PURPLE_PLUGIN_MAGIC;
155+
+ info.major_version = PURPLE_MAJOR_VERSION;
156+
+ info.minor_version = PURPLE_MINOR_VERSION;
157+
+ info.type = PURPLE_PLUGIN_PROTOCOL;
158+
+ info.priority = PURPLE_PRIORITY_DEFAULT;
159+
+ info.id = FB_PROTOCOL_ID;
160+
+ info.name = "Facebook";
161+
+ info.version = PACKAGE_VERSION;
162+
+ info.summary = N_("Facebook Protocol Plugin");
163+
+ info.description = N_("Facebook Protocol Plugin");
164+
+ info.homepage = PACKAGE_URL;
165+
+ info.load = plugin_load;
166+
+ info.unload = plugin_unload;
167+
+ info.extra_info = &pinfo;
168+
+
169+
+ pinfo.options = OPT_PROTO_CHAT_TOPIC;
170+
+ pinfo.list_icon = fb_list_icon;
171+
+ pinfo.tooltip_text = fb_client_tooltip_text;
172+
+ pinfo.status_types = fb_status_types;
173+
+ pinfo.blist_node_menu = fb_client_blist_node_menu;
174+
+ pinfo.chat_info = fb_chat_info;
175+
+ pinfo.chat_info_defaults = fb_chat_info_defaults;
176+
+ pinfo.login = fb_login;
177+
+ pinfo.close = fb_close;
178+
+ pinfo.send_im = fb_im_send;
179+
+ pinfo.send_typing = fb_im_send_typing;
180+
+ pinfo.set_status = fb_server_set_status;
181+
+ pinfo.join_chat = fb_chat_join;
182+
+ pinfo.get_chat_name = fb_chat_get_name;
183+
+ pinfo.chat_invite = fb_chat_invite;
184+
+ pinfo.chat_send = fb_chat_send;
185+
+ pinfo.set_chat_topic = fb_chat_set_topic;
186+
+ pinfo.roomlist_get_list = fb_roomlist_get_list;
187+
+ pinfo.roomlist_cancel = fb_roomlist_cancel;
188+
+ pinfo.offline_message = fb_client_offline_message;
189+
+ pinfo.struct_size = sizeof pinfo;
190+
191+
opt = purple_account_option_int_new(_("Buddy list sync interval"),
192+
"sync-interval", 30);
193+
@@ -1425,147 +1536,8 @@
194+
"incoming messages"),
195+
"group-chat-open", TRUE);
196+
opts = g_list_prepend(opts, opt);
98197
- protocol->account_options = g_list_reverse(opts);
99-
-}
198+
+ pinfo.protocol_options = g_list_reverse(opts);
199+
+
200+
+ inited = TRUE;
201+
+ return purple_plugin_register(plugin);
202+
}
100203
-
101204
-static void
102205
-facebook_protocol_class_init(PurpleProtocolClass *klass)
@@ -163,34 +266,45 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
163266
-);
164267
-
165268
-static void
166-
fb_cmds_register(void)
167-
{
168-
PurpleCmdId id;
169-
@@ -1489,13 +1402,13 @@
170-
g_return_if_fail(fb_cmds == NULL);
171-
172-
id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags,
269+
-fb_cmds_register(void)
270+
-{
271+
- PurpleCmdId id;
272+
-
273+
- static PurpleCmdFlag cflags =
274+
- PURPLE_CMD_FLAG_CHAT |
275+
- PURPLE_CMD_FLAG_PROTOCOL_ONLY;
276+
-
277+
- g_return_if_fail(fb_cmds == NULL);
278+
-
279+
- id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags,
173280
- fb_protocol->id, fb_cmd_kick,
174-
+ "prpl-facebook", fb_cmd_kick,
175-
_("kick: Kick someone from the chat"),
176-
NULL);
177-
fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id));
178-
179-
id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags,
281+
- _("kick: Kick someone from the chat"),
282+
- NULL);
283+
- fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id));
284+
-
285+
- id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags,
180286
- fb_protocol->id, fb_cmd_leave,
181-
+ "prpl-facebook", fb_cmd_leave,
182-
_("leave: Leave the chat"),
183-
NULL);
184-
fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id));
185-
@@ -1514,43 +1427,102 @@
186-
g_slist_free_full(fb_cmds, fb_cmds_unregister_free);
187-
}
188-
287+
- _("leave: Leave the chat"),
288+
- NULL);
289+
- fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id));
290+
-}
291+
-
292+
-static void
293+
-fb_cmds_unregister_free(gpointer data)
294+
-{
295+
- PurpleCmdId id = GPOINTER_TO_UINT(data);
296+
- purple_cmd_unregister(id);
297+
-}
298+
-
299+
-static void
300+
-fb_cmds_unregister(void)
301+
-{
302+
- g_slist_free_full(fb_cmds, fb_cmds_unregister_free);
303+
-}
304+
-
189305
-static PurplePluginInfo *
190306
-plugin_query(GError **error)
191-
+static gboolean
192-
+plugin_load(PurplePlugin *plugin)
193-
{
307+
-{
194308
- return purple_plugin_info_new(
195309
- "id", FB_PROTOCOL_ID,
196310
- "name", "Facebook Protocol",
@@ -216,108 +330,21 @@ diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.c
216330
- return FALSE;
217331
- }
218332
-
219-
fb_cmds_register();
220-
+ _purple_socket_init();
221-
+ purple_http_init();
222-
return TRUE;
223-
}
224-
225-
static gboolean
333+
- fb_cmds_register();
334+
- return TRUE;
335+
-}
336+
-
337+
-static gboolean
226338
-plugin_unload(PurplePlugin *plugin, GError **error)
227-
+plugin_unload(PurplePlugin *plugin)
228-
{
229-
fb_cmds_unregister();
339+
-{
340+
- fb_cmds_unregister();
230341
- return purple_protocols_remove(fb_protocol, error);
231-
+ purple_http_uninit();
232-
+ _purple_socket_uninit();
233-
+ return TRUE;
234-
}
235-
342+
-}
343+
-
236344
-PURPLE_PLUGIN_INIT(facebook, plugin_query, plugin_load, plugin_unload);
237-
+G_MODULE_EXPORT gboolean
238-
+purple_init_plugin(PurplePlugin *plugin);
239-
+
240-
+G_MODULE_EXPORT gboolean
241-
+purple_init_plugin(PurplePlugin *plugin)
242-
+{
243-
+ GList *opts = NULL;
244-
+ PurpleAccountOption *opt;
245-
+
246-
+ static gboolean inited = FALSE;
247-
+ static PurplePluginInfo info;
248-
+ static PurplePluginProtocolInfo pinfo;
249-
+
250-
+ (void) fb_protocol;
251-
+ plugin->info = &info;
252-
+
253-
+ if (G_LIKELY(inited)) {
254-
+ return purple_plugin_register(plugin);
255-
+ }
256-
+
257-
+ memset(&info, 0, sizeof info);
258-
+ memset(&pinfo, 0, sizeof pinfo);
259-
+
260-
+ info.magic = PURPLE_PLUGIN_MAGIC;
261-
+ info.major_version = PURPLE_MAJOR_VERSION;
262-
+ info.minor_version = PURPLE_MINOR_VERSION;
263-
+ info.type = PURPLE_PLUGIN_PROTOCOL;
264-
+ info.priority = PURPLE_PRIORITY_DEFAULT;
265-
+ info.id = FB_PROTOCOL_ID;
266-
+ info.name = "Facebook";
267-
+ info.version = PACKAGE_VERSION;
268-
+ info.summary = N_("Facebook Protocol Plugin");
269-
+ info.description = N_("Facebook Protocol Plugin");
270-
+ info.homepage = PACKAGE_URL;
271-
+ info.load = plugin_load;
272-
+ info.unload = plugin_unload;
273-
+ info.extra_info = &pinfo;
274-
+
275-
+ pinfo.options = OPT_PROTO_CHAT_TOPIC;
276-
+ pinfo.list_icon = fb_list_icon;
277-
+ pinfo.tooltip_text = fb_client_tooltip_text;
278-
+ pinfo.status_types = fb_status_types;
279-
+ pinfo.blist_node_menu = fb_client_blist_node_menu;
280-
+ pinfo.chat_info = fb_chat_info;
281-
+ pinfo.chat_info_defaults = fb_chat_info_defaults;
282-
+ pinfo.login = fb_login;
283-
+ pinfo.close = fb_close;
284-
+ pinfo.send_im = fb_im_send;
285-
+ pinfo.send_typing = fb_im_send_typing;
286-
+ pinfo.set_status = fb_server_set_status;
287-
+ pinfo.join_chat = fb_chat_join;
288-
+ pinfo.get_chat_name = fb_chat_get_name;
289-
+ pinfo.chat_invite = fb_chat_invite;
290-
+ pinfo.chat_send = fb_chat_send;
291-
+ pinfo.set_chat_topic = fb_chat_set_topic;
292-
+ pinfo.roomlist_get_list = fb_roomlist_get_list;
293-
+ pinfo.roomlist_cancel = fb_roomlist_cancel;
294-
+ pinfo.offline_message = fb_client_offline_message;
295-
+ pinfo.struct_size = sizeof pinfo;
296-
+
297-
+ opt = purple_account_option_int_new(_("Buddy list sync interval"),
298-
+ "sync-interval", 30);
299-
+ opts = g_list_prepend(opts, opt);
300-
+
301-
+ opt = purple_account_option_bool_new(_("Mark messages as read"),
302-
+ "mark-read", TRUE);
303-
+ opts = g_list_prepend(opts, opt);
304-
+
305-
+ opt = purple_account_option_bool_new(_("Show unread messages"),
306-
+ "show-unread", TRUE);
307-
+ opts = g_list_prepend(opts, opt);
308-
+
309-
+ opt = purple_account_option_bool_new(_("Open new group chats with "
310-
+ "incoming messages"),
311-
+ "group-chat-open", TRUE);
312-
+ opts = g_list_prepend(opts, opt);
313-
+ pinfo.protocol_options = g_list_reverse(opts);
314-
+
315-
+ inited = TRUE;
316-
+ return purple_plugin_register(plugin);
317-
+}
318-
diff -r 50bb40c42245 libpurple/protocols/facebook/facebook.h
319-
--- a/libpurple/protocols/facebook/facebook.h Mon Dec 21 21:34:55 2015 -0500
320-
+++ b/libpurple/protocols/facebook/facebook.h Mon Dec 21 22:02:55 2015 -0500
345+
diff -r ad2ee74b913a libpurple/protocols/facebook/facebook.h
346+
--- a/libpurple/protocols/facebook/facebook.h Thu Jan 07 14:06:04 2016 -0500
347+
+++ b/libpurple/protocols/facebook/facebook.h Thu Jan 07 16:30:08 2016 -0500
321348
@@ -22,24 +22,7 @@
322349
#ifndef _FACEBOOK_H_
323350
#define _FACEBOOK_H_

0 commit comments

Comments
 (0)
Please sign in to comment.