From 7f00b2761e85c7b439224e9e0ddf38559ac288b8 Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 16 May 2008 09:32:06 +0000 Subject: display alert dialog when signing/encryption failed. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1994 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/compose.c') diff --git a/src/compose.c b/src/compose.c index 69f75e05..83dded09 100644 --- a/src/compose.c +++ b/src/compose.c @@ -3434,8 +3434,13 @@ static gint compose_clearsign_text(Compose *compose, gchar **text) return -1; } - if (compose_create_signers_list(compose, &key_list) < 0 || - rfc2015_clearsign(tmp_file, key_list) < 0) { + if (compose_create_signers_list(compose, &key_list) < 0) { + g_unlink(tmp_file); + g_free(tmp_file); + return -1; + } + if (rfc2015_clearsign(tmp_file, key_list) < 0) { + alertpanel_error(_("Can't sign the message.")); g_unlink(tmp_file); g_free(tmp_file); return -1; @@ -3462,6 +3467,7 @@ static gint compose_encrypt_armored(Compose *compose, gchar **text) } if (rfc2015_encrypt_armored(tmp_file, compose->to_list) < 0) { + alertpanel_error(_("Can't encrypt the message.")); g_unlink(tmp_file); g_free(tmp_file); return -1; @@ -3496,6 +3502,7 @@ static gint compose_encrypt_sign_armored(Compose *compose, gchar **text) if (rfc2015_encrypt_sign_armored (tmp_file, compose->to_list, key_list) < 0) { + alertpanel_error(_("Can't encrypt or sign the message.")); g_unlink(tmp_file); g_free(tmp_file); return -1; @@ -3813,8 +3820,12 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, if (use_pgpmime_signing && !use_pgpmime_encryption) { GSList *key_list; - if (compose_create_signers_list(compose, &key_list) < 0 || - rfc2015_sign(file, key_list) < 0) { + if (compose_create_signers_list(compose, &key_list) < 0) { + g_unlink(file); + return -1; + } + if (rfc2015_sign(file, key_list) < 0) { + alertpanel_error(_("Can't sign the message.")); g_unlink(file); return -1; } @@ -3846,13 +3857,18 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, } if (use_pgpmime_signing) { if (compose_create_signers_list - (compose, &key_list) < 0 || - rfc2015_encrypt_sign(file, compose->to_list, + (compose, &key_list) < 0) { + g_unlink(file); + return -1; + } + if (rfc2015_encrypt_sign(file, compose->to_list, key_list) < 0) { + alertpanel_error(_("Can't encrypt or sign the message.")); g_unlink(file); return -1; } } else if (rfc2015_encrypt(file, compose->to_list) < 0) { + alertpanel_error(_("Can't encrypt the message.")); g_unlink(file); return -1; } -- cgit v1.2.3