summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkajzer <[email protected]>2016-09-09 18:35:48 +0200
committerkajzer <[email protected]>2016-09-09 18:35:48 +0200
commita550bac7a423943b79b98c322d665cef6f16e759 (patch)
treea30b2df0aac94438f9108d326f020ed5376f5759
parent23153c2e82294cda4f3f7db2053186da8581e19a (diff)
downloadmate-notification-daemon-a550bac7a423943b79b98c322d665cef6f16e759.tar.bz2
mate-notification-daemon-a550bac7a423943b79b98c322d665cef6f16e759.tar.xz
Fix: properly escape text
-rw-r--r--src/themes/coco/coco-theme.c14
-rw-r--r--src/themes/nodoka/nodoka-theme.c14
-rw-r--r--src/themes/slider/theme.c13
-rw-r--r--src/themes/standard/theme.c13
4 files changed, 40 insertions, 14 deletions
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c
index ca742b4..c1fa929 100644
--- a/src/themes/coco/coco-theme.c
+++ b/src/themes/coco/coco-theme.c
@@ -506,10 +506,16 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);
- quoted = g_markup_escape_text(body, -1);
- str = g_strdup_printf(
- "<span color=\"#EAEAEA\">%s</span>", quoted);
- g_free(quoted);
+ if (strstr(body, "&amp;") || strstr(body, "&lt;") || strstr(body, "&gt;") || strstr(body, "&apos;") || strstr(body, "&quot;"))
+ {
+ str = g_strdup_printf("<span color=\"#EAEAEA\">%s</span>", body);
+ }
+ else
+ {
+ quoted = g_markup_escape_text(body, -1);
+ str = g_strdup_printf("<span color=\"#EAEAEA\">%s</span>", quoted);
+ g_free(quoted);
+ }
gtk_label_set_markup (GTK_LABEL (windata->body_label), str);
g_free(str);
diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c
index 628a415..dcb8449 100644
--- a/src/themes/nodoka/nodoka-theme.c
+++ b/src/themes/nodoka/nodoka-theme.c
@@ -891,10 +891,16 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);
- quoted = g_markup_escape_text(body, -1);
- str = g_strdup_printf(
- "<span color=\"#000000\">%s</span>", quoted);
- g_free(quoted);
+ if (strstr(body, "&amp;") || strstr(body, "&lt;") || strstr(body, "&gt;") || strstr(body, "&apos;") || strstr(body, "&quot;"))
+ {
+ str = g_strdup_printf("<span color=\"#000000\">%s</span>", body);
+ }
+ else
+ {
+ quoted = g_markup_escape_text(body, -1);
+ str = g_strdup_printf("<span color=\"#000000\">%s</span>", quoted);
+ g_free(quoted);
+ }
gtk_label_set_markup(GTK_LABEL(windata->body_label), str);
g_free(str);
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index 86440b0..cf4724a 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -513,9 +513,16 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);
- quoted = g_markup_escape_text(body, -1);
- gtk_label_set_markup(GTK_LABEL(windata->body_label), quoted);
- g_free(quoted);
+ if (strstr(body, "&amp;") || strstr(body, "&lt;") || strstr(body, "&gt;") || strstr(body, "&apos;") || strstr(body, "&quot;"))
+ {
+ gtk_label_set_markup(GTK_LABEL(windata->body_label), body);
+ }
+ else
+ {
+ quoted = g_markup_escape_text(body, -1);
+ gtk_label_set_markup(GTK_LABEL(windata->body_label), quoted);
+ g_free(quoted);
+ }
if (body == NULL || *body == '\0')
{
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index ba44fcd..f13d174 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -857,9 +857,16 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);
- quoted = g_markup_escape_text(body, -1);
- gtk_label_set_markup(GTK_LABEL(windata->body_label), quoted);
- g_free(quoted);
+ if (strstr(body, "&amp;") || strstr(body, "&lt;") || strstr(body, "&gt;") || strstr(body, "&apos;") || strstr(body, "&quot;"))
+ {
+ gtk_label_set_markup(GTK_LABEL(windata->body_label), body);
+ }
+ else
+ {
+ quoted = g_markup_escape_text(body, -1);
+ gtk_label_set_markup(GTK_LABEL(windata->body_label), quoted);
+ g_free(quoted);
+ }
if (body == NULL || *body == '\0')
{