aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2010-10-16 18:53:28 +0200
committerNikolaus Schulz <microschulz@web.de>2010-10-16 18:57:43 +0200
commit77a2856e4892a6e2231b50a0ae8e0b63eeb7ce08 (patch)
tree2398390c033bcdca70920644dcb8234873740270 /archivemail
parent45f82b721813d430aaf58df435e8b1297d0d6365 (diff)
downloadarchivemail-77a2856e4892a6e2231b50a0ae8e0b63eeb7ce08.tar.gz
archivemail-77a2856e4892a6e2231b50a0ae8e0b63eeb7ce08.tar.bz2
archivemail-77a2856e4892a6e2231b50a0ae8e0b63eeb7ce08.zip
IMAP: don't prepend NAMESPACE prefix to INBOX and its children
Diffstat (limited to 'archivemail')
-rwxr-xr-xarchivemail16
1 files changed, 12 insertions, 4 deletions
diff --git a/archivemail b/archivemail
index d5f326c..4eca685 100755
--- a/archivemail
+++ b/archivemail
@@ -1599,16 +1599,24 @@ def imap_guess_mailboxnames(srv, mailbox):
hdelim = imap_getdelim(srv)
vprint("IMAP namespace prefix: '%s', hierarchy delimiter: '%s'" % \
(nsprefix, hdelim))
- if mailbox.startswith(nsprefix):
+ if mailbox.upper() == "INBOX" or \
+ (hdelim is not None and mailbox.upper().startswith("INBOX" + hdelim)):
+ # INBOX is not a real mailbox name, so namespace prefixes do not apply
+ # to INBOX and its children
+ boxnames = [mailbox]
+ elif mailbox.startswith(nsprefix):
boxnames = [mailbox]
else:
boxnames = [nsprefix + mailbox]
if os.path.sep in mailbox and hdelim is not None:
mailbox = mailbox.replace(os.path.sep, hdelim)
- if mailbox.startswith(nsprefix):
+ if mailbox.upper().startswith("INBOX" + hdelim):
boxnames.append(mailbox)
- if nsprefix:
- boxnames.append(nsprefix + mailbox)
+ else:
+ if mailbox.startswith(nsprefix):
+ boxnames.append(mailbox)
+ if nsprefix:
+ boxnames.append(nsprefix + mailbox)
return boxnames