X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-text-utils.c;h=59f5cac3c0121ef33896849f6bf78c17503d1717;hp=deb2971688832d6fcdbda925349c52984a7cb1a4;hb=0fbbf474b218d00f517fae83561a05f6919679e7;hpb=506d8ddd3ac4f45ad5fffb7d2ec83d306fc6f19b diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index deb2971..59f5cac 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -109,14 +109,14 @@ struct _url_match_t { /* note: match MARK_AMP_URI_STR as well, because after txt->html, a '&' will look like $(MARK_AMP_URI_STR)"amp;" */ #define MAIL_VIEWER_URL_MATCH_PATTERNS { \ - { "(file|rtsp|http|ftp|https|mms|mmsh|rtsp|rdp|lastfm)://[-a-z0-9_$.+!*(),;:@%=?/~#" MARK_AMP_URI_STR \ + { "(file|rtsp|http|ftp|https|mms|mmsh|webcal|feed|rtsp|rdp|lastfm)://[-a-z0-9_$.+!*(),;:@%=?/~#" MARK_AMP_URI_STR \ "]+[-a-z0-9_$%" MARK_AMP_URI_STR "=?/~#]", \ NULL, NULL },\ { "www\\.[-a-z0-9_$.+!*(),;:@%=?/~#" MARK_AMP_URI_STR "]+[-a-z0-9_$%" MARK_AMP_URI_STR "=?/~#]",\ NULL, "http://" }, \ { "ftp\\.[-a-z0-9_$.+!*(),;:@%=?/~#" MARK_AMP_URI_STR "]+[-a-z0-9_$%" MARK_AMP_URI_STR "=?/~#]",\ NULL, "ftp://" },\ - { "(jabberto|voipto|sipto|sip|chatto|xmpp):[-_a-z@0-9.+]+", \ + { "(jabberto|voipto|sipto|sip|chatto|skype|xmpp):[-_a-z@0-9.+]+", \ NULL, NULL}, \ { "mailto:[-_a-z0-9.\\+]+@[-_a-z0-9.]+", \ NULL, NULL},\ @@ -213,14 +213,17 @@ modest_text_utils_cite (const gchar *text, g_return_val_if_fail (text, NULL); g_return_val_if_fail (content_type, NULL); - if (!signature) - retval = g_strdup (""); - else if (strcmp(content_type, "text/html") == 0) { - tmp_sig = g_strconcat ("\n", SIGNATURE_MARKER,"\n", signature, NULL); - retval = modest_text_utils_convert_to_html_body(tmp_sig, -1, TRUE); + if (!signature) { + tmp_sig = g_strdup (text); + } else { + tmp_sig = g_strconcat (text, "\n", SIGNATURE_MARKER, "\n", signature, NULL); + } + + if (strcmp (content_type, "text/html") == 0) { + retval = modest_text_utils_convert_to_html_body (tmp_sig, -1, TRUE); g_free (tmp_sig); } else { - retval = g_strconcat (text, "\n", SIGNATURE_MARKER, "\n", signature, NULL); + retval = tmp_sig; } return retval; @@ -1247,14 +1250,16 @@ modest_text_utils_get_display_address (gchar *address) for (i = 0; address[i]; ++i) { if (address[i] == '<') { - if (G_UNLIKELY(i == 0)) - return; /* there's nothing else, leave it */ - else { + if (G_UNLIKELY(i == 0)) { + break; /* there's nothing else, leave it */ + }else { address[i] = '\0'; /* terminate the string here */ - return; + break; } } } + + g_strchomp (address); } @@ -1656,19 +1661,19 @@ modest_text_utils_get_display_size (guint64 size) const guint GB=1024 * MB; if (size == 0) - return g_strdup_printf (_FM("sfil_li_size_kb")); + return g_strdup_printf (_FM("sfil_li_size_kb"), (int) 0); if (0 <= size && size < KB) - return g_strdup_printf (_FM("sfil_li_size_1kb_99kb"), 1); + return g_strdup_printf (_FM("sfil_li_size_1kb_99kb"), (int) 1); else if (KB <= size && size < 100 * KB) - return g_strdup_printf (_FM("sfil_li_size_1kb_99kb"), size / KB); + return g_strdup_printf (_FM("sfil_li_size_1kb_99kb"), (int) size / KB); else if (100*KB <= size && size < MB) return g_strdup_printf (_FM("sfil_li_size_100kb_1mb"), (float) size / MB); else if (MB <= size && size < 10*MB) return g_strdup_printf (_FM("sfil_li_size_1mb_10mb"), (float) size / MB); else if (10*MB <= size && size < GB) - return g_strdup_printf (_FM("sfil_li_size_10mb_1gb"), size / MB); + return g_strdup_printf (_FM("sfil_li_size_10mb_1gb"), (int) size / MB); else - return g_strdup_printf (_FM("sfil_li_size_1gb_or_greater"), (float) size / GB); + return g_strdup_printf (_FM("sfil_li_size_1gb_or_greater"), (float) size / GB); } static gchar * @@ -1685,11 +1690,11 @@ get_email_from_address (const gchar * address) return g_strndup (left_limit + 1, (right_limit - left_limit) - 1); } -gchar * +gchar * modest_text_utils_get_color_string (GdkColor *color) { g_return_val_if_fail (color, NULL); - + return g_strdup_printf ("#%x%x%x%x%x%x%x%x%x%x%x%x", (color->red >> 12) & 0xf, (color->red >> 8) & 0xf, (color->red >> 4) & 0xf, (color->red) & 0xf,