guile: Fix the mu:body message method

Somewhere along the way, the body-txt and body-html fields were merged
into a single body field. Later, commit 8eac392221 ("guile: re-enable
the guile support") finally removed support for Field::Id::BodyHtml from
mu:c:get-field.

Unfortunately mu.scm and the documentation are still stuck in the past, so
update them. mu:body-txt is now a synonym for mu:body, and mu:body-html
always returns #f.

I wanted to add a mu:body test also for the rfc822.1 message, but there's
currently a bug where its body text is is duplicated (issue #2802), so the
test would fail.
This commit is contained in:
Thiago Jung Bauermann
2025-01-02 14:01:35 -03:00
parent a703f00214
commit 606f4be74b
4 changed files with 33 additions and 7 deletions

View File

@ -38,8 +38,7 @@
mu:header
;; message accessors
mu:field:bcc
mu:field:body-html
mu:field:body-txt
mu:field:body
mu:field:cc
mu:field:date
mu:field:flags
@ -54,6 +53,9 @@
mu:field:tags
mu:field:timestamp
mu:field:to
;; deprecated message accessors
mu:body-html
mu:body-txt
;; contact funcs
mu:name
mu:email
@ -125,8 +127,7 @@
(export method-name)))))
(define-getter mu:bcc mu:field:bcc)
(define-getter mu:body-html mu:field:body-html)
(define-getter mu:body-txt mu:field:body-txt)
(define-getter mu:body mu:field:body)
(define-getter mu:cc mu:field:cc)
(define-getter mu:date mu:field:date)
(define-getter mu:flags mu:field:flags)
@ -142,6 +143,16 @@
(define-getter mu:timestamp mu:field:timestamp)
(define-getter mu:to mu:field:to)
(define-method (mu:body-html (msg <mu:message>))
"The HTML body isn't stored separately anymore, so this method can't return
anything useful. We keep it for backwards compatibility."
#f)
(define-method (mu:body-txt (msg <mu:message>))
"The text body isn't stored separately anymore. This method is now a synonym
for mu:body."
(mu:body msg))
(define-method (mu:header (msg <mu:message>) (hdr <string>))
"Get an arbitrary header HDR from message MSG; return #f if it does
not exist."