From 4e2c66f71e0437a5cf2a5e586ebcbb5eabb15718 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Wed, 12 Aug 2015 12:48:53 -0400 Subject: [PATCH] don't complain about lack of encryption unless the message has no signature, pub key or encryption. --- edward | 10 +++++++++- tests/flatten-1.out | 2 -- tests/flatten-3.out | 2 -- tests/flatten-7.out | 2 -- tests/flatten-8.out | 2 -- tests/gpg-flatten-3.out | 2 -- tests/gpg-flatten-5.out | 2 -- tests/gpg-flatten-6.out | 2 -- 8 files changed, 9 insertions(+), 15 deletions(-) diff --git a/edward b/edward index aaed2a5..7b633ca 100755 --- a/edward +++ b/edward @@ -215,6 +215,7 @@ class ReplyInfo (object): sig_success = False pubkey_success = False + decrypt_failure = False sig_failure = False sigkey_missing = False have_reply_key = False @@ -727,6 +728,7 @@ def prepare_for_reply_message (piece, replyinfo_obj): """ if piece.gpg_data == None or piece.gpg_data.plainobj == None: + replyinfo_obj.decrypt_failure = True return replyinfo_obj.decrypt_success = True @@ -937,7 +939,7 @@ def write_reply (replyinfo_obj): reply_plain += "\n\n" - else: + elif replyinfo_obj.decrypt_failure == True: debug('decrypt failure') reply_plain += replyinfo_obj.replies['failed_decrypt'] reply_plain += "\n\n" @@ -963,6 +965,12 @@ def write_reply (replyinfo_obj): reply_plain += "\n\n" + if (reply_plain == ""): + debug('plaintext message') + reply_plain += replyinfo_obj.replies['failed_decrypt'] + reply_plain += "\n\n" + + reply_plain += replyinfo_obj.replies['signature'] reply_plain += "\n\n" diff --git a/tests/flatten-1.out b/tests/flatten-1.out index 9374801..75759f9 100644 --- a/tests/flatten-1.out +++ b/tests/flatten-1.out @@ -1,5 +1,3 @@ -I'm sorry, I was not able to decrypt your message. Are you sure you encrypted it with my public key? - Your signature could not be verified. - Edward, the friendly GnuPG bot diff --git a/tests/flatten-3.out b/tests/flatten-3.out index caecd47..a095b1b 100644 --- a/tests/flatten-3.out +++ b/tests/flatten-3.out @@ -1,5 +1,3 @@ -I'm sorry, I was not able to decrypt your message. Are you sure you encrypted it with my public key? - Your signature could not be verified. I'm sorry, I was not able to find your public key. Did you remember to attach it? diff --git a/tests/flatten-7.out b/tests/flatten-7.out index 9374801..75759f9 100644 --- a/tests/flatten-7.out +++ b/tests/flatten-7.out @@ -1,5 +1,3 @@ -I'm sorry, I was not able to decrypt your message. Are you sure you encrypted it with my public key? - Your signature could not be verified. - Edward, the friendly GnuPG bot diff --git a/tests/flatten-8.out b/tests/flatten-8.out index c82d151..215717f 100644 --- a/tests/flatten-8.out +++ b/tests/flatten-8.out @@ -1,5 +1,3 @@ -あなたからのメッセージを解読できなくて、すみません。そちらでは暗号化のとき、私の公開鍵を使ってくださったでしょうか? - あなたの署名を認証できませんでした。 - GnuPGボットのEdward diff --git a/tests/gpg-flatten-3.out b/tests/gpg-flatten-3.out index 864c0c5..c4dfde3 100644 --- a/tests/gpg-flatten-3.out +++ b/tests/gpg-flatten-3.out @@ -1,5 +1,3 @@ -I'm sorry, I was not able to decrypt your message. Are you sure you encrypted it with my public key? - Your signature was verified. - Edward, the friendly GnuPG bot diff --git a/tests/gpg-flatten-5.out b/tests/gpg-flatten-5.out index 864c0c5..c4dfde3 100644 --- a/tests/gpg-flatten-5.out +++ b/tests/gpg-flatten-5.out @@ -1,5 +1,3 @@ -I'm sorry, I was not able to decrypt your message. Are you sure you encrypted it with my public key? - Your signature was verified. - Edward, the friendly GnuPG bot diff --git a/tests/gpg-flatten-6.out b/tests/gpg-flatten-6.out index 864c0c5..c4dfde3 100644 --- a/tests/gpg-flatten-6.out +++ b/tests/gpg-flatten-6.out @@ -1,5 +1,3 @@ -I'm sorry, I was not able to decrypt your message. Are you sure you encrypted it with my public key? - Your signature was verified. - Edward, the friendly GnuPG bot -- 2.25.1