Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change it so that you can not delete a mailbox if it has \Noselect AN…

…D (has no inferior mailboxes and is NOT subscribed)
  • Loading branch information...
commit 6dfe8bcb51adbf4fb7a2635208bc0da34c1d7b66 1 parent 351cbf5
@scanner authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 asimap/mbox.py
View
11 asimap/mbox.py
@@ -2482,11 +2482,18 @@ def delete(cls, name, server):
# mailbox.mailbox.lock()
inferior_mailboxes = mbox.mailbox.list_folders()
- # You can not delete a mailbox that has the '\Noselect' attribute.
+ # You can not delete a mailbox that has the '\Noselect' attribute
+ # and has inferior mailboxes.
#
- if '\\Noselect' in mbox.attributes:
+ if '\\Noselect' in mbox.attributes and len(inferior_mailboxes) > 0:
raise InvalidMailbox("The mailbox '%s' is already deleted" % \
name)
+ # You can not delete a mailbox that has the '\Noselect' attribute
+ # and is subscribed.
+ #
+ if '\\Noselect' in mbox.attributes and mbox.subscribed:
+ raise InvalidMailbox("The mailbox '%s' is still subscribed" % \
+ name)
# When deleting a mailbox it will cause to be deleted every
# message in that mailbox to be deleted.
Please sign in to comment.
Something went wrong with that request. Please try again.