scm: add convenience methods root-maildir, personal-addresses

For a store, so to avoid assoc-ref.
This commit is contained in:
Dirk-Jan C. Binnema
2025-11-29 12:43:38 +02:00
committed by Seth Ladygo
parent 52f44653b0
commit 8afef75b30
4 changed files with 30 additions and 5 deletions

View File

@ -93,8 +93,9 @@
cfind
labels
personal?
root-maildir
personal-addresses
store->alist
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Other
@ -563,8 +564,24 @@ The pattern is mandatory; the other (keyword) arguments are optional.
#:max-results max. number of matches. Default: false (unlimited))."
(cc-store-cfind (cc-store store) pattern personal? after max-results))
(define-method (root-maildir (store <store>))
;; "Get the root-maildir for the messages in STORE."
(assoc-ref (store->alist store) 'root-maildir))
(define-method (root-maildir)
"Get the root-maildir for the messages in the default-store."
(root-maildir %default-store))
(define-method (personal-addresses (store <store>))
;; "Get the list of personal addresses in STORE."
(or (assoc-ref (store->alist store) 'personal-addresses) '()))
(define-method (personal-addresses)
"Get the list of personal addresses in the default-store."
(personal-addresses %default-store))
(define-method (mcount (store <store>))
;; "Get the number of messages in STORE."
;; "Get the number of messages in STORE."
(cc-store-mcount (cc-store store)))
(define-method (mcount)