changeset 337:9f78fb6bfc76

gtkimhtml easily be fooled if the buffer is not entity markuped.
author Yoshiki Yazawa <[email protected]>
date Thu, 15 Oct 2009 15:49:12 +0900
parents 8de140bc8d13
children cdcfdf6a15fb
files main.c util.c util.h
diffstat 3 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Wed Oct 14 14:55:55 2009 +0900
+++ b/main.c	Thu Oct 15 15:49:12 2009 +0900
@@ -363,6 +363,7 @@
 
     gint service = get_service_type(conv);
     gchar *linkstr = NULL, *tmpstr = NULL;
+    gchar *escaped = NULL;
 
     /* check if the conversation is between twitter */
     if(service == unknown_service)
@@ -398,10 +399,24 @@
         }
     } /* send */
 
+
+    /* note:
+       link string needs stripped plain text.
+       displaying needs markup-escaped that text. */
+
     /* strip all markups */
-//    strip_markup(buffer, TRUE);
     strip_markup(buffer, FALSE);
 
+    /* make R F RT link string */
+    if(service == twitter_service)
+        linkstr = twitter_rip_link_string(buffer);
+
+    /* entity markup for displaying */
+    escaped = g_markup_escape_text(*buffer, -1);
+    g_free(*buffer);
+    *buffer = escaped;
+
+
     /* playsound */
     if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) {
         playsound(buffer, SENDER);
@@ -410,10 +425,6 @@
         playsound(buffer, RECIPIENT);
     }
 
-    /* make R F RT link */
-    if(service == twitter_service)
-        linkstr = twitter_make_link_string(buffer);
-
     /* translate */
     if(purple_prefs_get_bool(OPT_TRANSLATE_SENDER)) {
         if(service == ffeed_service)
--- a/util.c	Wed Oct 14 14:55:55 2009 +0900
+++ b/util.c	Thu Oct 15 15:49:12 2009 +0900
@@ -521,7 +521,7 @@
 }
 
 gchar *
-twitter_make_link_string(gchar **str)
+twitter_rip_link_string(gchar **str)
 {
     GMatchInfo *match_info = NULL;
     gchar *boddy0 = NULL, *boddy = NULL;
--- a/util.h	Wed Oct 14 14:55:55 2009 +0900
+++ b/util.h	Thu Oct 15 15:49:12 2009 +0900
@@ -5,7 +5,7 @@
 void strip_markup(gchar **str, gboolean escape);
 gchar *strip_html_markup(const gchar *src);
 gboolean ensure_path_exists(const char *dir);
-gchar *twitter_make_link_string(gchar **str);
+gchar *twitter_rip_link_string(gchar **str);
 
 gboolean is_twitter_conv(PurpleConversation *conv);
 gboolean is_wassr_account(PurpleAccount *account, const char *name);