diff options
author | dequis <dx@dxzone.com.ar> | 2017-08-31 09:00:26 +0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2017-08-31 09:54:14 +0300 |
commit | 9897698ecf62f02f09ce86d7731b618a352f67a7 (patch) | |
tree | 80e0008edc08a95e9443ff59dcf967d2fc033c9b | |
parent | 743791ad10d245dcb924f6b106d75ca2a77adb95 (diff) |
Refresh patches, no change in functionality
Patch 04-revert-gio.patch now also reverts upstream commit
38402:0f253504b9dd ("facebook: Fix reading MQTT ping responses")
which is a gio specific fix
It also partially reverts 38433:361c801c4536 ("Remove purple_timeout_*
function usage") in one place where it conflicted
Those were the actual conflict fixes, the rest are just refreshing line
numbers to apply cleanly
-rw-r--r-- | patches/01-makefile.patch | 20 | ||||
-rw-r--r-- | patches/02-glibcompat.patch | 2 | ||||
-rw-r--r-- | patches/03-plugin.patch | 344 | ||||
-rw-r--r-- | patches/04-revert-gio.patch | 177 | ||||
-rw-r--r-- | patches/05-revert-http-callbacks.patch | 6 | ||||
-rw-r--r-- | patches/07-revert-http-gio.patch | 56 | ||||
-rw-r--r-- | patches/08-revert-marshaller.patch | 20 |
7 files changed, 308 insertions, 317 deletions
diff --git a/patches/01-makefile.patch b/patches/01-makefile.patch index 3a3a8d7..ed5a3d7 100644 --- a/patches/01-makefile.patch +++ b/patches/01-makefile.patch @@ -1,7 +1,7 @@ diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.am --- a/libpurple/protocols/facebook/Makefile.am Thu Jan 07 14:06:04 2016 -0500 +++ b/libpurple/protocols/facebook/Makefile.am Thu Jan 07 15:45:09 2016 -0500 -@@ -23,7 +23,12 @@ +@@ -20,7 +20,12 @@ thrift.c \ thrift.h \ util.c \ @@ -13,9 +13,9 @@ diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.am + ../../purple-socket.h \ + ../../purple-socket.c - CLEANFILES = \ - marshal.c \ -@@ -57,11 +62,9 @@ + AM_CFLAGS = $(st) + +@@ -43,10 +48,9 @@ endif AM_CPPFLAGS = \ @@ -24,15 +24,15 @@ diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.am - -I$(top_srcdir) \ $(GLIB_CFLAGS) \ $(JSON_CFLAGS) \ -+ $(PURPLE_CFLAGS) \ - $(ZLIB_CFLAGS) \ - $(GPLUGIN_CFLAGS) \ ++ $(PURPLE_CFLAGS) \ ++ $(ZLIB_CFLAGS) \ + $(PLUGIN_CFLAGS) \ $(DEBUG_CFLAGS) diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.mingw --- a/libpurple/protocols/facebook/Makefile.mingw Thu Jan 07 14:06:04 2016 -0500 +++ b/libpurple/protocols/facebook/Makefile.mingw Thu Jan 07 15:45:09 2016 -0500 -@@ -50,7 +50,9 @@ +@@ -49,7 +49,9 @@ json.c \ mqtt.c \ thrift.c \ @@ -43,7 +43,7 @@ diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.mingw OBJECTS = $(C_SRC:%.c=%.o) -@@ -63,7 +65,6 @@ +@@ -62,7 +64,6 @@ -lgobject-2.0 \ -lws2_32 \ -lintl \ @@ -51,7 +51,7 @@ diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.mingw -ljson-glib-1.0 \ -lz \ -lpurple -@@ -77,12 +78,12 @@ +@@ -76,12 +77,12 @@ all: $(TARGET).dll @@ -65,4 +65,4 @@ diff -r ad2ee74b913a libpurple/protocols/facebook/Makefile.mingw +$(TARGET).dll: $(OBJECTS) $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - marshal.c: marshaller.list marshal.h + ## diff --git a/patches/02-glibcompat.patch b/patches/02-glibcompat.patch index 663ab0c..5e131f0 100644 --- a/patches/02-glibcompat.patch +++ b/patches/02-glibcompat.patch @@ -1,6 +1,6 @@ --- a/libpurple/glibcompat.h 2016-11-21 09:38:39.250858177 -0300 +++ b/libpurple/glibcompat.h 2016-11-21 09:39:44.789845560 -0300 -@@ -66,6 +66,30 @@ +@@ -71,6 +71,30 @@ /****************************************************************************** * g_assert_* macros *****************************************************************************/ diff --git a/patches/03-plugin.patch b/patches/03-plugin.patch index cc51240..0964223 100644 --- a/patches/03-plugin.patch +++ b/patches/03-plugin.patch @@ -1,7 +1,7 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c --- a/libpurple/protocols/facebook/facebook.c Sat Jan 16 10:01:23 2016 -0500 +++ b/libpurple/protocols/facebook/facebook.c Mon Jan 18 09:39:59 2016 -0500 -@@ -446,7 +446,7 @@ +@@ -500,7 +500,7 @@ id = purple_image_store_add_weak(pimg); g_free(msg->text); @@ -10,7 +10,7 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c PURPLE_IMAGE_STORE_PROTOCOL "%u\">", id); msg->flags |= FB_API_MESSAGE_FLAG_DONE; -@@ -864,7 +864,7 @@ +@@ -966,7 +966,7 @@ GSList *select = NULL; PurpleConnection *gc; @@ -19,7 +19,7 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c return; } -@@ -1050,7 +1050,7 @@ +@@ -1160,7 +1160,7 @@ PurpleConnection *gc; PurpleMenuAction *act; @@ -28,7 +28,7 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c return NULL; } -@@ -1098,7 +1098,8 @@ +@@ -1208,7 +1208,8 @@ } static gint @@ -38,7 +38,7 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c { const gchar *name; const gchar *text; -@@ -1107,6 +1108,8 @@ +@@ -1217,6 +1218,8 @@ FbId uid; gchar *sext; @@ -47,7 +47,7 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c fata = purple_connection_get_protocol_data(gc); api = fb_data_get_api(fata); -@@ -1245,7 +1248,8 @@ +@@ -1355,7 +1358,8 @@ } static gint @@ -57,7 +57,7 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c { const gchar *name; const gchar *text; -@@ -1256,6 +1260,8 @@ +@@ -1366,6 +1370,8 @@ PurpleAccount *acct; PurpleChatConversation *chat; @@ -66,140 +66,45 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c acct = purple_connection_get_account(gc); fata = purple_connection_get_protocol_data(gc); api = fb_data_get_api(fata); -@@ -1424,14 +1430,119 @@ +@@ -1534,107 +1540,6 @@ } static void -facebook_protocol_init(PurpleProtocol *protocol) -+fb_cmds_register(void) -+{ -+ PurpleCmdId id; -+ -+ static PurpleCmdFlag cflags = -+ PURPLE_CMD_FLAG_CHAT | -+ PURPLE_CMD_FLAG_PROTOCOL_ONLY; -+ -+ g_return_if_fail(fb_cmds == NULL); -+ -+ id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags, -+ "prpl-facebook", fb_cmd_kick, -+ _("kick: Kick someone from the chat"), -+ NULL); -+ fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); -+ -+ id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags, -+ "prpl-facebook", fb_cmd_leave, -+ _("leave: Leave the chat"), -+ NULL); -+ fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); -+} -+ -+static void -+fb_cmds_unregister_free(gpointer data) -+{ -+ PurpleCmdId id = GPOINTER_TO_UINT(data); -+ purple_cmd_unregister(id); -+} -+ -+static void -+fb_cmds_unregister(void) -+{ -+ g_slist_free_full(fb_cmds, fb_cmds_unregister_free); -+} -+ -+static gboolean -+plugin_load(PurplePlugin *plugin) -+{ -+ fb_cmds_register(); -+ _purple_socket_init(); -+ purple_http_init(); -+ return TRUE; -+} -+ -+static gboolean -+plugin_unload(PurplePlugin *plugin) -+{ -+ fb_cmds_unregister(); -+ purple_http_uninit(); -+ _purple_socket_uninit(); -+ return TRUE; -+} -+ -+G_MODULE_EXPORT gboolean -+purple_init_plugin(PurplePlugin *plugin); -+ -+G_MODULE_EXPORT gboolean -+purple_init_plugin(PurplePlugin *plugin) - { - GList *opts = NULL; - PurpleAccountOption *opt; - +-{ +- GList *opts = NULL; +- PurpleAccountOption *opt; +- - protocol->id = FB_PROTOCOL_ID; - protocol->name = "Facebook"; - protocol->options = OPT_PROTO_CHAT_TOPIC; -+ static gboolean inited = FALSE; -+ static PurplePluginInfo info; -+ static PurplePluginProtocolInfo pinfo; -+ -+ (void) fb_protocol; -+ plugin->info = &info; -+ -+ if (G_LIKELY(inited)) { -+ return purple_plugin_register(plugin); -+ } -+ -+ memset(&info, 0, sizeof info); -+ memset(&pinfo, 0, sizeof pinfo); -+ -+ info.magic = PURPLE_PLUGIN_MAGIC; -+ info.major_version = PURPLE_MAJOR_VERSION; -+ info.minor_version = PURPLE_MINOR_VERSION; -+ info.type = PURPLE_PLUGIN_PROTOCOL; -+ info.priority = PURPLE_PRIORITY_DEFAULT; -+ info.id = FB_PROTOCOL_ID; -+ info.name = "Facebook"; -+ info.version = PACKAGE_VERSION; -+ info.summary = N_("Facebook Protocol Plugin"); -+ info.description = N_("Facebook Protocol Plugin"); -+ info.homepage = PACKAGE_URL; -+ info.load = plugin_load; -+ info.unload = plugin_unload; -+ info.extra_info = &pinfo; -+ -+ pinfo.options = OPT_PROTO_CHAT_TOPIC; -+ pinfo.list_icon = fb_list_icon; -+ pinfo.tooltip_text = fb_client_tooltip_text; -+ pinfo.status_types = fb_status_types; -+ pinfo.blist_node_menu = fb_client_blist_node_menu; -+ pinfo.chat_info = fb_chat_info; -+ pinfo.chat_info_defaults = fb_chat_info_defaults; -+ pinfo.login = fb_login; -+ pinfo.close = fb_close; -+ pinfo.send_im = fb_im_send; -+ pinfo.send_typing = fb_im_send_typing; -+ pinfo.set_status = fb_server_set_status; -+ pinfo.join_chat = fb_chat_join; -+ pinfo.get_chat_name = fb_chat_get_name; -+ pinfo.chat_invite = fb_chat_invite; -+ pinfo.chat_send = fb_chat_send; -+ pinfo.set_chat_topic = fb_chat_set_topic; -+ pinfo.roomlist_get_list = fb_roomlist_get_list; -+ pinfo.roomlist_cancel = fb_roomlist_cancel; -+ pinfo.offline_message = fb_client_offline_message; -+ pinfo.struct_size = sizeof pinfo; - - opt = purple_account_option_int_new(_("Buddy list sync interval"), - "sync-interval", 30); -@@ -1453,147 +1564,8 @@ - "incoming messages"), - "group-chat-open", TRUE); - opts = g_list_prepend(opts, opt); +- +- opt = purple_account_option_int_new(_("Buddy list sync interval"), +- "sync-interval", 5); +- opts = g_list_prepend(opts, opt); +- +- opt = purple_account_option_bool_new(_("Mark messages as read on focus"), +- "mark-read", TRUE); +- opts = g_list_prepend(opts, opt); +- +- opt = purple_account_option_bool_new(_("Mark messages as read only when available"), +- "mark-read-available", FALSE); +- opts = g_list_prepend(opts, opt); +- +- opt = purple_account_option_bool_new(_("Show self messages"), +- "show-self", TRUE); +- opts = g_list_prepend(opts, opt); +- +- opt = purple_account_option_bool_new(_("Show unread messages"), +- "show-unread", TRUE); +- opts = g_list_prepend(opts, opt); +- +- opt = purple_account_option_bool_new(_("Open new group chats with " +- "incoming messages"), +- "group-chat-open", TRUE); +- opts = g_list_prepend(opts, opt); - protocol->account_options = g_list_reverse(opts); -+ pinfo.protocol_options = g_list_reverse(opts); -+ -+ inited = TRUE; -+ return purple_plugin_register(plugin); - } +-} - -static void -facebook_protocol_class_init(PurpleProtocolClass *klass) @@ -266,42 +171,29 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c -); - -static void --fb_cmds_register(void) --{ -- PurpleCmdId id; -- -- static PurpleCmdFlag cflags = -- PURPLE_CMD_FLAG_CHAT | -- PURPLE_CMD_FLAG_PROTOCOL_ONLY; -- -- g_return_if_fail(fb_cmds == NULL); -- -- id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags, + fb_cmds_register(void) + { + PurpleCmdId id; +@@ -1646,13 +1551,13 @@ + g_return_if_fail(fb_cmds == NULL); + + id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags, - fb_protocol->id, fb_cmd_kick, -- _("kick: Kick someone from the chat"), -- NULL); -- fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); -- -- id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags, ++ "prpl-facebook", fb_cmd_kick, + _("kick: Kick someone from the chat"), + NULL); + fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); + + id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags, - fb_protocol->id, fb_cmd_leave, -- _("leave: Leave the chat"), -- NULL); -- fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); --} -- --static void --fb_cmds_unregister_free(gpointer data) --{ -- PurpleCmdId id = GPOINTER_TO_UINT(data); -- purple_cmd_unregister(id); --} -- --static void --fb_cmds_unregister(void) --{ -- g_slist_free_full(fb_cmds, fb_cmds_unregister_free); --} -- ++ "prpl-facebook", fb_cmd_leave, + _("leave: Leave the chat"), + NULL); + fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); +@@ -1671,43 +1576,110 @@ + g_slist_free_full(fb_cmds, fb_cmds_unregister_free); + } + -static PurplePluginInfo * -plugin_query(GError **error) -{ @@ -320,9 +212,10 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c - ); -} - --static gboolean + static gboolean -plugin_load(PurplePlugin *plugin, GError **error) --{ ++plugin_load(PurplePlugin *plugin) + { - facebook_protocol_register_type(plugin); - fb_protocol = purple_protocols_add(FACEBOOK_TYPE_PROTOCOL, error); - @@ -330,18 +223,113 @@ diff -r 25a255f32eee libpurple/protocols/facebook/facebook.c - return FALSE; - } - -- fb_cmds_register(); -- return TRUE; --} -- --static gboolean + fb_cmds_register(); ++ _purple_socket_init(); ++ purple_http_init(); + return TRUE; + } + + static gboolean -plugin_unload(PurplePlugin *plugin, GError **error) --{ -- fb_cmds_unregister(); ++plugin_unload(PurplePlugin *plugin) + { + fb_cmds_unregister(); - return purple_protocols_remove(fb_protocol, error); --} -- ++ purple_http_uninit(); ++ _purple_socket_uninit(); ++ return TRUE; + } + -PURPLE_PLUGIN_INIT(facebook, plugin_query, plugin_load, plugin_unload); ++G_MODULE_EXPORT gboolean ++purple_init_plugin(PurplePlugin *plugin); ++ ++G_MODULE_EXPORT gboolean ++purple_init_plugin(PurplePlugin *plugin) ++{ ++ GList *opts = NULL; ++ PurpleAccountOption *opt; ++ ++ static gboolean inited = FALSE; ++ static PurplePluginInfo info; ++ static PurplePluginProtocolInfo pinfo; ++ ++ (void) fb_protocol; ++ plugin->info = &info; ++ ++ if (G_LIKELY(inited)) { ++ return purple_plugin_register(plugin); ++ } ++ ++ memset(&info, 0, sizeof info); ++ memset(&pinfo, 0, sizeof pinfo); ++ ++ info.magic = PURPLE_PLUGIN_MAGIC; ++ info.major_version = PURPLE_MAJOR_VERSION; ++ info.minor_version = PURPLE_MINOR_VERSION; ++ info.type = PURPLE_PLUGIN_PROTOCOL; ++ info.priority = PURPLE_PRIORITY_DEFAULT; ++ info.id = FB_PROTOCOL_ID; ++ info.name = "Facebook"; ++ info.version = PACKAGE_VERSION; ++ info.summary = N_("Facebook Protocol Plugin"); ++ info.description = N_("Facebook Protocol Plugin"); ++ info.homepage = PACKAGE_URL; ++ info.load = plugin_load; ++ info.unload = plugin_unload; ++ info.extra_info = &pinfo; ++ ++ pinfo.options = OPT_PROTO_CHAT_TOPIC; ++ pinfo.list_icon = fb_list_icon; ++ pinfo.tooltip_text = fb_client_tooltip_text; ++ pinfo.status_types = fb_status_types; ++ pinfo.blist_node_menu = fb_client_blist_node_menu; ++ pinfo.chat_info = fb_chat_info; ++ pinfo.chat_info_defaults = fb_chat_info_defaults; ++ pinfo.login = fb_login; ++ pinfo.close = fb_close; ++ pinfo.send_im = fb_im_send; ++ pinfo.send_typing = fb_im_send_typing; ++ pinfo.set_status = fb_server_set_status; ++ pinfo.join_chat = fb_chat_join; ++ pinfo.get_chat_name = fb_chat_get_name; ++ pinfo.chat_invite = fb_chat_invite; ++ pinfo.chat_send = fb_chat_send; ++ pinfo.set_chat_topic = fb_chat_set_topic; ++ pinfo.roomlist_get_list = fb_roomlist_get_list; ++ pinfo.roomlist_cancel = fb_roomlist_cancel; ++ pinfo.offline_message = fb_client_offline_message; ++ pinfo.struct_size = sizeof pinfo; ++ ++ opt = purple_account_option_int_new(_("Buddy list sync interval"), ++ "sync-interval", 5); ++ opts = g_list_prepend(opts, opt); ++ ++ opt = purple_account_option_bool_new(_("Mark messages as read on focus"), ++ "mark-read", TRUE); ++ opts = g_list_prepend(opts, opt); ++ ++ opt = purple_account_option_bool_new(_("Mark messages as read only when available"), ++ "mark-read-available", FALSE); ++ opts = g_list_prepend(opts, opt); ++ ++ opt = purple_account_option_bool_new(_("Show self messages"), ++ "show-self", TRUE); ++ opts = g_list_prepend(opts, opt); ++ ++ opt = purple_account_option_bool_new(_("Show unread messages"), ++ "show-unread", TRUE); ++ opts = g_list_prepend(opts, opt); ++ ++ opt = purple_account_option_bool_new(_("Open new group chats with " ++ "incoming messages"), ++ "group-chat-open", TRUE); ++ opts = g_list_prepend(opts, opt); ++ pinfo.protocol_options = g_list_reverse(opts); ++ ++ inited = TRUE; ++ return purple_plugin_register(plugin); ++} diff -r 25a255f32eee libpurple/protocols/facebook/facebook.h --- a/libpurple/protocols/facebook/facebook.h Sat Jan 16 10:01:23 2016 -0500 +++ b/libpurple/protocols/facebook/facebook.h Mon Jan 18 09:39:59 2016 -0500 diff --git a/patches/04-revert-gio.patch b/patches/04-revert-gio.patch index 1c5874e..811c317 100644 --- a/patches/04-revert-gio.patch +++ b/patches/04-revert-gio.patch @@ -1,7 +1,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/facebook.c --- a/libpurple/protocols/facebook/facebook.c Thu Sep 15 13:31:06 2016 -0500 +++ b/libpurple/protocols/facebook/facebook.c Wed Sep 14 14:53:12 2016 -0500 -@@ -332,8 +332,8 @@ +@@ -373,8 +373,8 @@ gc = fb_data_get_connection(fata); @@ -23,9 +23,9 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c -#include "queuedoutputstream.h" +#include "sslconn.h" - #include "marshal.h" #include "mqtt.h" -@@ -38,17 +37,17 @@ + #include "util.h" +@@ -37,17 +36,17 @@ struct _FbMqttPrivate { PurpleConnection *gc; @@ -47,7 +47,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c }; struct _FbMqttMessagePrivate -@@ -66,8 +65,6 @@ +@@ -65,8 +64,6 @@ G_DEFINE_TYPE(FbMqtt, fb_mqtt, G_TYPE_OBJECT); G_DEFINE_TYPE(FbMqttMessage, fb_mqtt_message, G_TYPE_OBJECT); @@ -56,7 +56,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c static void fb_mqtt_dispose(GObject *obj) { -@@ -76,6 +73,7 @@ +@@ -75,6 +72,7 @@ fb_mqtt_close(mqtt); g_byte_array_free(priv->rbuf, TRUE); @@ -64,7 +64,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c } static void -@@ -163,6 +161,7 @@ +@@ -158,6 +156,7 @@ mqtt->priv = priv; priv->rbuf = g_byte_array_new(); @@ -72,7 +72,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c } static void -@@ -206,6 +205,18 @@ +@@ -201,6 +200,18 @@ return q; } @@ -91,31 +91,24 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c FbMqtt * fb_mqtt_new(PurpleConnection *gc) { -@@ -229,47 +240,33 @@ +@@ -224,47 +235,33 @@ g_return_if_fail(FB_IS_MQTT(mqtt)); priv = mqtt->priv; +- if (priv->tev > 0) { +- g_source_remove(priv->tev); +- priv->tev = 0; + if (priv->wev > 0) { + purple_input_remove(priv->wev); + priv->wev = 0; -+ } -+ -+ if (priv->rev > 0) { -+ purple_input_remove(priv->rev); -+ priv->rev = 0; -+ } -+ - if (priv->tev > 0) { - purple_timeout_remove(priv->tev); - priv->tev = 0; } - if (priv->cancellable != NULL) { - g_cancellable_cancel(priv->cancellable); - g_clear_object(&priv->cancellable); -+ if (priv->gsc != NULL) { -+ purple_ssl_close(priv->gsc); -+ priv->gsc = NULL; ++ if (priv->rev > 0) { ++ purple_input_remove(priv->rev); ++ priv->rev = 0; } - if (priv->conn != NULL) { @@ -125,12 +118,13 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c - g_clear_object(&priv->input); - g_clear_object(&priv->output); - g_clear_object(&priv->conn); -+ if (priv->wbuf->len > 0) { -+ fb_util_debug_warning("Closing with unwritten data"); ++ if (priv->tev > 0) { ++ purple_timeout_remove(priv->tev); ++ priv->tev = 0; } - priv->connected = FALSE; - g_byte_array_set_size(priv->rbuf, 0); +- priv->connected = FALSE; +- g_byte_array_set_size(priv->rbuf, 0); -} - -static void @@ -140,22 +134,29 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c - /* Return as cancelled means the connection is closing */ - g_error_free(err); - return; -- } -- ++ if (priv->gsc != NULL) { ++ purple_ssl_close(priv->gsc); ++ priv->gsc = NULL; + } + - /* Now we can check for programming errors */ - g_return_if_fail(FB_IS_MQTT(mqtt)); - - if (prefix != NULL) { - g_prefix_error(&err, "%s: ", prefix); -- } -- ++ if (priv->wbuf->len > 0) { ++ fb_util_debug_warning("Closing with unwritten data"); + } + - g_signal_emit_by_name(mqtt, "error", err); - g_error_free(err); ++ priv->connected = FALSE; ++ g_byte_array_set_size(priv->rbuf, 0); + g_byte_array_set_size(priv->wbuf, 0); } void -@@ -347,130 +344,74 @@ +@@ -342,127 +339,75 @@ } static void @@ -191,6 +192,8 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c - gssize ret; FbMqttMessage *msg; - GError *err = NULL; +- +- ret = g_input_stream_read_finish(G_INPUT_STREAM(source), res, &err); + FbMqttPrivate *priv = mqtt->priv; + gint res; + guint mult; @@ -199,16 +202,15 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c + gsize size; + gssize rize; -- ret = g_input_stream_read_finish(G_INPUT_STREAM(source), res, &err); -+ if (priv->remz < 1) { -+ /* Reset the read buffer */ -+ g_byte_array_set_size(priv->rbuf, 0); - - if (ret < 1) { - if (ret == 0) { - err = g_error_new_literal(G_IO_ERROR, - G_IO_ERROR_CONNECTION_CLOSED, - _("Connection closed")); ++ if (priv->remz < 1) { ++ /* Reset the read buffer */ ++ g_byte_array_set_size(priv->rbuf, 0); ++ + res = purple_ssl_read(priv->gsc, &byte, sizeof byte); + g_byte_array_append(priv->rbuf, &byte, sizeof byte); + @@ -221,18 +223,10 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c - fb_mqtt_take_error(mqtt, err, _("Failed to read packet data")); - return; - } -- -- priv = mqtt->priv; -- priv->remz -= ret; + mult = 1; -- if (priv->remz > 0) { -- g_input_stream_read_async(G_INPUT_STREAM(source), -- priv->rbuf->data + -- priv->rbuf->len - priv->remz, priv->remz, -- G_PRIORITY_DEFAULT, priv->cancellable, -- fb_mqtt_cb_read_packet, mqtt); -- return; +- priv = mqtt->priv; +- priv->remz -= ret; + do { + res = purple_ssl_read(priv->gsc, &byte, sizeof byte); + g_byte_array_append(priv->rbuf, &byte, sizeof byte); @@ -242,42 +236,45 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c + _("Failed to read packet size")); + return; + } -+ + +- if (priv->remz > 0) { +- g_input_stream_read_async(G_INPUT_STREAM(source), +- priv->rbuf->data + +- priv->rbuf->len - priv->remz, priv->remz, +- G_PRIORITY_DEFAULT, priv->cancellable, +- fb_mqtt_cb_read_packet, mqtt); +- return; + priv->remz += (byte & 127) * mult; + mult *= 128; + } while ((byte & 128) != 0); } - msg = fb_mqtt_message_new_bytes(priv->rbuf); -+ if (priv->remz > 0) { -+ size = MIN(priv->remz, sizeof buf); -+ rize = purple_ssl_read(priv->gsc, buf, size); - +- - if (G_UNLIKELY(msg == NULL)) { - fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, - _("Failed to parse message")); - return; +- } ++ if (priv->remz > 0) { ++ size = MIN(priv->remz, sizeof buf); ++ rize = purple_ssl_read(priv->gsc, buf, size); + +- fb_mqtt_read(mqtt, msg); +- g_object_unref(msg); + if (rize < 1) { + fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, + _("Failed to read packet data")); + return; + } -+ -+ g_byte_array_append(priv->rbuf, buf, rize); -+ priv->remz -= rize; - } -- fb_mqtt_read(mqtt, msg); -- g_object_unref(msg); -- - /* Read another packet if connection wasn't reset in fb_mqtt_read() */ - if (fb_mqtt_connected(mqtt, FALSE)) { - fb_mqtt_read_packet(mqtt); -- } ++ g_byte_array_append(priv->rbuf, buf, rize); ++ priv->remz -= rize; + } -} -+ if (priv->remz < 1) { -+ msg = fb_mqtt_message_new_bytes(priv->rbuf); -+ priv->remz = 0; -static void -fb_mqtt_read_packet(FbMqtt *mqtt) @@ -289,7 +286,10 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c - guint mult = 1; - guint8 byte; - gsize size = 0; -- ++ if (priv->remz < 1) { ++ msg = fb_mqtt_message_new_bytes(priv->rbuf); ++ priv->remz = 0; + - buf = g_buffered_input_stream_peek_buffer(priv->input, &count); - - /* Start at 1 to skip the first byte */ @@ -298,12 +298,13 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c - do { - if (pos >= count) { - /* Not enough data yet, try again later */ -- size = 0; -- break; +- g_buffered_input_stream_fill_async(priv->input, -1, +- G_PRIORITY_DEFAULT, priv->cancellable, +- fb_mqtt_cb_fill, mqtt); + if (G_UNLIKELY(msg == NULL)) { + fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, + _("Failed to parse message")); -+ return; + return; } - byte = *(buf + pos++); @@ -312,33 +313,29 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c - mult *= 128; - } while ((byte & 128) != 0); - -- if (size > 0) { -- /* Add header to size */ -- size += pos; +- /* Add header to size */ +- size += pos; - -- g_byte_array_set_size(priv->rbuf, size); -- priv->remz = size; +- g_byte_array_set_size(priv->rbuf, size); +- priv->remz = size; - -- /* TODO: Use g_input_stream_read_all_async() when available. */ -- /* TODO: Alternately, it would be nice to let the -- * FbMqttMessage directly use the GBufferedInputStream -- * buffer instead of copying it, provided it's consumed -- * before the next read. -- */ -- g_input_stream_read_async(G_INPUT_STREAM(priv->input), -- priv->rbuf->data, priv->rbuf->len, -- G_PRIORITY_DEFAULT, priv->cancellable, -- fb_mqtt_cb_read_packet, mqtt); -- } else { -- g_buffered_input_stream_fill_async(priv->input, -1, -- G_PRIORITY_DEFAULT, priv->cancellable, -- fb_mqtt_cb_fill, mqtt); +- /* TODO: Use g_input_stream_read_all_async() when available. */ +- /* TODO: Alternately, it would be nice to let the +- * FbMqttMessage directly use the GBufferedInputStream +- * buffer instead of copying it, provided it's consumed +- * before the next read. +- */ +- g_input_stream_read_async(G_INPUT_STREAM(priv->input), +- priv->rbuf->data, priv->rbuf->len, +- G_PRIORITY_DEFAULT, priv->cancellable, +- fb_mqtt_cb_read_packet, mqtt); + fb_mqtt_read(mqtt, msg); + g_object_unref(msg); - } ++ } } -@@ -578,16 +519,27 @@ + void +@@ -569,16 +514,27 @@ } static void @@ -371,7 +368,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c } void -@@ -596,7 +548,6 @@ +@@ -587,7 +543,6 @@ const GByteArray *bytes; FbMqttMessagePrivate *mriv; FbMqttPrivate *priv; @@ -379,7 +376,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c g_return_if_fail(FB_IS_MQTT(mqtt)); g_return_if_fail(FB_IS_MQTT_MESSAGE(msg)); -@@ -615,46 +566,46 @@ +@@ -606,46 +561,46 @@ "Writing %d (flags: 0x%0X)", mriv->type, mriv->flags); @@ -454,7 +451,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c } void -@@ -662,29 +613,20 @@ +@@ -653,29 +608,20 @@ { FbMqttPrivate *priv; PurpleAccount *acc; @@ -488,7 +485,7 @@ diff -r 56d191003b34 -r 5a63c26f21fd libpurple/protocols/facebook/mqtt.c fb_mqtt_timeout(mqtt); } -@@ -720,7 +662,7 @@ +@@ -711,7 +657,7 @@ g_return_val_if_fail(FB_IS_MQTT(mqtt), FALSE); priv = mqtt->priv; diff --git a/patches/05-revert-http-callbacks.patch b/patches/05-revert-http-callbacks.patch index 36d1d17..c648a7d 100644 --- a/patches/05-revert-http-callbacks.patch +++ b/patches/05-revert-http-callbacks.patch @@ -1,7 +1,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c --- a/libpurple/http.c +++ b/libpurple/http.c -@@ -486,11 +486,7 @@ purple_http_socket_connect_new_cb(GObjec +@@ -546,11 +546,7 @@ cb_data = g_object_steal_data(source, "cb_data"); if (conn == NULL) { @@ -14,7 +14,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c g_clear_error(&error); return; } -@@ -1162,10 +1158,8 @@ static gboolean _purple_http_recv_loopbo +@@ -1223,10 +1219,8 @@ &error); got_anything = (len > 0); @@ -27,7 +27,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c g_clear_error(&error); return FALSE; } -@@ -1450,10 +1444,8 @@ static gboolean _purple_http_send(GObjec +@@ -1511,10 +1505,8 @@ &error); } diff --git a/patches/07-revert-http-gio.patch b/patches/07-revert-http-gio.patch index 9bfb0d8..58370c5 100644 --- a/patches/07-revert-http-gio.patch +++ b/patches/07-revert-http-gio.patch @@ -1,16 +1,16 @@ diff --git a/libpurple/http.c b/libpurple/http.c --- a/libpurple/http.c +++ b/libpurple/http.c -@@ -28,7 +28,7 @@ +@@ -27,7 +27,7 @@ + #include "debug.h" - #include "ntlm.h" #include "proxy.h" -#include "purple-gio.h" +#include "purple-socket.h" - #include <zlib.h> - #ifndef z_const -@@ -57,15 +57,9 @@ typedef struct _PurpleHttpKeepaliveReque + #define PURPLE_HTTP_URL_CREDENTIALS_CHARS "a-z0-9.,~_/*!&%?=+\\^-" + #define PURPLE_HTTP_MAX_RECV_BUFFER_LEN 10240 +@@ -51,15 +51,9 @@ typedef struct _PurpleHttpGzStream PurpleHttpGzStream; @@ -27,7 +27,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c gboolean is_busy; guint use_count; -@@ -181,7 +175,7 @@ struct _PurpleHttpCookieJar +@@ -175,7 +169,7 @@ struct _PurpleHttpKeepaliveRequest { PurpleConnection *gc; @@ -36,7 +36,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c gpointer user_data; PurpleHttpKeepaliveHost *host; -@@ -253,7 +247,7 @@ gchar * purple_http_cookie_jar_dump(Purp +@@ -266,7 +260,7 @@ static PurpleHttpKeepaliveRequest * purple_http_keepalive_pool_request(PurpleHttpKeepalivePool *pool, PurpleConnection *gc, const gchar *host, int port, gboolean is_ssl, @@ -45,7 +45,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c static void purple_http_keepalive_pool_request_cancel(PurpleHttpKeepaliveRequest *req); static void -@@ -469,65 +463,23 @@ purple_http_socket_hash(const gchar *hos +@@ -529,65 +523,23 @@ return g_strdup_printf("%c:%s:%d", (is_ssl ? 'S' : 'R'), host, port); } @@ -88,13 +88,12 @@ diff --git a/libpurple/http.c b/libpurple/http.c - - client = purple_gio_socket_client_new( - purple_connection_get_account(gc), &error); -- ++ PurpleHttpSocket *hs = g_new0(PurpleHttpSocket, 1); + - if (client == NULL) { - purple_debug_error("http", "Error connecting to '%s:%d': %s", - host, port, error->message); - g_clear_error(&error); -+ PurpleHttpSocket *hs = g_new0(PurpleHttpSocket, 1); -+ + hs->ps = purple_socket_new(gc); + purple_socket_set_data(hs->ps, "hs", hs); + purple_socket_set_tls(hs->ps, is_ssl); @@ -122,7 +121,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c if (purple_debug_is_verbose()) purple_debug_misc("http", "new socket created: %p\n", hs); -@@ -543,26 +495,7 @@ purple_http_socket_close_free(PurpleHttp +@@ -603,26 +555,7 @@ if (purple_debug_is_verbose()) purple_debug_misc("http", "destroying socket: %p\n", hs); @@ -150,7 +149,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c g_free(hs); } -@@ -749,9 +682,10 @@ static void _purple_http_disconnect(Purp +@@ -809,9 +742,10 @@ gboolean is_graceful); static void _purple_http_gen_headers(PurpleHttpConnection *hc); @@ -164,7 +163,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c /* closes current connection (if exists), estabilishes one and proceeds with * request */ -@@ -1143,31 +1077,21 @@ static gboolean _purple_http_recv_body(P +@@ -1204,31 +1138,21 @@ return _purple_http_recv_body_data(hc, buf, len); } @@ -175,14 +174,13 @@ diff --git a/libpurple/http.c b/libpurple/http.c gchar buf[4096]; gboolean got_anything; - GError *error = NULL; -- + - len = g_pollable_input_stream_read_nonblocking( - G_POLLABLE_INPUT_STREAM( - g_io_stream_get_input_stream( - G_IO_STREAM(hc->socket->conn))), - buf, sizeof(buf), hc->socket->cancellable, - &error); -+ + len = purple_socket_read(hc->socket->ps, (guchar*)buf, sizeof(buf)); got_anything = (len > 0); @@ -201,7 +199,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c return FALSE; } -@@ -1346,13 +1270,11 @@ static gboolean _purple_http_recv_loopbo +@@ -1407,13 +1331,11 @@ return got_anything; } @@ -217,7 +215,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c } static void _purple_http_send_got_data(PurpleHttpConnection *hc, -@@ -1383,19 +1305,17 @@ static void _purple_http_send_got_data(P +@@ -1444,19 +1366,17 @@ hc->request->contents_length = estimated_length; } @@ -239,7 +237,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c _purple_http_gen_headers(hc); -@@ -1408,7 +1328,7 @@ static gboolean _purple_http_send(GObjec +@@ -1469,7 +1389,7 @@ hc->request_header_written; } else if (hc->request->contents_reader) { if (hc->contents_reader_requested) @@ -248,7 +246,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c if (!hc->contents_reader_buffer) hc->contents_reader_buffer = g_string_new(""); if (hc->contents_reader_buffer->len == 0) { -@@ -1421,7 +1341,7 @@ static gboolean _purple_http_send(GObjec +@@ -1482,7 +1402,7 @@ PURPLE_HTTP_MAX_READ_BUFFER_LEN, hc->request->contents_reader_data, _purple_http_send_got_data); @@ -257,7 +255,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c } write_from = hc->contents_reader_buffer->str; write_len = hc->contents_reader_buffer->len; -@@ -1436,19 +1356,12 @@ static gboolean _purple_http_send(GObjec +@@ -1497,19 +1417,12 @@ purple_debug_warning("http", "Nothing to write\n"); written = 0; } else { @@ -281,7 +279,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c if (written < 0) { if (hc->request_header_written == 0 && -@@ -1457,22 +1370,21 @@ static gboolean _purple_http_send(GObjec +@@ -1518,22 +1431,21 @@ purple_debug_info("http", "Keep-alive connection " "expired (when writing), retrying...\n"); purple_http_conn_retry(hc); @@ -310,7 +308,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c } else { hc->request_contents_written += written; purple_http_conn_notify_progress_watcher(hc); -@@ -1482,24 +1394,14 @@ static gboolean _purple_http_send(GObjec +@@ -1543,24 +1455,14 @@ hc->request_contents_written < (guint)hc->request->contents_length) { @@ -338,7 +336,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c } static void _purple_http_disconnect(PurpleHttpConnection *hc, -@@ -1524,10 +1426,13 @@ static void _purple_http_disconnect(Purp +@@ -1585,10 +1487,13 @@ } static void @@ -354,7 +352,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c hc->socket_request = NULL; hc->socket = hs; -@@ -1538,14 +1443,7 @@ static void +@@ -1599,14 +1504,7 @@ return; } @@ -370,7 +368,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c } static gboolean _purple_http_reconnect(PurpleHttpConnection *hc) -@@ -2257,7 +2155,7 @@ purple_http_keepalive_pool_unref(PurpleH +@@ -2318,7 +2216,7 @@ static PurpleHttpKeepaliveRequest * purple_http_keepalive_pool_request(PurpleHttpKeepalivePool *pool, PurpleConnection *gc, const gchar *host, int port, gboolean is_ssl, @@ -379,7 +377,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c { PurpleHttpKeepaliveRequest *req; PurpleHttpKeepaliveHost *kahost; -@@ -2300,15 +2198,19 @@ purple_http_keepalive_pool_request(Purpl +@@ -2361,15 +2259,19 @@ } static void @@ -401,7 +399,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c g_free(req); } -@@ -2364,7 +2266,7 @@ static gboolean +@@ -2425,7 +2327,7 @@ purple_http_keepalive_host_process_queue(host); @@ -410,7 +408,7 @@ diff --git a/libpurple/http.c b/libpurple/http.c g_free(req); return FALSE; -@@ -2435,16 +2337,7 @@ purple_http_keepalive_pool_release(Purpl +@@ -2496,16 +2398,7 @@ if (purple_debug_is_verbose()) purple_debug_misc("http", "releasing a socket: %p\n", hs); diff --git a/patches/08-revert-marshaller.patch b/patches/08-revert-marshaller.patch index f09b19b..1b06978 100644 --- a/patches/08-revert-marshaller.patch +++ b/patches/08-revert-marshaller.patch @@ -17,7 +17,9 @@ diff --git a/libpurple/protocols/facebook/Makefile.am b/libpurple/protocols/face data.c \ data.h \ facebook.h \ -@@ -30,6 +30,17 @@ +@@ -25,10 +28,21 @@ + ../../http.c \ + ../../http.h \ ../../purple-socket.h \ ../../purple-socket.c @@ -35,6 +37,8 @@ diff --git a/libpurple/protocols/facebook/Makefile.am b/libpurple/protocols/face AM_CFLAGS = $(st) libfacebook_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ + + if STATIC_FACEBOOK diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c --- a/libpurple/protocols/facebook/api.c +++ b/libpurple/protocols/facebook/api.c @@ -261,7 +265,9 @@ new file mode 100644 diff --git a/libpurple/protocols/facebook/mqtt.c b/libpurple/protocols/facebook/mqtt.c --- a/libpurple/protocols/facebook/mqtt.c +++ b/libpurple/protocols/facebook/mqtt.c -@@ -30,6 +30,7 @@ +@@ -28,10 +28,11 @@ + #include "account.h" + #include "eventloop.h" #include "glibcompat.h" #include "sslconn.h" @@ -269,7 +275,9 @@ diff --git a/libpurple/protocols/facebook/mqtt.c b/libpurple/protocols/facebook/ #include "mqtt.h" #include "util.h" -@@ -94,11 +95,12 @@ fb_mqtt_class_init(FbMqttClass *klass) + struct _FbMqttPrivate + { +@@ -92,11 +93,12 @@ */ g_signal_new("connect", G_TYPE_FROM_CLASS(klass), @@ -283,7 +291,7 @@ diff --git a/libpurple/protocols/facebook/mqtt.c b/libpurple/protocols/facebook/ /** * FbMqtt::error: -@@ -110,11 +112,12 @@ fb_mqtt_class_init(FbMqttClass *klass) +@@ -108,11 +110,12 @@ */ g_signal_new("error", G_TYPE_FROM_CLASS(klass), @@ -297,7 +305,7 @@ diff --git a/libpurple/protocols/facebook/mqtt.c b/libpurple/protocols/facebook/ /** * FbMqtt::open: -@@ -126,11 +129,12 @@ fb_mqtt_class_init(FbMqttClass *klass) +@@ -124,11 +127,12 @@ */ g_signal_new("open", G_TYPE_FROM_CLASS(klass), @@ -311,7 +319,7 @@ diff --git a/libpurple/protocols/facebook/mqtt.c b/libpurple/protocols/facebook/ /** * FbMqtt::publish: -@@ -142,11 +146,12 @@ fb_mqtt_class_init(FbMqttClass *klass) +@@ -140,11 +144,12 @@ */ g_signal_new("publish", G_TYPE_FROM_CLASS(klass), |