mirror of
https://git.code.sf.net/p/archivemail/code
synced 2025-01-03 05:34:58 +00:00
When converting from other formats to mbox, don't preserve existing 'Status' and
'X-Status' mbox headers, we better overwrite them with correct values.
This commit is contained in:
parent
c0552fcd06
commit
74c871644e
2 changed files with 15 additions and 21 deletions
|
@ -24,6 +24,9 @@ Version 0.7.1 - UNRELEASED
|
||||||
* archivemail now accepts --days=0
|
* archivemail now accepts --days=0
|
||||||
* Fixed crash if --warn-duplicate is used with IMAP (Thanks Christian
|
* Fixed crash if --warn-duplicate is used with IMAP (Thanks Christian
|
||||||
Brabandt) Closes: Debian bug #434786 (the Debian package already has a fix)
|
Brabandt) Closes: Debian bug #434786 (the Debian package already has a fix)
|
||||||
|
* When converting from other formats to mbox, archivemail used to preserve
|
||||||
|
existing 'Status' and 'X-Status' mbox headers; these are now silently
|
||||||
|
overwritten to ensure they have correct values.
|
||||||
|
|
||||||
Version 0.7.0 - 2 November 2006
|
Version 0.7.0 - 2 November 2006
|
||||||
* Fixed long options --filter-append and --pwfile to accept their arguments.
|
* Fixed long options --filter-append and --pwfile to accept their arguments.
|
||||||
|
|
|
@ -851,19 +851,14 @@ def add_status_headers(message):
|
||||||
if last_dir == "cur":
|
if last_dir == "cur":
|
||||||
status = status + "O"
|
status = status + "O"
|
||||||
|
|
||||||
# Maildir messages should not already have 'Status' and 'X-Status'
|
# Overwrite existing 'Status' and 'X-Status' headers. They add no value in
|
||||||
# headers, although I have seen it done. If they do already have them, just
|
# maildirs, and we better don't listen to them.
|
||||||
# preserve them rather than trying to overwrite/verify them.
|
del message['Status']
|
||||||
old_status = message.get('Status')
|
if status:
|
||||||
if old_status:
|
|
||||||
vprint("preserving existing Status header '%s'" % old_status)
|
|
||||||
elif status:
|
|
||||||
vprint("converting maildir status into Status header '%s'" % status)
|
vprint("converting maildir status into Status header '%s'" % status)
|
||||||
message['Status'] = status
|
message['Status'] = status
|
||||||
old_x_status = message.get('X-Status')
|
del message['X-Status']
|
||||||
if old_x_status:
|
if 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)
|
vprint("converting maildir status into X-Status header '%s'" % x_status)
|
||||||
message['X-Status'] = x_status
|
message['X-Status'] = x_status
|
||||||
|
|
||||||
|
@ -888,18 +883,14 @@ def add_status_headers_imap(message, flags):
|
||||||
if flags.count("\\Recent") == 0:
|
if flags.count("\\Recent") == 0:
|
||||||
status = status + "O"
|
status = status + "O"
|
||||||
|
|
||||||
# As with maildir folders, preserve Status and X-Status headers
|
# As with maildir folders, overwrite Status and X-Status headers
|
||||||
# if they exist (they shouldn't)
|
# if they exist.
|
||||||
old_status = message.get('Status')
|
del message['Status']
|
||||||
if old_status:
|
if status:
|
||||||
vprint("preserving existing Status header '%s'" % old_status)
|
|
||||||
elif status:
|
|
||||||
vprint("converting imap status into Status header '%s'" % status)
|
vprint("converting imap status into Status header '%s'" % status)
|
||||||
message['Status'] = status
|
message['Status'] = status
|
||||||
old_x_status = message.get('X-Status')
|
del message['X-Status']
|
||||||
if old_x_status:
|
if 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)
|
vprint("converting imap status into X-Status header '%s'" % x_status)
|
||||||
message['X-Status'] = x_status
|
message['X-Status'] = x_status
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue