[balsa/threading] libbalsa/information: Use g_markup_escape_text
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/threading] libbalsa/information: Use g_markup_escape_text
- Date: Fri, 14 Sep 2018 20:57:32 +0000 (UTC)
commit e527baa21c09f2077f78a64d5dbfa5008681daab
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Fri Sep 14 16:52:55 2018 -0400
libbalsa/information: Use g_markup_escape_text
* libbalsa/information.c (libbalsa_information_varg): use
g_markup_escape_text to entity-escape the body of a
GNotification, instead of our home-brewed non-UTF8-safe version.
ChangeLog | 14 ++++++++++++++
libbalsa/information.c | 32 ++++++--------------------------
2 files changed, 20 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index deb9225e2..a7293c8e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2018-09-14 Peter Bloomfield <pbloomfield bellsouth net>
+
+ * libbalsa/information.c (libbalsa_information_varg): use
+ g_markup_escape_text to entity-escape the body of a
+ GNotification, instead of our home-brewed non-UTF8-safe version.
+
+2018-09-05 Albrecht Dreß <albrecht dress arcor de>
+
+ Fix crash listing S/MIME certificates
+
+ * libbalsa/gmime-gpgme-signature.c
+ (libbalsa_cert_subject_readable): restore a missing termination
+ check.
+
2018-08-29 Albrecht Dreß <albrecht dress arcor de>
Move single IMAP mailboxes to folders
diff --git a/libbalsa/information.c b/libbalsa/information.c
index 7fdc5e83f..2cb339bf1 100644
--- a/libbalsa/information.c
+++ b/libbalsa/information.c
@@ -41,8 +41,8 @@ void
libbalsa_information_varg(GtkWindow *parent, LibBalsaInformationType type,
const char *fmt, va_list ap)
{
- gchar *msg, *p, *q;
- GString *escaped;
+ gchar *msg;
+ gchar *escaped;
const gchar *icon_str;
GIcon *icon;
gboolean send;
@@ -74,32 +74,12 @@ libbalsa_information_varg(GtkWindow *parent, LibBalsaInformationType type,
msg = g_strdup_vprintf(fmt, ap);
/* GNotification uses HTML markup (???), so we must replace '<' and
* '&' with the corresponding entity in the message string. */
- escaped = g_string_new(NULL);
- for (p = msg; (q = strpbrk(p, "<>&\"")) != NULL; p = ++q) {
- g_string_append_len(escaped, p, q - p);
- switch (*q) {
- case '<':
- g_string_append(escaped, "<");
- break;
- case '>':
- g_string_append(escaped, ">");
- break;
- case '&':
- g_string_append(escaped, "&");
- break;
- case '"':
- g_string_append(escaped, """);
- break;
- default:
- break;
- }
- }
- g_string_append(escaped, p);
+ escaped = g_markup_escape_text(msg, -1);
g_free(msg);
- g_notification_set_body(notification, escaped->str);
- send = *escaped->str != '\0';
- g_string_free(escaped, TRUE);
+ g_notification_set_body(notification, escaped);
+ send = escaped[0] != '\0';
+ g_free(escaped);
g_object_set_data(G_OBJECT(notification), "send", GINT_TO_POINTER(send));
g_signal_emit_by_name(notification, "notify", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]