aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-16 16:40:58 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-16 16:40:58 +0800
commit527e9e472fb5d813f2ba337401af9e8bac70691d (patch)
tree7be6af9ac236f7022a478ff9981b5f42195c324d /composer
parentb61ed73a9bcdd1fa5653350954fc39242d6bba39 (diff)
downloadgsoc2013-evolution-527e9e472fb5d813f2ba337401af9e8bac70691d.tar
gsoc2013-evolution-527e9e472fb5d813f2ba337401af9e8bac70691d.tar.gz
gsoc2013-evolution-527e9e472fb5d813f2ba337401af9e8bac70691d.tar.bz2
gsoc2013-evolution-527e9e472fb5d813f2ba337401af9e8bac70691d.tar.lz
gsoc2013-evolution-527e9e472fb5d813f2ba337401af9e8bac70691d.tar.xz
gsoc2013-evolution-527e9e472fb5d813f2ba337401af9e8bac70691d.tar.zst
gsoc2013-evolution-527e9e472fb5d813f2ba337401af9e8bac70691d.zip
Bug #545851 - Set properly sign type on reply of signed message
Diffstat (limited to 'composer')
-rw-r--r--composer/e-msg-composer.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 89cf9dcfe9..0737d358b5 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -2421,11 +2421,19 @@ handle_multipart_signed (EMsgComposer *composer,
CamelContentType *content_type;
CamelDataWrapper *content;
CamelMimePart *mime_part;
- GtkToggleAction *action;
+ GtkToggleAction *action = NULL;
+ const gchar *protocol;
- /* FIXME: make sure this isn't an s/mime signed part?? */
- action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
- gtk_toggle_action_set_active (action, TRUE);
+ content_type = camel_data_wrapper_get_mime_type_field (CAMEL_DATA_WRAPPER (multipart));
+ protocol = camel_content_type_param (content_type, "protocol");
+
+ if (protocol && g_ascii_strcasecmp (protocol, "application/pgp-signature") == 0)
+ action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
+ else if (protocol && g_ascii_strcasecmp (protocol, "application/x-pkcs7-signature") == 0)
+ action = GTK_TOGGLE_ACTION (ACTION (SMIME_SIGN));
+
+ if (action)
+ gtk_toggle_action_set_active (action, TRUE);
mime_part = camel_multipart_get_part (
multipart, CAMEL_MULTIPART_SIGNED_CONTENT);
@@ -2481,11 +2489,21 @@ handle_multipart_encrypted (EMsgComposer *composer,
CamelSession *session;
CamelException ex;
CamelCipherValidity *valid;
- GtkToggleAction *action;
+ GtkToggleAction *action = NULL;
+ const gchar *protocol;
- /* FIXME: make sure this is a PGP/MIME encrypted part?? */
- action = GTK_TOGGLE_ACTION (ACTION (PGP_ENCRYPT));
- gtk_toggle_action_set_active (action, TRUE);
+ content_type = camel_mime_part_get_content_type (multipart);
+ protocol = camel_content_type_param (content_type, "protocol");
+
+ if (protocol && g_ascii_strcasecmp (protocol, "application/pgp-encrypted") == 0)
+ action = GTK_TOGGLE_ACTION (ACTION (PGP_ENCRYPT));
+ else if (content_type && (
+ camel_content_type_is (content_type, "application", "x-pkcs7-mime")
+ || camel_content_type_is (content_type, "application", "pkcs7-mime")))
+ action = GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT));
+
+ if (action)
+ gtk_toggle_action_set_active (action, TRUE);
camel_exception_init (&ex);
session = e_msg_composer_get_session (composer);
@@ -2961,6 +2979,13 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
gchar *html;
gssize length;
+ content_type = camel_mime_part_get_content_type (CAMEL_MIME_PART (message));
+
+ if (content_type && (
+ camel_content_type_is (content_type, "application", "x-pkcs7-mime")
+ || camel_content_type_is (content_type, "application", "pkcs7-mime")))
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT)), TRUE);
+
html = emcu_part_to_html ((CamelMimePart *)message, &length, NULL);
e_msg_composer_set_pending_body (composer, html, length);
}