diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 00:37:48 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 00:37:48 +0800 |
commit | 84e30dab1428affe335ef904377d07f8b5fdeb66 (patch) | |
tree | fee9c8ec124a2b5804f6bb4ee31772db56a6e374 /libempathy-gtk/empathy-theme-adium.c | |
parent | fd8e9c5dc2584055177c7a79021cdd53ca431c22 (diff) | |
parent | 3803736b4326d4bc00d58ccd25f910907f0b4521 (diff) | |
download | gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.gz gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.bz2 gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.lz gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.xz gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.zst gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.zip |
Merge back from master
Diffstat (limited to 'libempathy-gtk/empathy-theme-adium.c')
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 2889aa304..e1094f1be 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -298,33 +298,6 @@ theme_adium_parse_body (EmpathyThemeAdium *theme, EMPATHY_PREFS_CHAT_SHOW_SMILEYS, &use_smileys); - if (use_smileys) { - /* Replace smileys by a <img/> tag */ - string = g_string_sized_new (strlen (text)); - smileys = empathy_smiley_manager_parse (priv->smiley_manager, text); - for (l = smileys; l; l = l->next) { - EmpathySmiley *smiley; - - smiley = l->data; - if (smiley->path) { - g_string_append_printf (string, - "<abbr title='%s'><img src=\"%s\"/ alt=\"%s\"/></abbr>", - smiley->str, smiley->path, smiley->str); - } else { - gchar *str; - - str = g_markup_escape_text (smiley->str, -1); - g_string_append (string, str); - g_free (str); - } - empathy_smiley_free (smiley); - } - g_slist_free (smileys); - - g_free (ret); - text = ret = g_string_free (string, FALSE); - } - /* Add <a href></a> arround links */ uri_regex = empathy_uri_regex_dup_singleton (); match = g_regex_match (uri_regex, text, 0, &match_info); @@ -334,6 +307,8 @@ theme_adium_parse_body (EmpathyThemeAdium *theme, string = g_string_sized_new (strlen (text)); do { + gchar *real_url; + g_match_info_fetch_pos (match_info, 0, &s, &e); if (s > last) { @@ -343,12 +318,15 @@ theme_adium_parse_body (EmpathyThemeAdium *theme, } /* Append the link inside <a href=""></a> tag */ + real_url = empathy_make_absolute_url (text + s); + g_string_append (string, "<a href=\""); - g_string_append_len (string, text + s, e - s); + g_string_append (string, real_url); g_string_append (string, "\">"); g_string_append_len (string, text + s, e - s); g_string_append (string, "</a>"); + g_free (real_url); last = e; } while (g_match_info_next (match_info, NULL)); @@ -359,7 +337,33 @@ theme_adium_parse_body (EmpathyThemeAdium *theme, g_free (ret); text = ret = g_string_free (string, FALSE); + } else if (use_smileys) { + /* Replace smileys by a <img/> tag */ + string = g_string_sized_new (strlen (text)); + smileys = empathy_smiley_manager_parse (priv->smiley_manager, text); + for (l = smileys; l; l = l->next) { + EmpathySmiley *smiley; + + smiley = l->data; + if (smiley->path) { + g_string_append_printf (string, + "<abbr title='%s'><img src=\"%s\"/ alt=\"%s\"/></abbr>", + smiley->str, smiley->path, smiley->str); + } else { + gchar *str; + + str = g_markup_escape_text (smiley->str, -1); + g_string_append (string, str); + g_free (str); + } + empathy_smiley_free (smiley); + } + g_slist_free (smileys); + + g_free (ret); + text = ret = g_string_free (string, FALSE); } + g_match_info_free (match_info); g_regex_unref (uri_regex); |