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

@ -84,6 +84,22 @@ exec guile -e main -s $0 $@
(str-equal-or-exit (mu:to msg) "Democritus <demo@example.com>")
(str-equal-or-exit (mu:from msg) "Richard P. Feynman <rpf@example.com>")
;;(str-equal-or-exit (mu:header msg "Content-Transfer-Encoding") "8bit")
(str-equal-or-exit (mu:body msg)
(string-join
'("If, in some cataclysm, all scientific knowledge were to be destroyed,"
"and only one sentence passed on to the next generation of creatures,"
"what statement would contain the most information in the fewest words?"
"I believe it is the atomic hypothesis (or atomic fact, or whatever you"
"wish to call it) that all things are made of atoms — little particles"
"that move around in perpetual motion, attracting each other when they"
"are a little distance apart, but repelling upon being squeezed into"
"one another. In that one sentence you will see an enormous amount of"
"information about the world, if just a little imagination and thinking"
"are applied.\n") "\n"))
(str-equal-or-exit (mu:body-txt msg) (mu:body msg))
(let ((got (mu:body-html msg)))
(if got
(error-exit "Expected #f, got ~a" got)))
(if (not (equal? (mu:priority msg) mu:prio:high))
(error-exit "Expected ~a, got ~a" (mu:priority msg) mu:prio:high))))