From: Tim Vaughan Date: Wed, 4 Sep 2019 14:47:17 +0000 (+0200) Subject: Tiny cleanup. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=eddd9a3e568bfc834ff297d129ef74162be37e23;p=lambdamail.git Tiny cleanup. --- diff --git a/lambdamail.scm b/lambdamail.scm index 55398dc..48383e4 100644 --- a/lambdamail.scm +++ b/lambdamail.scm @@ -156,27 +156,6 @@ (filter (lambda (msg) (not (deliver-message msg config))) messages)) -(define (get-local-addresses config) - (map (lambda (p) (cons - (conc "<" (car p) "@" (config-host config) ">") - (cdr p))) - (map (lambda (file) - (list (pathname-file file) file - (let ((password-file (conc file ".auth"))) - (if (file-exists? password-file) - (with-input-from-file password-file read-line) - #f)))) - (filter directory-exists? - (glob (conc (config-spool-dir config) "/*")))))) - -(define (deliver-message-local msg dest-dir) - (with-output-to-file (conc dest-dir "/" (current-seconds)) - (lambda () - (print (message-text msg))))) - -(define (deliver-message-remote msg) - (print "TODO")) - (define (deliver-message msg config) (let* ((local-addresses (get-local-addresses config)) (dest (assoc (message-to msg) local-addresses)) @@ -203,6 +182,32 @@ (print " * To: " (message-to msg)) #t) +;; Local delivery + +(define (get-local-addresses config) + (map (lambda (p) (cons + (conc "<" (car p) "@" (config-host config) ">") + (cdr p))) + (map (lambda (file) + (list (pathname-file file) file + (let ((password-file (conc file ".auth"))) + (if (file-exists? password-file) + (with-input-from-file password-file read-line) + #f)))) + (filter directory-exists? + (glob (conc (config-spool-dir config) "/*")))))) + +(define (deliver-message-local msg dest-dir) + (with-output-to-file (conc dest-dir "/" (current-seconds)) + (lambda () + (print (message-text msg))))) + + +;; Remote delivery + +(define (deliver-message-remote msg) + (print "TODO")) + ;;; Command line argument parsing ;;