aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew W. S. Bell <matthew@bells23.org.uk>2009-12-17 03:19:58 +0800
committerMilan Crha <mcrha@redhat.com>2009-12-17 03:19:58 +0800
commita4def5c093033ffe2fd645624235afaea8720f91 (patch)
treeb528a9c46d8bd7e0e78d791dddc7d31171da49d8 /mail
parentf65f8935bce5538d490d872e9838874c83717953 (diff)
downloadgsoc2013-evolution-a4def5c093033ffe2fd645624235afaea8720f91.tar
gsoc2013-evolution-a4def5c093033ffe2fd645624235afaea8720f91.tar.gz
gsoc2013-evolution-a4def5c093033ffe2fd645624235afaea8720f91.tar.bz2
gsoc2013-evolution-a4def5c093033ffe2fd645624235afaea8720f91.tar.lz
gsoc2013-evolution-a4def5c093033ffe2fd645624235afaea8720f91.tar.xz
gsoc2013-evolution-a4def5c093033ffe2fd645624235afaea8720f91.tar.zst
gsoc2013-evolution-a4def5c093033ffe2fd645624235afaea8720f91.zip
Bug #553057 - Show signer's information in a message window/preview
Diffstat (limited to 'mail')
-rw-r--r--mail/em-format-html-display.c8
-rw-r--r--mail/em-format-html.c61
-rw-r--r--mail/em-format-html.h2
3 files changed, 69 insertions, 2 deletions
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 95197077f6..c795929091 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -565,12 +565,20 @@ efhd_format_secure (EMFormat *emf,
g_free (classid);
if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
+ gchar *signers;
const gchar *desc;
gint status;
status = valid->sign.status;
desc = smime_sign_table[status].shortdesc;
+
camel_stream_printf (stream, "%s", gettext (desc));
+
+ signers = em_format_html_format_cert_infos ((CamelCipherCertInfo *)valid->sign.signers.head);
+ if (signers && *signers) {
+ camel_stream_printf (stream, " (%s)", signers);
+ }
+ g_free (signers);
}
if (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 6fbc6079aa..86ad0a5701 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -1595,11 +1595,23 @@ efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Camel
g_free(classid);
if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
- camel_stream_printf(stream, "%s<br>", _(smime_sign_table[valid->sign.status].shortdesc));
+ gchar *signers;
+
+ camel_stream_printf (stream, "%s", _(smime_sign_table[valid->sign.status].shortdesc));
+
+ signers = em_format_html_format_cert_infos ((CamelCipherCertInfo *)valid->sign.signers.head);
+ if (signers && *signers) {
+ camel_stream_printf (stream, " (%s)", signers);
+ }
+ g_free (signers);
}
if (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
- camel_stream_printf(stream, "%s<br>", _(smime_encrypt_table[valid->encrypt.status].shortdesc));
+ if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
+ camel_stream_printf (stream, "<br>");
+ }
+
+ camel_stream_printf (stream, "%s", _(smime_encrypt_table[valid->encrypt.status].shortdesc));
}
camel_stream_printf(stream, "</td></tr></table>");
@@ -2776,3 +2788,48 @@ efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons
emf->valid = save;
emf->valid_parent = save_parent;
}
+
+gchar *
+em_format_html_format_cert_infos (CamelCipherCertInfo *first_cinfo)
+{
+ GString *res = NULL;
+ CamelCipherCertInfo *cinfo;
+
+ if (!first_cinfo)
+ return NULL;
+
+ #define append(x) G_STMT_START { \
+ if (!res) { \
+ res = g_string_new (x); \
+ } else { \
+ g_string_append (res, x); \
+ } \
+ } G_STMT_END
+
+ for (cinfo = first_cinfo; cinfo && cinfo->next; cinfo = cinfo->next) {
+ if (!cinfo->name && !cinfo->email)
+ continue;
+
+ if (res)
+ append (", ");
+
+ if (cinfo->name && *cinfo->name) {
+ append (cinfo->name);
+
+ if (cinfo->email && *cinfo->email) {
+ append (" &lt;");
+ append (cinfo->email);
+ append ("&gt;");
+ }
+ } else if (cinfo->email && *cinfo->email) {
+ append (cinfo->email);
+ }
+ }
+
+ #undef append
+
+ if (!res)
+ return NULL;
+
+ return g_string_free (res, FALSE);
+}
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index 9d96c4056c..bac45d8ecc 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -282,6 +282,8 @@ gboolean em_format_html_get_show_real_date(EMFormatHTML *efh);
void em_format_html_set_show_real_date(EMFormatHTML *efh,
gboolean show_real_date);
+gchar * em_format_html_format_cert_infos (CamelCipherCertInfo *first_cinfo);
+
G_END_DECLS
#endif /* EM_FORMAT_HTML_H */