aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rwxr-xr-xarchivemail6
-rwxr-xr-xtest_archivemail22
3 files changed, 31 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 1aca43f..bdef7c3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -51,6 +51,9 @@ Version 0.8.0 - UNRELEASED
boolean constants).
* Added a lot of test cases for maildir archiving to the test suite.
Maildir testing should now be roughly on par with mbox testing.
+ * IMAP servers (Dovecot and UW-IMAP at least) may store mailbox meta data
+ for mboxes in a pseudo message. Such messages are now detected and never
+ archived. Obsoletes: patch #2210707. (Thanks, "tlhackque")
Version 0.7.2 - 9 November 2007
diff --git a/archivemail b/archivemail
index ec05171..52ec06b 100755
--- a/archivemail
+++ b/archivemail
@@ -1156,6 +1156,12 @@ def _archive_mbox(mailbox_name, final_archive_name):
msg = original.next()
if not msg and (original.starting_size > 0):
user_error("'%s' is not a valid mbox-format mailbox" % mailbox_name)
+ if msg and 'X-IMAP' in msg:
+ # Dovecot and UW-IMAP pseudo message for mailbox meta data
+ vprint("detected IMAP pseudo message")
+ if retain:
+ retain.write(msg)
+ msg = original.next()
while (msg):
msg_size = sizeof_message(msg)
stats.another_message(msg_size)
diff --git a/test_archivemail b/test_archivemail
index 2d63d78..fda2d63 100755
--- a/test_archivemail
+++ b/test_archivemail
@@ -1103,6 +1103,28 @@ class TestArchiveSize(unittest.TestCase):
archivemail.options.min_size = None
+class TestXIMAPMessage(TestArchive):
+ """Test if IMAP pseudo messages in mboxes are properly handled."""
+ def setUp(self):
+ super(TestXIMAPMessage, self).setUp()
+ archivemail.options.quiet = True
+
+ def testXIMAPMbox(self):
+ """IMAP pseudo messages in an mbox are always preserved."""
+ self.good_mbox = make_mbox(hours_old=181*24, headers={'X-IMAP': 'dummytext'},
+ messages=1)
+ self.good_archive = make_mbox(hours_old=181*24, messages=3)
+ self.mbox = tempfile.mkstemp()[-1]
+ shutil.copyfile(self.good_mbox, self.mbox)
+ append_file(self.good_archive, self.mbox)
+ archivemail.archive(self.mbox)
+ self.verify()
+
+ def tearDown(self):
+ super(TestXIMAPMessage, self).tearDown()
+ archivemail.options.quiet = False
+
+
############# Test archiving maildirs ###############
class TestArchiveMailboxdir(TestCaseInTempdir):