*** /tmp/T0a005Rx	Sun Sep 21 14:31:37 1997
--- message.el	Sun Sep 21 14:30:04 1997
***************
*** 538,561 ****
    "A list of actions to be performed after postponing a message.")
  
  (defcustom message-default-headers ""
!   "*A string containing header lines to be inserted in outgoing messages.
  It is inserted before you edit the message, so you can edit or delete
! these lines."
    :group 'message-headers
!   :type 'string)
  
  (defcustom message-default-mail-headers ""
!   "*A string of header lines to be inserted in outgoing mails."
    :group 'message-headers
    :group 'message-mail
!   :type 'string)
  
  (defcustom message-default-news-headers ""
!   "*A string of header lines to be inserted in outgoing news
! articles."
    :group 'message-headers
    :group 'message-news
!   :type 'string)
  
  ;; Note: could use /usr/ucb/mail instead of sendmail;
  ;; options -t, and -v if not interactive.
--- 538,580 ----
    "A list of actions to be performed after postponing a message.")
  
  (defcustom message-default-headers ""
!   "*Header lines to be inserted in outgoing messages.
  It is inserted before you edit the message, so you can edit or delete
! these lines.  It can be one of three things:
!      1) A string to be inserted as-is
!      2) A function that, when evaluated, will return a string
!   or 3) A list of one or more of the above."
    :group 'message-headers
!   :type '(choice string
! 		 (function fun)
! 		 (list (choice string
! 			       (function fun)))))
  
  (defcustom message-default-mail-headers ""
!   "*Header lines to be inserted in outgoing mails.
! This can be one of three things:
!      1) A string to be inserted as-is
!      2) A function that, when evaluated, will return a string
!   or 3) A list of one or more of the above."
    :group 'message-headers
    :group 'message-mail
!   :type '(choice string
! 		 (function fun)
! 		 (list (choice string
! 			       (function fun)))))
  
  (defcustom message-default-news-headers ""
!   "*Header lines to be inserted in outgoing news.
! This can be one of three things:
!      1) A string to be inserted as-is
!      2) A function that, when evaluated, will return a string
!   or 3) A list of one or more of the above."
    :group 'message-headers
    :group 'message-news
!   :type '(choice string
! 		 (function fun)
! 		 (list (choice string
! 			       (function fun)))))
  
  ;; Note: could use /usr/ucb/mail instead of sendmail;
  ;; options -t, and -v if not interactive.
***************
*** 2696,2701 ****
--- 2715,2746 ----
    (or mail-host-address
        (message-make-fqdn)))
  
+ (defun message-make-default-headers (hlist)
+   "Return default mail headers.
+ Build string consisting of headers indicated by hlist.  (See documentation
+ for `message-default-headers', `message-default-mail-headers' and
+ `message-default-news-headers')"
+   (let ((retstr nil)
+ 	thishdr)
+     (if (not (listp hlist))
+ 	(setq hlist (list hlist)))
+     (while hlist
+       (setq thishdr (pop hlist))
+       (setq retstr
+ 	    (concat retstr
+ 		    (cond ((stringp thishdr)
+ 			   thishdr)
+ 			  ((functionp thishdr)
+ 			   (funcall thishdr))
+ 			  ((listp thishdr)
+ 			   ;; anybody who needs this code has issues
+ 			   (setq hlist (append thishdr hlist))
+ 			   nil)
+ 			  (t (error "Unknown header element %S" thishdr))))))
+     retstr))
+ 	     
+     
+ 
  (defun message-generate-headers (headers)
    "Prepare article HEADERS.
  Headers already prepared in the buffer are not modified."
***************
*** 2997,3003 ****
     headers)
    (delete-region (point) (progn (forward-line -1) (point)))
    (when message-default-headers
!     (insert message-default-headers))
    (put-text-property
     (point)
     (progn
--- 3042,3048 ----
     headers)
    (delete-region (point) (progn (forward-line -1) (point)))
    (when message-default-headers
!     (insert (message-make-default-headers message-default-headers)))
    (put-text-property
     (point)
     (progn
***************
*** 3007,3013 ****
    (forward-line -1)
    (when (message-news-p)
      (when message-default-news-headers
!       (insert message-default-news-headers))
      (when message-generate-headers-first
        (message-generate-headers
         (delq 'Lines
--- 3052,3058 ----
    (forward-line -1)
    (when (message-news-p)
      (when message-default-news-headers
!       (insert (message-make-default-headers message-default-news-headers)))
      (when message-generate-headers-first
        (message-generate-headers
         (delq 'Lines
***************
*** 3015,3021 ****
  		   (copy-sequence message-required-news-headers))))))
    (when (message-mail-p)
      (when message-default-mail-headers
!       (insert message-default-mail-headers))
      (when message-generate-headers-first
        (message-generate-headers
         (delq 'Lines
--- 3060,3066 ----
  		   (copy-sequence message-required-news-headers))))))
    (when (message-mail-p)
      (when message-default-mail-headers
!       (insert (message-make-default-headers message-default-mail-headers)))
      (when message-generate-headers-first
        (message-generate-headers
         (delq 'Lines
