;;; mumi -- Mediocre, uh, mail interface
-;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This program is free software: you can redistribute it and/or
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (ice-9 receive)
+ #:use-module (ice-9 iconv)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (syntax-highlight)
#:use-module (syntax-highlight scheme)
#:use-module (email email)
#:use-module (mumi messages)
+ #:use-module (rnrs bytevectors)
#:export (prettify
avatar-color
display-message-body))
(($ <mime-entity> headers (? string? body))
(apply display-multipart-chunk `(,headers ,body ,path)))
;; Message parts can be nested.
- (($ <mime-entity> headers sub-parts)
+ (($ <mime-entity> headers (? list? sub-parts))
(map (lambda (part sub-part-num)
(apply display-mime-entity part
(append path (list sub-part-num))))
sub-parts
- (iota (length sub-parts))))))
+ (iota (length sub-parts))))
+ ;; XXX: Sometimes we get an unparseable bytevector. Convert it
+ ;; when that happens.
+ (($ <mime-entity> headers (? bytevector? raw))
+ (apply display-multipart-chunk
+ `(,headers
+ ,(bytevector->string raw "ISO-8859-1")
+ ,path)))))
(cond
((multipart-message? message)
(let ((parts (email-body message)))