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>
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
# Copyright (C) 2021 by the TVL Authors
 | 
						|
# SPDX-License-Identifier: LGPL-2.1-or-later
 | 
						|
{ depot, pkgs, ... }:
 | 
						|
 | 
						|
depot.nix.buildLisp.library {
 | 
						|
  name = "mime4cl";
 | 
						|
 | 
						|
  deps = [
 | 
						|
    depot.third_party.lisp.babel
 | 
						|
    depot.third_party.lisp.sclf
 | 
						|
    depot.third_party.lisp.npg
 | 
						|
    depot.third_party.lisp.trivial-gray-streams
 | 
						|
  ];
 | 
						|
 | 
						|
  srcs = [
 | 
						|
    ./package.lisp
 | 
						|
    ./endec.lisp
 | 
						|
    ./streams.lisp
 | 
						|
    ./mime.lisp
 | 
						|
    ./address.lisp
 | 
						|
  ];
 | 
						|
 | 
						|
  tests = {
 | 
						|
    name = "mime4cl-tests";
 | 
						|
 | 
						|
    srcs = [
 | 
						|
      ./test/rt.lisp
 | 
						|
      ./test/package.lisp
 | 
						|
      (pkgs.writeText "nix-samples.lisp" ''
 | 
						|
        (in-package :mime4cl-tests)
 | 
						|
 | 
						|
        ;; missing from the tarball completely
 | 
						|
        (defvar *samples-directory* (pathname "/this/does/not/exist"))
 | 
						|
        ;; override auto discovery which doesn't work in store
 | 
						|
        (defvar *sample1-file* (pathname "${./test/sample1.msg}"))
 | 
						|
      '')
 | 
						|
      ./test/endec.lisp
 | 
						|
      ./test/address.lisp
 | 
						|
      ./test/mime.lisp
 | 
						|
    ];
 | 
						|
 | 
						|
    expression = "(rtest:do-tests)";
 | 
						|
  };
 | 
						|
 | 
						|
  # limited by sclf
 | 
						|
  brokenOn = [
 | 
						|
    "ccl"
 | 
						|
    "ecl"
 | 
						|
  ];
 | 
						|
}
 |