From 5dd43729abd32ca7639a5b7f6dbeb2bb2919f34e Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Thu, 27 Dec 2018 07:35:03 -0500 Subject: [PATCH 1/2] Format "From" line date with ctime(3) per RFC 4155. --- imapbackup.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/imapbackup.py b/imapbackup.py index dc1ca9a..421134e 100644 --- a/imapbackup.py +++ b/imapbackup.py @@ -124,6 +124,20 @@ def string_from_file(value): return content.read().strip() +class Narrator: + """Globally-switchable narrator to replace print statements""" + def __init__(self, is_on): + self.is_on = is_on + + def __call__(self, *args): + if self.is_on: + for arg in args: + print arg, + print + + + + def download_messages(server, filename, messages, config): """Download messages from folder and append to mailbox""" @@ -157,9 +171,12 @@ def download_messages(server, filename, messages, config): # each new message for msg_id in messages.keys(): + # This "From" and the terminating newline below delimit messages - # in mbox files - buf = "From nobody %s\n" % time.strftime('%a %b %d %H:%M:%S %Y') + # in mbox files. Note that RFC 4155 specifies that the date be + # in the same format as the output of ctime(3), which is required + # by ISO C to use English day and month abbreviations. + buf = "From nobody %s\n" % time.ctime() # If this is one of our synthesised Message-IDs, insert it before # the other headers if UUID in msg_id: From 1634e51382c279569da4b1a92b2aa13af8305b21 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Fri, 28 Dec 2018 12:22:56 -0500 Subject: [PATCH 2/2] Removed unused code that shouldn't have been committed. --- imapbackup.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/imapbackup.py b/imapbackup.py index 421134e..2c2c6a3 100644 --- a/imapbackup.py +++ b/imapbackup.py @@ -124,18 +124,6 @@ def string_from_file(value): return content.read().strip() -class Narrator: - """Globally-switchable narrator to replace print statements""" - def __init__(self, is_on): - self.is_on = is_on - - def __call__(self, *args): - if self.is_on: - for arg in args: - print arg, - print - - def download_messages(server, filename, messages, config):