Commit 0a53c47c authored by Milan Crha's avatar Milan Crha

Bug 724227 - Do not mix PGP and S/MIME security on message reply

parent 3dc17b5e
......@@ -2926,12 +2926,17 @@ handle_multipart_signed (EMsgComposer *composer,
content_type = camel_data_wrapper_get_mime_type_field (content);
protocol = camel_content_type_param (content_type, "protocol");
if (protocol == NULL)
if (protocol == NULL) {
action = NULL;
else if (g_ascii_strcasecmp (protocol, "application/pgp-signature") == 0)
action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
else if (g_ascii_strcasecmp (protocol, "application/x-pkcs7-signature") == 0)
action = GTK_TOGGLE_ACTION (ACTION (SMIME_SIGN));
} else if (g_ascii_strcasecmp (protocol, "application/pgp-signature") == 0) {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (SMIME_SIGN))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT))))
action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
} else if (g_ascii_strcasecmp (protocol, "application/x-pkcs7-signature") == 0) {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (PGP_SIGN))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (PGP_ENCRYPT))))
action = GTK_TOGGLE_ACTION (ACTION (SMIME_SIGN));
}
if (action)
gtk_toggle_action_set_active (action, TRUE);
......@@ -3010,12 +3015,17 @@ handle_multipart_encrypted (EMsgComposer *composer,
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 && (
if (protocol && g_ascii_strcasecmp (protocol, "application/pgp-encrypted") == 0) {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (SMIME_SIGN))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT))))
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));
|| camel_content_type_is (content_type, "application", "pkcs7-mime"))) {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (PGP_SIGN))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (ACTION (PGP_ENCRYPT))))
action = GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT));
}
if (action)
gtk_toggle_action_set_active (action, TRUE);
......
......@@ -1702,23 +1702,37 @@ emu_update_composers_security (EMsgComposer *composer,
/* Pre-set only for encrypted messages, not for signed */
if (sign_by_default) {
if (validity_found & E_MAIL_PART_VALIDITY_SMIME)
action = E_COMPOSER_ACTION_SMIME_SIGN (composer);
else
action = E_COMPOSER_ACTION_PGP_SIGN (composer);
action = NULL;
if (validity_found & E_MAIL_PART_VALIDITY_SMIME) {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_PGP_SIGN (composer))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_PGP_ENCRYPT (composer))))
action = E_COMPOSER_ACTION_SMIME_SIGN (composer);
} else {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_SMIME_SIGN (composer))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_SMIME_ENCRYPT (composer))))
action = E_COMPOSER_ACTION_PGP_SIGN (composer);
}
gtk_toggle_action_set_active (
GTK_TOGGLE_ACTION (action), TRUE);
if (action)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
}
if (validity_found & E_MAIL_PART_VALIDITY_ENCRYPTED) {
if (validity_found & E_MAIL_PART_VALIDITY_SMIME)
action = E_COMPOSER_ACTION_SMIME_ENCRYPT (composer);
else
action = E_COMPOSER_ACTION_PGP_ENCRYPT (composer);
action = NULL;
if (validity_found & E_MAIL_PART_VALIDITY_SMIME) {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_PGP_SIGN (composer))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_PGP_ENCRYPT (composer))))
action = E_COMPOSER_ACTION_SMIME_ENCRYPT (composer);
} else {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_SMIME_SIGN (composer))) &&
!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_SMIME_ENCRYPT (composer))))
action = E_COMPOSER_ACTION_PGP_ENCRYPT (composer);
}
gtk_toggle_action_set_active (
GTK_TOGGLE_ACTION (action), TRUE);
if (action)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment