From 113910906330a80385885fea49d57e9daaecabad Mon Sep 17 00:00:00 2001 From: sterni Date: Thu, 30 Mar 2023 17:36:29 +0200 Subject: 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 Tested-by: BuildkiteCI Reviewed-by: sterni --- third_party/lisp/mime4cl/default.nix | 2 +- third_party/lisp/mime4cl/endec.lisp | 6 +++--- third_party/lisp/mime4cl/package.lisp | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'third_party/lisp') diff --git a/third_party/lisp/mime4cl/default.nix b/third_party/lisp/mime4cl/default.nix index 349ef397f761..06831640968f 100644 --- a/third_party/lisp/mime4cl/default.nix +++ b/third_party/lisp/mime4cl/default.nix @@ -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 ]; diff --git a/third_party/lisp/mime4cl/endec.lisp b/third_party/lisp/mime4cl/endec.lisp index 020c212e5ec4..c17f4fcf6843 100644 --- a/third_party/lisp/mime4cl/endec.lisp +++ b/third_party/lisp/mime4cl/endec.lisp @@ -687,10 +687,10 @@ 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 - (intern (string-upcase (cdr part)) 'keyword)))) + :external-format (flexi-streams:make-external-format + (intern (string-upcase (cdr part)) 'keyword)))) (string part)))) (apply #'concatenate (cons 'string diff --git a/third_party/lisp/mime4cl/package.lisp b/third_party/lisp/mime4cl/package.lisp index 31cd85d54e24..e9ff14510d2b 100644 --- a/third_party/lisp/mime4cl/package.lisp +++ b/third_party/lisp/mime4cl/package.lisp @@ -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 -- cgit 1.4.1