From: Jose Dapena Paz Date: Thu, 14 Jun 2007 10:36:29 +0000 (+0000) Subject: * src/modest-text-utils.c: X-Git-Tag: git_migration_finished~3287 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=6c4f7f26cf46e833b9d32a69555880900b16a4ef * src/modest-text-utils.c: * Now _quote functions add signature to the end if available (fixes NB#58181). pmo-trunk-r2225 --- diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index d1cc2f6..07ae71c 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -100,10 +100,12 @@ static int get_breakpoint (const gchar * s, const gint indent, con static gchar* modest_text_utils_quote_plain_text (const gchar *text, const gchar *cite, + const gchar *signature, int limit); static gchar* modest_text_utils_quote_html (const gchar *text, - const gchar *cite, + const gchar *cite, + const gchar *signature, int limit); static gchar* get_email_from_address (const gchar *address); @@ -130,9 +132,9 @@ modest_text_utils_quote (const gchar *text, if (content_type && strcmp (content_type, "text/html") == 0) /* TODO: extract the of the HTML and pass it to the function */ - retval = modest_text_utils_quote_html (text, cited, limit); + retval = modest_text_utils_quote_html (text, cited, signature, limit); else - retval = modest_text_utils_quote_plain_text (text, cited, limit); + retval = modest_text_utils_quote_plain_text (text, cited, signature, limit); g_free (cited); @@ -690,6 +692,7 @@ cite (const time_t sent_date, const gchar *from) static gchar * modest_text_utils_quote_plain_text (const gchar *text, const gchar *cite, + const gchar *signature, int limit) { const gchar *iter; @@ -741,24 +744,44 @@ modest_text_utils_quote_plain_text (const gchar *text, g_string_free (l, TRUE); } while ((iter < text + len) || (remaining->str[0])); + if (signature != NULL) { + q = g_string_append_c (q, '\n'); + q = g_string_append (q, signature); + } + return g_string_free (q, FALSE); } static gchar* modest_text_utils_quote_html (const gchar *text, const gchar *cite, + const gchar *signature, int limit) { + gchar *result = NULL; + gchar *signature_result = NULL; const gchar *format = \ "\n" \ "\n" \ "\n" \ "%s" \ "
\n%s\n
\n" \ + "%s" \ "\n" \ "\n"; + const gchar *signature_format = \ + "
\n" \
+		"%s\n" \
+		"
"; + + if (signature == NULL) + signature_result = g_strdup (""); + else + signature_result = g_strdup_printf (signature_format, signature); - return g_strdup_printf (format, cite, text); + result = g_strdup_printf (format, cite, text, signature_result); + g_free (signature_result); + return result; } static gint