tvl-depot/users/sterni/mblog/maildir.lisp
sterni 11738fc232 chore(sterni/mblog): relicense to GPL-3.0-only
This is possible since all the commits have been made by me. The code
taken from  SCLF (which is licensed LGPL-2.1-or-later) can also be
included since the LGPL 2.1 is [compatible] with the GPL 3.0.

compatible: https://www.gnu.org/licenses/license-list.en.html#LGPLv2.1
Change-Id: I2d274c29378679c489dc667a53b234642c3da817
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5928
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-07-09 17:10:46 +00:00

20 lines
769 B
Common Lisp

;; SPDX-License-Identifier: GPL-3.0-only
;; SPDX-FileCopyrightText: Copyright (C) 2022 by sterni
(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"))))