aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail.py
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2007-11-02 12:27:32 +0000
committerNikolaus Schulz <microschulz@web.de>2007-11-02 12:27:32 +0000
commit130a5ef117806c223d36d6a4ccd3a9de03866df5 (patch)
treea2d65b8be1d1f221e4c568d1793ee13e0cb62763 /archivemail.py
parent82e3be1987918143bca07effeb4a4d6b2632d3dc (diff)
downloadarchivemail-130a5ef117806c223d36d6a4ccd3a9de03866df5.tar.gz
archivemail-130a5ef117806c223d36d6a4ccd3a9de03866df5.tar.bz2
archivemail-130a5ef117806c223d36d6a4ccd3a9de03866df5.zip
When converting from maildir or IMAP to mbox, report existing 'Status' and
'X-Status' headers in verbose mode, since they are preserved, which can give surprising results.
Diffstat (limited to 'archivemail.py')
-rwxr-xr-xarchivemail.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/archivemail.py b/archivemail.py
index f3fcc0e..1f14b65 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -846,10 +846,16 @@ def add_status_headers(message):
# 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.
- if not message.get('Status') and status:
+ old_status = message.get('Status')
+ if old_status:
+ vprint("preserving existing Status header '%s'" % old_status)
+ elif status:
vprint("converting maildir status into Status header '%s'" % status)
message['Status'] = status
- if not message.get('X-Status') and x_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:
vprint("converting maildir status into X-Status header '%s'" % x_status)
message['X-Status'] = x_status
@@ -876,10 +882,16 @@ def add_status_headers_imap(message, flags):
# As with maildir folders, preserve Status and X-Status headers
# if they exist (they shouldn't)
- if not message.get('Status') and status:
+ old_status = message.get('Status')
+ if old_status:
+ vprint("preserving existing Status header '%s'" % old_status)
+ elif status:
vprint("converting imap status into Status header '%s'" % status)
message['Status'] = status
- if not message.get('X-Status') and x_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:
vprint("converting imap status into X-Status header '%s'" % x_status)
message['X-Status'] = x_status