diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-06-26 16:47:31 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-06-26 16:47:31 +0800 |
commit | dc44f6dd6245befd9e9e44ac77bb879725f7c3fc (patch) | |
tree | 280460208520a74f02c358952b15f2aa4245b82c /libempathy-gtk/empathy-log-window.c | |
parent | e80012b79bb56bbb7d4616f58b5509775e0e355f (diff) | |
parent | 6bace22f3ffb9695870267e2a59858b3feeaa83e (diff) | |
download | gsoc2013-empathy-dc44f6dd6245befd9e9e44ac77bb879725f7c3fc.tar gsoc2013-empathy-dc44f6dd6245befd9e9e44ac77bb879725f7c3fc.tar.gz gsoc2013-empathy-dc44f6dd6245befd9e9e44ac77bb879725f7c3fc.tar.bz2 gsoc2013-empathy-dc44f6dd6245befd9e9e44ac77bb879725f7c3fc.tar.lz gsoc2013-empathy-dc44f6dd6245befd9e9e44ac77bb879725f7c3fc.tar.xz gsoc2013-empathy-dc44f6dd6245befd9e9e44ac77bb879725f7c3fc.tar.zst gsoc2013-empathy-dc44f6dd6245befd9e9e44ac77bb879725f7c3fc.zip |
Merge branch 'gnome-3-8'
Diffstat (limited to 'libempathy-gtk/empathy-log-window.c')
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 4eb44c9b3..a815c45fe 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -354,7 +354,9 @@ insert_or_change_row (EmpathyLogWindow *self, { char *str = gtk_tree_path_to_string (path); char *script, *text, *date, *stock_icon; + GString *escaped_text; char *icon = NULL; + gint i; gtk_tree_model_get (model, iter, COL_EVENTS_TEXT, &text, @@ -375,16 +377,34 @@ insert_or_change_row (EmpathyLogWindow *self, gtk_icon_info_free (icon_info); } + escaped_text = g_string_new (NULL); + + /* Only need to deal with «'» and «\». + * + * Note that these never appear in non-ascii utf8 characters, so just + * pretend like we have an ascii string... + */ + for (i = 0; text && text[i]; i++) + { + gchar c = text[i]; + + if (c == '\'' || c == '\\') + g_string_append_c (escaped_text, '\\'); + + g_string_append_c (escaped_text, c); + } + script = g_strdup_printf ("javascript:%s([%s], '%s', '%s', '%s');", method, g_strdelimit (str, ":", ','), - text, + escaped_text->str, icon != NULL ? icon : "", date); webkit_web_view_execute_script (WEBKIT_WEB_VIEW (self->priv->webview), script); + g_string_free (escaped_text, TRUE); g_free (str); g_free (text); g_free (date); |