fixed bug occurring in messages without a sig
authorAndrew Engelbrecht <andrew@localhost.localdomain>
Sat, 18 Jul 2015 22:56:59 +0000 (18:56 -0400)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Mon, 7 Dec 2015 17:46:48 +0000 (12:46 -0500)
edward will ask for a key.

edward-bot

index c8b02ec145fc093fd75e48d0e86c0daed8542ce9..91d48ed533933be4712eba5b68c913e0c8bb8777 100755 (executable)
@@ -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