mirror of
https://git.code.sf.net/p/archivemail/code
synced 2024-12-22 07:42:55 +00:00
IMAP: don't prepend NAMESPACE prefix to INBOX and its children
This commit is contained in:
parent
45f82b7218
commit
77a2856e48
1 changed files with 12 additions and 4 deletions
10
archivemail
10
archivemail
|
@ -1599,12 +1599,20 @@ def imap_guess_mailboxnames(srv, mailbox):
|
||||||
hdelim = imap_getdelim(srv)
|
hdelim = imap_getdelim(srv)
|
||||||
vprint("IMAP namespace prefix: '%s', hierarchy delimiter: '%s'" % \
|
vprint("IMAP namespace prefix: '%s', hierarchy delimiter: '%s'" % \
|
||||||
(nsprefix, hdelim))
|
(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]
|
boxnames = [mailbox]
|
||||||
else:
|
else:
|
||||||
boxnames = [nsprefix + mailbox]
|
boxnames = [nsprefix + mailbox]
|
||||||
if os.path.sep in mailbox and hdelim is not None:
|
if os.path.sep in mailbox and hdelim is not None:
|
||||||
mailbox = mailbox.replace(os.path.sep, hdelim)
|
mailbox = mailbox.replace(os.path.sep, hdelim)
|
||||||
|
if mailbox.upper().startswith("INBOX" + hdelim):
|
||||||
|
boxnames.append(mailbox)
|
||||||
|
else:
|
||||||
if mailbox.startswith(nsprefix):
|
if mailbox.startswith(nsprefix):
|
||||||
boxnames.append(mailbox)
|
boxnames.append(mailbox)
|
||||||
if nsprefix:
|
if nsprefix:
|
||||||
|
|
Loading…
Reference in a new issue