Quick support for non existent mailbox with children.

fix #525
This commit is contained in:
Antoine Nguyen
2014-03-05 16:33:33 +01:00
parent 1346cf9ce1
commit cbaee363ff
3 changed files with 17 additions and 3 deletions
+7 -1
View File
@@ -415,6 +415,9 @@ class IMAPconnector(object):
@capability('LIST-EXTENDED', '_listmboxes_simple')
def _listmboxes(self, topmailbox, mailboxes, until_mailbox=None):
"""Retrieve mailboxes list.
"""
pattern = "%s%s%%" % (topmailbox.encode("imap4-utf-7"), self.hdelimiter) \
if len(topmailbox) else "%"
resp = self._cmd("LIST", "", pattern, "RETURN", "(CHILDREN)")
@@ -443,6 +446,8 @@ class IMAPconnector(object):
if r'\Marked' in flags or not r'\UnMarked' in flags:
descr["send_status"] = True
if r'\HasChildren' in flags:
if r'\NonExistent' in flags:
descr["removed"] = True
descr["path"] = name
descr["sub"] = []
if until_mailbox and until_mailbox.startswith(name):
@@ -489,7 +494,8 @@ class IMAPconnector(object):
continue
del mb["send_status"]
key = "path" if "path" in mb else "name"
count = self.unseen_messages(mb[key])
if not mb.get("removed", False):
count = self.unseen_messages(mb[key])
if count == 0:
continue
mb["unseen"] = count
@@ -693,8 +693,14 @@ Webmail.prototype = {
},
listmailbox_loader: function(event) {
var $target = get_target(event, "a");
if ($target.parent().hasClass("disabled")) {
event.preventDefault();
return;
}
this.select_mailbox(event.target);
this._listmailbox_loader(event, get_target(event, "a"));
this._listmailbox_loader(event, $target);
},
/*
@@ -132,7 +132,9 @@ def print_mailboxes(tree, selected=None, withunseen=False, selectonly=False, hde
cssclass = ""
name = mbox["path"] if "sub" in mbox else mbox["name"]
label = separate_mailbox(mbox["name"], hdelimiter)[0]
if selected == name:
if mbox.get("removed", False):
cssclass = "disabled"
elif selected == name:
cssclass = "active"
result += "<li name='%s' class='droppable %s'>\n" % (name, cssclass)
if "sub" in mbox: