aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail.py
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2007-11-02 23:35:50 +0000
committerNikolaus Schulz <microschulz@web.de>2007-11-02 23:35:50 +0000
commit74c871644e4375983df62741a75aa5e6580f4535 (patch)
tree1775fd25fbd50068d8081394eb7d6743319d64fe /archivemail.py
parentc0552fcd0609e58aa3e9fb59508ee6fac966824b (diff)
downloadarchivemail-74c871644e4375983df62741a75aa5e6580f4535.tar.gz
archivemail-74c871644e4375983df62741a75aa5e6580f4535.tar.bz2
archivemail-74c871644e4375983df62741a75aa5e6580f4535.zip
When converting from other formats to mbox, don't preserve existing 'Status' and
'X-Status' mbox headers, we better overwrite them with correct values.
Diffstat (limited to 'archivemail.py')
-rwxr-xr-xarchivemail.py33
1 files changed, 12 insertions, 21 deletions
diff --git a/archivemail.py b/archivemail.py
index c8bafbb..6ec738a 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -851,19 +851,14 @@ def add_status_headers(message):
if last_dir == "cur":
status = status + "O"
- # Maildir messages should not already have 'Status' and 'X-Status'
- # headers, although I have seen it done. If they do already have them, just
- # preserve them rather than trying to overwrite/verify them.
- old_status = message.get('Status')
- if old_status:
- vprint("preserving existing Status header '%s'" % old_status)
- elif status:
+ # 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
- old_x_status = message.get('X-Status')
- if old_x_status:
- vprint("preserving existing X-Status header '%s'" % old_x_status)
- elif x_status:
+ del message['X-Status']
+ if x_status:
vprint("converting maildir status into X-Status header '%s'" % x_status)
message['X-Status'] = x_status
@@ -888,18 +883,14 @@ def add_status_headers_imap(message, flags):
if flags.count("\\Recent") == 0:
status = status + "O"
- # As with maildir folders, preserve Status and X-Status headers
- # if they exist (they shouldn't)
- old_status = message.get('Status')
- if old_status:
- vprint("preserving existing Status header '%s'" % old_status)
- elif status:
+ # As with maildir folders, overwrite Status and X-Status headers
+ # if they exist.
+ del message['Status']
+ if status:
vprint("converting imap status into Status header '%s'" % status)
message['Status'] = status
- old_x_status = message.get('X-Status')
- if old_x_status:
- vprint("preserving existing X-Status header '%s'" % old_x_status)
- elif x_status:
+ del message['X-Status']
+ if x_status:
vprint("converting imap status into X-Status header '%s'" % x_status)
message['X-Status'] = x_status