From 216708e9c051a7df69fb250bbec95667f143dfa3 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Sat, 18 Jul 2015 18:56:59 -0400 Subject: [PATCH] fixed bug occurring in messages without a sig edward will ask for a key. --- edward-bot | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/edward-bot b/edward-bot index c8b02ec..91d48ed 100755 --- a/edward-bot +++ b/edward-bot @@ -210,22 +210,28 @@ def choose_reply_encryption_key (keys): reply_key = key break - return key + return reply_key def generate_reply (plaintext, email_from, email_subject, encrypt_to_key, sign_with_fingerprint): - plaintext_reply = "thanks for the message!\n\n\n" - plaintext_reply += email_quote_text(plaintext) - - encrypted_reply = encrypt_sign_message(plaintext_reply, encrypt_to_key, - sign_with_fingerprint) - reply = "To: " + email_from + "\n" reply += "Subject: " + email_subject + "\n" reply += "\n" - reply += encrypted_reply + + if (encrypt_to_key != None): + plaintext_reply = "thanks for the message!\n\n\n" + plaintext_reply += email_quote_text(plaintext) + + encrypted_reply = encrypt_sign_message(plaintext_reply, encrypt_to_key, + sign_with_fingerprint) + + reply += encrypted_reply + + else: + reply += "Sorry, i couldn't find your key.\n" + reply += "I'll need that to encrypt a message to you." return reply -- 2.25.1