def listMailboxes(self, ref, wildcard): """ List the mailboxes. from rfc 3501: returns a subset of names from the complete set of all names available to the client. Zero or more untagged LIST replies are returned, containing the name attributes, hierarchy delimiter, and name. :param ref: reference name :type ref: str :param wildcard: mailbox name with possible wildcards :type wildcard: str """ wildcard = imap4.wildcardToRegexp(wildcard, '/') def get_list(mboxes, mboxes_names): return zip(mboxes_names, mboxes) def filter_inferiors(ref): mboxes = [mbox for mbox in ref if wildcard.match(mbox)] mbox_d = defer.gatherResults([self.getMailbox(m) for m in mboxes]) mbox_d.addCallback(get_list, mboxes) return mbox_d d = self._inferiorNames(normalize_mailbox(ref)) d.addCallback(filter_inferiors) return d
def listMailboxes(self, ref, wildcard): """ List the mailboxes. from rfc 3501: returns a subset of names from the complete set of all names available to the client. Zero or more untagged LIST replies are returned, containing the name attributes, hierarchy delimiter, and name. :param ref: reference name :type ref: str :param wildcard: mailbox name with possible wildcards :type wildcard: str """ # XXX use wildcard in index query ref = self._inferiorNames(ref.upper()) wildcard = imap4.wildcardToRegexp(wildcard, '/') return [(i, self.getMailbox(i)) for i in ref if wildcard.match(i)]
def listMailboxes(self, ref, wildcard): """ List the mailboxes. from rfc 3501: returns a subset of names from the complete set of all names available to the client. Zero or more untagged LIST replies are returned, containing the name attributes, hierarchy delimiter, and name. :param ref: reference name :type ref: str :param wildcard: mailbox name with possible wildcards :type wildcard: str """ # XXX use wildcard in index query ref = self._inferiorNames(self._parse_mailbox_name(ref)) wildcard = imap4.wildcardToRegexp(wildcard, '/') return [(i, self.getMailbox(i)) for i in ref if wildcard.match(i)]
def listMailboxes(self, ref, wildcard): ref = self._inferiorNames(ref.upper()) wildcard = imap4.wildcardToRegexp(wildcard, '/') return [(i, self.mailboxes[i]) for i in ref if wildcard.match(i)]