[balsa] Improve replying to html-only messages
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Improve replying to html-only messages
- Date: Sun, 21 Jan 2018 19:58:13 +0000 (UTC)
commit 873aed72e837d0c111bf57bfc2f9f007299cfedd
Author: Albrecht Dreß <albrecht dress arcor de>
Date: Sat Jan 20 17:36:46 2018 -0500
Improve replying to html-only messages
* configure.ac: check if the selected conversion tool
accepts “--unicode-snob”.
* libbalsa/html.c (html2text): run the conversion tool
with “--unicode-snob” if supported.
Signed-off-by: Peter Bloomfield <PeterBloomfield bellsouth net>
ChangeLog | 9 +++++++++
configure.ac | 10 ++++++++++
libbalsa/html.c | 13 ++++++++++---
3 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b1211ba..8282951 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-01-20 Albrecht Dreß <albrecht dress arcor de>
+
+ Improve replying to html-only messages
+
+ * configure.ac: check if the selected conversion tool
+ accepts “--unicode-snob”.
+ * libbalsa/html.c (html2text): run the conversion tool
+ with “--unicode-snob” if supported.
+
2018-01-20 Peter Bloomfield <pbloomfield bellsouth net>
Meson build system changes to mirror the autotools changes in
diff --git a/configure.ac b/configure.ac
index 7face56..cef6d27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -316,6 +316,16 @@ case "$use_html_widget" in
if test x"$HTML2TEXT" != "xno" ; then
AC_DEFINE_UNQUOTED(HTML2TEXT, "$HTML2TEXT",
[Path to html2text program.])
+ AC_MSG_CHECKING([whether $HTML2TEXT accepts the --unicode-snob option])
+ echo "<html/>" > conftest.htm
+ $HTML2TEXT --unicode-snob conftest.htm > /dev/null 2>&1
+ if test $? = 0 ; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HTML2TEXT_UCOPT,1,[Defined when $HTML2TEXT accepts the
--unicode-snob option.])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ rm -f conftest.htm
else
AC_MSG_WARN([You cannot properly quote html-only messags.])
fi
diff --git a/libbalsa/html.c b/libbalsa/html.c
index 353d017..0c2cbae 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -84,7 +84,7 @@ lbh_get_body_content(LibBalsaMessageBody * body, gchar ** buf)
static void
html2text(gchar ** text, gsize len)
{
- gchar *html2text[] = { HTML2TEXT, NULL, NULL };
+ gchar *html2text[] = { HTML2TEXT, NULL, NULL, NULL };
GFile *html_data;
GFileIOStream *stream;
GError *err = NULL;
@@ -98,16 +98,23 @@ html2text(gchar ** text, gsize len)
if (g_output_stream_write_all(ostream, *text, len,
&bytes_written, NULL, &err)) {
gchar *result = NULL;
+ gint pathidx;
g_output_stream_flush(ostream, NULL, NULL);
- html2text[1] = g_file_get_path(html_data);
+#if defined(HTML2TEXT_UCOPT)
+ html2text[1] = "--unicode-snob";
+ pathidx = 2;
+#else
+ pathidx = 1;
+#endif
+ html2text[pathidx] = g_file_get_path(html_data);
if (g_spawn_sync(NULL, html2text, NULL,
G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL,
&result, NULL, NULL, &err)) {
g_free(*text);
*text = result;
}
- g_free(html2text[1]);
+ g_free(html2text[pathidx]);
}
g_output_stream_close(ostream, NULL, NULL);
g_object_unref(G_OBJECT(stream));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]