]> git.0d.be Git - empathy.git/commitdiff
Merge branch 'gnome-3-8'
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 26 Jun 2013 08:47:31 +0000 (10:47 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 26 Jun 2013 08:47:31 +0000 (10:47 +0200)
1  2 
libempathy-gtk/empathy-log-window.c

index 4eb44c9b35977e3951d4b105c459f254ad2f8f50,471d80c5fe44b18f2c7233b1b382c0c13ae5aa44..a815c45fe870564ddbeb0823c32b8e25ede5481d
   */
  
  #include "config.h"
 +#include "empathy-log-window.h"
  
  #include <glib/gi18n-lib.h>
 -#include <webkit/webkit.h>
 -
  #include <telepathy-glib/proxy-subclass.h>
  
 -#include <extensions/extensions.h>
 -
 -#include <libempathy/action-chain-internal.h>
 -#include <libempathy/empathy-camera-monitor.h>
 -#include <libempathy/empathy-gsettings.h>
 -#include <libempathy/empathy-request-util.h>
 -#include <libempathy/empathy-utils.h>
 -
 -#include "empathy-log-window.h"
 +#include "action-chain-internal.h"
  #include "empathy-account-chooser.h"
  #include "empathy-call-utils.h"
 -#include "empathy-individual-information-dialog.h"
 +#include "empathy-camera-monitor.h"
 +#include "empathy-geometry.h"
 +#include "empathy-gsettings.h"
  #include "empathy-images.h"
 +#include "empathy-individual-information-dialog.h"
 +#include "empathy-request-util.h"
  #include "empathy-theme-manager.h"
  #include "empathy-ui-utils.h"
 +#include "empathy-utils.h"
  #include "empathy-webkit-utils.h"
 -#include "empathy-geometry.h"
 +#include "extensions.h"
  
  #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 -#include <libempathy/empathy-debug.h>
 +#include "empathy-debug.h"
  
  #define EMPATHY_NS "http://live.gnome.org/Empathy"
  
@@@ -354,7 -358,9 +354,9 @@@ insert_or_change_row (EmpathyLogWindow 
  {
    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,
        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);