From e72aab4438fc90225fc05c084b6c0c665afab667 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 5 Feb 2001 17:45:42 +0000 Subject: [PATCH] Add procedures to access the user's email-address info. --- v7/src/edwin/edwin.pkg | 6 ++++-- v7/src/edwin/sendmail.scm | 29 +++++++++++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/v7/src/edwin/edwin.pkg b/v7/src/edwin/edwin.pkg index bf4c4602a..dd0da0700 100644 --- a/v7/src/edwin/edwin.pkg +++ b/v7/src/edwin/edwin.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: edwin.pkg,v 1.265 2000/12/01 06:07:21 cph Exp $ +$Id: edwin.pkg,v 1.266 2001/02/05 17:45:42 cph Exp $ Copyright (c) 1989-2000 Massachusetts Institute of Technology @@ -1496,6 +1496,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. mail-field-region mail-field-start mail-from-string + mail-full-name mail-header-end mail-insert-field mail-insert-field-value @@ -1511,7 +1512,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. prepare-mail-buffer-for-sending random-mime-boundary-string send-mail-buffer - set-buffer-mime-attachments!)) + set-buffer-mime-attachments! + user-mail-address)) (define-package (edwin mail-alias) (files "malias") diff --git a/v7/src/edwin/sendmail.scm b/v7/src/edwin/sendmail.scm index 842499278..649d0a304 100644 --- a/v7/src/edwin/sendmail.scm +++ b/v7/src/edwin/sendmail.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: sendmail.scm,v 1.71 2000/11/30 17:22:55 cph Exp $ +;;; $Id: sendmail.scm,v 1.72 2001/02/05 17:45:37 cph Exp $ ;;; ;;; Copyright (c) 1991-2000 Massachusetts Institute of Technology ;;; @@ -38,8 +38,8 @@ after your init file is read, in case it sets `mail-host-address'." "Your full name. Appears in the From: field of mail and news messages, following the address. If set to the null string, From: field contains only the email address." - "" - string?) + #f + string-or-false?) (define-variable mail-from-style "Specifies how \"From:\" fields look. @@ -344,22 +344,27 @@ is inserted." (add "FCC" (ref-variable mail-archive-file-name buffer))))) (define (mail-from-string buffer) - (let ((address - (or (ref-variable user-mail-address buffer) - (string-append (current-user-name) - "@" - (or (ref-variable mail-host-address buffer) - (os/hostname))))) - (full-name (ref-variable mail-full-name buffer))) + (let ((address (user-mail-address buffer)) + (full-name (mail-full-name buffer))) (if (string-null? full-name) address (case (ref-variable mail-from-style buffer) ((PARENS) (string-append address " (" full-name ")")) ((ANGLES) - (string-append (rfc822:quote-string full-name) - " <" address ">")) + (string-append (rfc822:quote-string full-name) " <" address ">")) (else address))))) + +(define (user-mail-address buffer) + (or (ref-variable user-mail-address buffer) + (string-append (current-user-name) + "@" + (or (ref-variable mail-host-address buffer) + (os/hostname))))) + +(define (mail-full-name buffer) + (or (ref-variable mail-full-name buffer) + "")) (define-variable mail-setup-hook "An event distributor invoked immediately after a mail buffer is initialized. -- 2.25.1