[evolution/webkit: 146/196] Backport master/63eba7c3 after rebase
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 146/196] Backport master/63eba7c3 after rebase
- Date: Tue, 27 Mar 2012 16:12:59 +0000 (UTC)
commit 4af77da7c5500bcb946eabe80166a55f5f2db249
Author: Dan VrÃtil <dvratil redhat com>
Date: Thu Feb 9 15:17:47 2012 +0100
Backport master/63eba7c3 after rebase
em-format/em-format.c | 1 +
mail/em-format-html-display.c | 2 +-
mail/em-format-html.c | 75 +++++++++++++++++++++++------------------
mail/em-format-html.h | 5 ++-
4 files changed, 47 insertions(+), 36 deletions(-)
---
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 0779e47..4ceb051 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -517,6 +517,7 @@ emf_parse_multipart_encrypted (EMFormat *emf,
if (info->validity)
camel_cipher_validity_envelope (valid, info->validity);
+
encinfo.validity = valid;
g_string_append (part_id, ".encrypted");
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 6da565b..d10f151 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -672,7 +672,7 @@ efhd_parse_secure (EMFormat *emf,
g_string_append (buffer, gettext (desc));
em_format_html_format_cert_infos (
- (CamelCipherCertInfo *) info->validity->sign.signers.head);
+ &info->validity->sign.signers, buffer);
}
if (info->validity->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 3891041..b6efb7b 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -1755,49 +1755,58 @@ em_format_html_file_part (EMFormatHTML *efh,
return part;
}
-gchar *
-em_format_html_format_cert_infos (CamelCipherCertInfo *first_cinfo)
+void
+em_format_html_format_cert_infos (GQueue *cert_infos,
+ GString *output_buffer)
{
- GString *res = NULL;
- CamelCipherCertInfo *cinfo;
-
- if (!first_cinfo)
- return NULL;
+ GQueue valid = G_QUEUE_INIT;
+ GList *head, *link;
+
+ g_return_if_fail (cert_infos != NULL);
+ g_return_if_fail (output_buffer != NULL);
+
+ head = g_queue_peek_head_link (cert_infos);
+
+ /* Make sure we have a valid CamelCipherCertInfo before
+ * appending anything to the output buffer, so we don't
+ * end up with "()". */
+ for (link = head; link != NULL; link = g_list_next (link)) {
+ CamelCipherCertInfo *cinfo = link->data;
+
+ if ((cinfo->name != NULL && *cinfo->name != '\0') ||
+ (cinfo->email != NULL && *cinfo->email != '\0')) {
+ g_queue_push_tail (&valid, cinfo);
+ }
+ }
+
+ if (g_queue_is_empty (&valid))
+ return;
- #define append(x) G_STMT_START { \
- if (!res) { \
- res = g_string_new (x); \
- } else { \
- g_string_append (res, x); \
- } \
- } G_STMT_END
+ g_string_append (output_buffer, " (");
- for (cinfo = first_cinfo; cinfo && cinfo->next; cinfo = cinfo->next) {
- if (!cinfo->name && !cinfo->email)
- continue;
+ while (!g_queue_is_empty (&valid)) {
+ CamelCipherCertInfo *cinfo;
- if (res)
- append (", ");
+ cinfo = g_queue_pop_head (&valid);
- if (cinfo->name && *cinfo->name) {
- append (cinfo->name);
+ if (cinfo->name != NULL && *cinfo->name != '\0') {
+ g_string_append (output_buffer, cinfo->name);
- if (cinfo->email && *cinfo->email) {
- append (" <");
- append (cinfo->email);
- append (">");
+ if (cinfo->email != NULL && *cinfo->email != '\0') {
+ g_string_append (output_buffer, " <");
+ g_string_append (output_buffer, cinfo->email);
+ g_string_append (output_buffer, ">");
}
- } else if (cinfo->email && *cinfo->email) {
- append (cinfo->email);
- }
- }
- #undef append
+ } else if (cinfo->email != NULL && *cinfo->email != '\0') {
+ g_string_append (output_buffer, cinfo->email);
+ }
- if (!res)
- return NULL;
+ if (!g_queue_is_empty (&valid))
+ g_string_append (output_buffer, ", ");
+ }
- return g_string_free (res, FALSE);
+ g_string_append_c (output_buffer, ')');
}
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index 689167f..008e488 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -181,8 +181,9 @@ CamelMimePart * em_format_html_file_part (EMFormatHTML *efh,
const gchar *filename,
GCancellable *cancellable);
-gchar * em_format_html_format_cert_infos
- (CamelCipherCertInfo *first_cinfo);
+void em_format_html_format_cert_infos
+ (GQueue *cert_infos,
+ GString *output_buffer);
void em_format_html_format_message (EMFormatHTML *efh,
CamelStream *stream,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]