mirror of
https://git.code.sf.net/p/archivemail/code
synced 2024-12-22 07:42:55 +00:00
IMAP: added sanity check for \Deleted in PERMANENTFLAGS.
This commit is contained in:
parent
681fd0c527
commit
775952ec98
1 changed files with 14 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue