aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail.py
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2008-04-08 19:31:11 +0000
committerNikolaus Schulz <microschulz@web.de>2008-04-08 19:31:11 +0000
commit775952ec98095c1ea3fe5dbe87197cd4e6f924eb (patch)
treee5d38b7fcf975c37163cc1cf5558bae33c7bd8c4 /archivemail.py
parent681fd0c527175f0fe1906c577c91b82b37a043d6 (diff)
downloadarchivemail-775952ec98095c1ea3fe5dbe87197cd4e6f924eb.tar.gz
archivemail-775952ec98095c1ea3fe5dbe87197cd4e6f924eb.tar.bz2
archivemail-775952ec98095c1ea3fe5dbe87197cd4e6f924eb.zip
IMAP: added sanity check for \Deleted in PERMANENTFLAGS.
Diffstat (limited to 'archivemail.py')
-rwxr-xr-xarchivemail.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/archivemail.py b/archivemail.py
index 558efc0..5760f56 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -1555,6 +1555,20 @@ def imap_smart_select(srv, mailbox):
if result != 'OK':
unexpected_error("selecting '%s' failed; server says: '%s'." \
% (mailbox, response[0]))
+ if not options.copy_old_mail:
+ # Sanity check that we don't silently fail to delete messages.
+ # As to the following indices: IMAP4.response(key) returns
+ # a tuple (key, ['<all_items>']) if the key is found, (key, [None])
+ # otherwise. Imaplib just *loves* to nest trivial lists!
+ permflags = srv.response("PERMANENTFLAGS")[1][0]
+ if permflags:
+ permflags = permflags.strip('()').lower().split()
+ if not '\\deleted' in permflags:
+ unexpected_error("Server doesn't allow deleting messages in " \
+ "'%s'." % mailbox)
+ elif "IMAP4REV1" in srv.capabilities:
+ vprint("Suspect IMAP4rev1 server, doesn't send PERMANENTFLAGS " \
+ "upon SELECT")
def imap_find_mailbox(srv, mailbox):