Function: imap-mailbox-lsub
imap-mailbox-lsub is a byte-compiled function defined in imap.el.gz.
Signature
(imap-mailbox-lsub &optional ROOT REFERENCE ADD-DELIMITER BUFFER)
Documentation
Return a list of subscribed mailboxes on server in BUFFER.
If ROOT is non-nil, only list matching mailboxes. If ADD-DELIMITER is non-nil, a hierarchy delimiter is added to root. REFERENCE is an implementation-specific string that has to be passed to lsub command.
Source Code
;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-mailbox-lsub (&optional root reference add-delimiter buffer)
"Return a list of subscribed mailboxes on server in BUFFER.
If ROOT is non-nil, only list matching mailboxes. If ADD-DELIMITER is
non-nil, a hierarchy delimiter is added to root. REFERENCE is an
implementation-specific string that has to be passed to lsub command."
(with-current-buffer (or buffer (current-buffer))
;; Make sure we know the hierarchy separator for root's hierarchy
(when (and add-delimiter (null (imap-mailbox-get-1 'delimiter root)))
(imap-send-command-wait (concat "LIST \"" reference "\" \""
(imap-utf7-encode root) "\"")))
;; clear list data (NB not delimiter and other stuff)
(imap-mailbox-map-1 (lambda (mailbox)
(imap-mailbox-put 'lsub nil mailbox)))
(when (imap-ok-p
(imap-send-command-wait
(concat "LSUB \"" reference "\" \"" (imap-utf7-encode root)
(and add-delimiter (imap-mailbox-get-1 'delimiter root))
"%\"")))
(let (out)
(imap-mailbox-map-1 (lambda (mailbox)
(when (imap-mailbox-get-1 'lsub mailbox)
(push (imap-utf7-decode mailbox) out))))
(nreverse out)))))