126 lines
3.7 KiB
Plaintext
126 lines
3.7 KiB
Plaintext
$OpenBSD: patch-src_e-mail-formatter-evolution-rss_c,v 1.5 2019/01/02 13:07:49 ajacoutot Exp $
|
|
|
|
From 7741ef0cf3327cb5c719912358443b6aef3bdb59 Mon Sep 17 00:00:00 2001
|
|
From: Milan Crha <mcrha@redhat.com>
|
|
Date: Wed, 17 Aug 2016 18:43:48 +0200
|
|
Subject: Adapt to changes in evolution 3.21.90
|
|
|
|
From fc88879852be20917ba1c1923ab77c8b5bc868ed Mon Sep 17 00:00:00 2001
|
|
From: Milan Crha <mcrha@redhat.com>
|
|
Date: Wed, 10 Oct 2018 14:12:42 +0200
|
|
Subject: [PATCH] Avoid crash when feed formatting is cancelled
|
|
|
|
Index: src/e-mail-formatter-evolution-rss.c
|
|
--- src/e-mail-formatter-evolution-rss.c.orig
|
|
+++ src/e-mail-formatter-evolution-rss.c
|
|
@@ -52,6 +52,7 @@ G_DEFINE_DYNAMIC_TYPE (
|
|
|
|
static const gchar* rss_formatter_mime_types[] = { "x-evolution/evolution-rss-feed", NULL };
|
|
|
|
+#if EVOLUTION_VERSION < 32190
|
|
static void
|
|
set_view_cb (GtkWidget *button,
|
|
gpointer *data)
|
|
@@ -60,6 +61,8 @@ set_view_cb (GtkWidget *button,
|
|
rss_set_changed_view(1);
|
|
e_mail_display_reload (rss_get_display());
|
|
}
|
|
+#endif
|
|
+
|
|
#include "fetch.h"
|
|
|
|
typedef struct _HD HD;
|
|
@@ -132,7 +135,11 @@ emfe_evolution_rss_format (EMailFormatterExtension *ex
|
|
if (!rss_init)
|
|
goto fail;
|
|
|
|
+#if EVOLUTION_VERSION >= 32190
|
|
+ h = e_web_view_get_content_html_sync (E_WEB_VIEW (rss_get_display()), NULL, NULL);
|
|
+#else
|
|
h = g_strdup(e_web_view_get_html (E_WEB_VIEW (rss_get_display())));
|
|
+#endif
|
|
|
|
website = (gchar *)camel_medium_get_header (
|
|
CAMEL_MEDIUM (message), "Website");
|
|
@@ -232,6 +239,11 @@ emfe_evolution_rss_format (EMailFormatterExtension *ex
|
|
strlen(str), NULL, cancellable, NULL);
|
|
#endif
|
|
|
|
+ g_free (str);
|
|
+
|
|
+ if (g_cancellable_is_cancelled (cancellable))
|
|
+ goto fail;
|
|
+
|
|
#if EVOLUTION_VERSION < 31191
|
|
decoded_stream = camel_stream_mem_new ();
|
|
#else
|
|
@@ -241,6 +253,11 @@ emfe_evolution_rss_format (EMailFormatterExtension *ex
|
|
e_mail_formatter_format_text (
|
|
formatter, part, decoded_stream, cancellable);
|
|
|
|
+ if (g_cancellable_is_cancelled (cancellable)) {
|
|
+ g_clear_object (&decoded_stream);
|
|
+ goto fail;
|
|
+ }
|
|
+
|
|
#if EVOLUTION_VERSION < 31191
|
|
g_seekable_seek (G_SEEKABLE (decoded_stream), 0, G_SEEK_SET, cancellable, NULL);
|
|
|
|
@@ -253,6 +270,11 @@ emfe_evolution_rss_format (EMailFormatterExtension *ex
|
|
G_MEMORY_OUTPUT_STREAM (decoded_stream));
|
|
src = rss_process_feed((gchar *)data, len);
|
|
#endif
|
|
+ if (g_cancellable_is_cancelled (cancellable) || !src) {
|
|
+ g_clear_object (&decoded_stream);
|
|
+ g_free (src);
|
|
+ goto fail;
|
|
+ }
|
|
#if EVOLUTION_VERSION < 30304
|
|
GConfClient *client = gconf_client_get_default();
|
|
#else
|
|
@@ -306,6 +328,8 @@ emfe_evolution_rss_format (EMailFormatterExtension *ex
|
|
g_free(tstr);
|
|
}
|
|
#endif
|
|
+ if (g_cancellable_is_cancelled (cancellable))
|
|
+ goto fail;
|
|
} else {
|
|
GString *content;
|
|
GError *err = NULL;
|
|
@@ -348,6 +372,10 @@ emfe_evolution_rss_format (EMailFormatterExtension *ex
|
|
}
|
|
#endif
|
|
g_free (str);
|
|
+
|
|
+ if (g_cancellable_is_cancelled (cancellable))
|
|
+ goto fail;
|
|
+
|
|
goto success;
|
|
}
|
|
|
|
@@ -375,6 +403,7 @@ e_mail_formatter_evolution_rss_type_register (GTypeMod
|
|
e_mail_formatter_evolution_rss_register_type (type_module);
|
|
}
|
|
|
|
+#if EVOLUTION_VERSION < 32190
|
|
static GtkWidget *
|
|
emfe_evolution_rss_get_widget (EMailFormatterExtension *extension,
|
|
EMailPartList *context,
|
|
@@ -399,13 +428,16 @@ emfe_evolution_rss_get_widget (EMailFormatterExtension
|
|
gtk_widget_show(box);
|
|
return box;
|
|
}
|
|
+#endif
|
|
|
|
static void
|
|
e_mail_formatter_evolution_rss_class_init (EMailFormatterExtensionClass *class)
|
|
{
|
|
class->mime_types = rss_formatter_mime_types;
|
|
class->format = emfe_evolution_rss_format;
|
|
+#if EVOLUTION_VERSION < 32190
|
|
class->get_widget = emfe_evolution_rss_get_widget;
|
|
+#endif
|
|
class->display_name = _("Evolution-RSS");
|
|
class->description = _("Displaying RSS feed articles");
|
|
}
|