Accessing the headers of a MIME message feels like something mime4cl should handle. We implemented this ad hoc in mblog before in order to not need to worry about doing it in a sensible way. Now we introduce a decent-ish interface for getting a header from a MIME message, mime-message-header-values: * It returns a list because MIME message headers may appear multiple times. * It decodes RFC2047 only upon request, as you may want to be stricter about parsing certain fields. * It checks header name equality case insensitively. The code for decoding the RFC2047 string is retained and still uses babel for doing the actual decoding. Change-Id: I58bbbe4b46dbded04160b481a28a40d14775673d Reviewed-on: https://cl.tvl.fyi/c/depot/+/5150 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			955 B
		
	
	
	
		
			Common Lisp
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			955 B
		
	
	
	
		
			Common Lisp
		
	
	
	
	
	
| (defpackage :maildir
 | |
|   (:use :common-lisp)
 | |
|   (:shadow :list)
 | |
|   (:export :list)
 | |
|   (:documentation
 | |
|    "Very incomplete package for dealing with maildir(5)."))
 | |
| 
 | |
| (defpackage :note
 | |
|   (:use
 | |
|    :common-lisp
 | |
|    :closure-html
 | |
|    :cl-date-time-parser
 | |
|    :mime4cl)
 | |
|   (:import-from
 | |
|    :alexandria
 | |
|    :when-let*
 | |
|    :when-let
 | |
|    :starts-with-subseq
 | |
|    :ends-with-subseq)
 | |
|   (:import-from :who :escape-string-minimal)
 | |
|   (:export
 | |
|    :apple-note
 | |
|    :apple-note-uuid
 | |
|    :apple-note-subject
 | |
|    :apple-note-time
 | |
|    :apple-note-text-part
 | |
|    :make-apple-note
 | |
|    :apple-note-html-fragment))
 | |
| 
 | |
| (defpackage :mblog
 | |
|   (:use
 | |
|    :common-lisp
 | |
|    :klatre
 | |
|    :who
 | |
|    :maildir
 | |
|    :note)
 | |
|   (:export :build-mblog)
 | |
|   (:import-from :local-time :universal-to-timestamp)
 | |
|   (:import-from :sclf :pathname-as-directory)
 | |
|   (:shadowing-import-from :common-lisp :list))
 | |
| 
 | |
| (defpackage :cli
 | |
|   (:use
 | |
|    :common-lisp
 | |
|    :uiop
 | |
|    :note
 | |
|    :mblog)
 | |
|   (:import-from :alexandria :starts-with)
 | |
|   (:export :main))
 |