refactor(3p/lisp/mime4cl): replace babel with flexi-streams

decode-RFC2047 used babel's octets-to-string, but we can replace it with
the function of the same name from flexi-streams. This doesn't make a
difference for the moment, but will be useful in the future:
flexi-streams provides de- and encoding streams that we'll be able to
use to replace and augment some of the stream based MIME part handling
code in mime4cl. babel doesn't have as powerful stream functionality
although it seems to be planned.

Another big upside of flexi-streams is that we'll be able to replace
delimited-input-string using it. This should allow us to slowly work
towards correct and more efficient decoding of MIME bodies.

Change-Id: I17174f1c96c5be7d103d396564e6aa0fe24c80fc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8371
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
sterni 2023-03-30 17:36:29 +02:00 committed by clbot
parent e292d82d83
commit 1139109063
3 changed files with 5 additions and 7 deletions

View file

@ -6,7 +6,7 @@ depot.nix.buildLisp.library {
name = "mime4cl";
deps = [
depot.third_party.lisp.babel
depot.third_party.lisp.flexi-streams
depot.third_party.lisp.npg
depot.third_party.lisp.trivial-gray-streams
];

View file

@ -687,9 +687,9 @@ sequence, a charset string indicating the original coding."
encountered, try to decode it using babel, otherwise signal an error."
(flet ((decode-part (part)
(etypecase part
(cons (babel:octets-to-string
(cons (flexi-streams:octets-to-string
(car part)
:encoding (babel-encodings:get-character-encoding
:external-format (flexi-streams:make-external-format
(intern (string-upcase (cdr part)) 'keyword))))
(string part))))
(apply #'concatenate

View file

@ -23,9 +23,7 @@
(defpackage :mime4cl
(:nicknames :mime)
(:use :common-lisp :npg :mime4cl-ex-sclf :trivial-gray-streams)
(:import-from :babel :octets-to-string)
(:import-from :babel-encodings :get-character-encoding)
(:use :common-lisp :npg :mime4cl-ex-sclf :trivial-gray-streams :flexi-streams)
(:export #:*lazy-mime-decode*
#:print-mime-part
#:read-mime-message