added return message quoting
authorAndrew Engelbrecht <andrew@localhost.localdomain>
Sat, 18 Jul 2015 22:18:34 +0000 (18:18 -0400)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Mon, 7 Dec 2015 17:46:48 +0000 (12:46 -0500)
edward-bot

index 94c49722ce6a48545e54857d723c1e715307599f..634c3de80e0236fd99c373c7edae001590413383 100755 (executable)
@@ -219,17 +219,26 @@ def choose_reply_encryption_key (keys):
 
 def generate_reply (plaintext, email_from, email_subject, encrypt_to_key):
 
-    plaintext_reply = "thanks for the message!\n\n\n" + plaintext
+    plaintext_reply  = "thanks for the message!\n\n\n"
+    plaintext_reply += email_quote_text(plaintext)
 
     encrypted_reply = encrypt_message(plaintext_reply, encrypt_to_key)
 
     reply  = "To: " + email_from + "\n"
     reply += "Subject: " + email_subject + "\n"
+    reply += "\n"
     reply += encrypted_reply
 
     return reply
 
 
+def email_quote_text (text):
+
+    quoted_message = re.sub(r'^', r'> ', text, flags=re.MULTILINE)
+
+    return quoted_message
+
+
 def encrypt_message (plaintext, encrypt_to_key):
 
     gpgme_ctx = gpgme.Context()