From: Andrew Engelbrecht Date: Sat, 18 Jul 2015 22:56:59 +0000 (-0400) Subject: fixed bug occurring in messages without a sig X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=216708e9c051a7df69fb250bbec95667f143dfa3;p=edward.git fixed bug occurring in messages without a sig edward will ask for a key. --- 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