about summary refs log tree commit diff
path: root/users/sterni/mblog/maildir.lisp
blob: aca014203e2967a9c3544b2cbf9821ef4e80a091 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(in-package :maildir)
(declaim (optimize (safety 3)))

(defun list (dir)
  "Returns a list of pathnames to messages in a maildir. The messages are
  returned in no guaranteed order. Note that this function doesn't fully
  implement the behavior prescribed by maildir(5): It only looks at `cur`
  and `new` and won't clean up `tmp` nor move files from `new` to `cur`,
  since it is strictly read-only."
  (flet ((subdir-contents (subdir)
           (directory
            (merge-pathnames
             (make-pathname :directory `(:relative ,subdir)
                            :name :wild :type :wild)
             dir))))
    (mapcan #'subdir-contents '("cur" "new"))))