diff options
author | Nikolaus Schulz <microschulz@web.de> | 2007-11-13 00:32:49 +0000 |
---|---|---|
committer | Nikolaus Schulz <microschulz@web.de> | 2007-11-13 00:32:49 +0000 |
commit | d9ffaf4a3b4c13eeaad53bf4b8a6fda48a7eee06 (patch) | |
tree | c292ed4cf702795e507e5a5533e535e44be19e7f | |
parent | ead112daba62c9c1dadd73ee4097962e9b414043 (diff) | |
download | archivemail-d9ffaf4a3b4c13eeaad53bf4b8a6fda48a7eee06.tar.gz archivemail-d9ffaf4a3b4c13eeaad53bf4b8a6fda48a7eee06.tar.bz2 archivemail-d9ffaf4a3b4c13eeaad53bf4b8a6fda48a7eee06.zip |
When converting from other formats to mbox, re-use existing 'Status' and
'X-Status' headers if appropriate (instead of deleting and re-generating them).
-rwxr-xr-x | archivemail.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/archivemail.py b/archivemail.py index 252a2aa..ae204cc 100755 --- a/archivemail.py +++ b/archivemail.py @@ -779,7 +779,7 @@ def guess_delivery_time(message): # get more desparate as we go through the array for header in ('Delivery-date', 'Date', 'Resent-Date'): try: - date = message.getdate(header) + date = message.getdate_tz(header) if date: time_message = time.mktime(date) vprint("using valid time found from '%s' header" % header) @@ -853,14 +853,16 @@ def add_status_headers(message): # Overwrite existing 'Status' and 'X-Status' headers. They add no value in # maildirs, and we better don't listen to them. - del message['Status'] if status: vprint("converting maildir status into Status header '%s'" % status) message['Status'] = status - del message['X-Status'] + else: + del message['Status'] if x_status: vprint("converting maildir status into X-Status header '%s'" % x_status) message['X-Status'] = x_status + else: + del message['X-Status'] def add_status_headers_imap(message, flags): """Add Status and X-Status headers to a message from an imap mailbox.""" @@ -884,19 +886,19 @@ def add_status_headers_imap(message, flags): # As with maildir folders, overwrite Status and X-Status headers # if they exist. - del message['Status'] vprint("converting imap status (%s)..." % " ".join(flags)) if status: vprint("generating Status header '%s'" % status) message['Status'] = status else: vprint("not generating Status header") - del message['X-Status'] + del message['Status'] if x_status: vprint("generating X-Status header '%s'" % x_status) message['X-Status'] = x_status else: vprint("not generating X-Status header") + del message['X-Status'] def is_flagged(message): """return true if the message is flagged important, false otherwise""" |