depot/third_party/tvl/users/sterni/mblog/maildir.lisp
Default email a291c8690a Project import generated by Copybara.
GitOrigin-RevId: e6e19f3d81a982a62e1bba08f0b4f7fdc21b4ea0
2022-05-19 16:39:52 +02:00

17 lines
671 B
Common Lisp

(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"))))