From f87041f8870e5038a91b2226382a59858db2acd7 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Sat, 18 Jul 2015 18:18:34 -0400 Subject: [PATCH] added return message quoting --- edward-bot | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/edward-bot b/edward-bot index 94c4972..634c3de 100755 --- a/edward-bot +++ b/edward-bot @@ -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() -- 2.25.1