Sync up with Pteruductyl Gnus v0.71
[elisp/gnus.git-] / lisp / message.el
index dfd744a..08564c9 100644 (file)
@@ -1,5 +1,5 @@
 ;;; message.el --- composing mail and news messages
-;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
+;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
@@ -621,8 +621,7 @@ The function `message-supersede' runs this hook."
 
 ;;;###autoload
 (defcustom message-yank-prefix "> "
-  "*Prefix inserted on the lines of yanked messages.
-nil means use indentation."
+  "*Prefix inserted on the lines of yanked messages."
   :type 'string
   :group 'message-insertion)
 
@@ -1035,17 +1034,13 @@ The cdr of ech entry is a function for applying the face to a region.")
 
 (defvar message-draft-coding-system 
   (cond 
-   ((not (fboundp 'coding-system-p)) nil)
-   ((coding-system-p 'emacs-mule) 'emacs-mule)
-   ((coding-system-p 'escape-quoted) 'escape-quoted)
-   ((coding-system-p 'no-conversion) 'no-conversion)
+   ((not (fboundp 'find-coding-system)) nil)
+   ((find-coding-system 'emacs-mule) 'emacs-mule)
+   ((find-coding-system 'escape-quoted) 'escape-quoted)
+   ((find-coding-system 'no-conversion) 'no-conversion)
    (t nil))
   "Coding system to compose mail.")
 
-(defvar message-default-charset 'iso-8859-1
-  "Default charset assumed to be used when viewing non-ASCII characters.
-This variable is used only in non-Mule Emacsen.")
-
 ;;; Internal variables.
 
 (defvar message-buffer-list nil)
@@ -1053,6 +1048,7 @@ This variable is used only in non-Mule Emacsen.")
 (defvar message-this-is-mail nil)
 (defvar message-draft-article nil)
 (defvar message-mime-part nil)
+(defvar message-posting-charset nil)
 
 ;; Byte-compiler warning
 (defvar gnus-active-hashtb)
@@ -4852,8 +4848,7 @@ TYPE is the MIME type to use."
           type (prin1-to-string file))))
 
 (defun message-encode-message-body ()
-  (let ((mm-default-charset message-default-charset)
-       lines multipart-p)
+  (let (lines multipart-p content-type-p)
     (message-goto-body)
     (save-restriction
       (narrow-to-region (point) (point-max))
@@ -4875,7 +4870,10 @@ TYPE is the MIME type to use."
       (when lines
        (insert lines))
       (setq multipart-p
-           (re-search-backward "^Content-Type: multipart/" nil t)))
+           (re-search-backward "^Content-Type: multipart/" nil t))
+      (goto-char (point-max))
+      (setq content-type-p
+           (re-search-backward "^Content-Type:" nil t)))
     (save-restriction
       (message-narrow-to-headers-or-head)
       (message-remove-first-header "Content-Type")
@@ -4887,7 +4885,17 @@ TYPE is the MIME type to use."
        (message-remove-first-header "Content-Transfer-Encoding"))
       (message-goto-body)
       (insert "This is a MIME multipart message.  If you are reading\n")
-      (insert "this, you shouldn't.\n"))))
+      (insert "this, you shouldn't.\n"))
+    ;; We always make sure that the message has a Content-Type header.
+    ;; This is because some broken MTAs and MUAs get awfully confused
+    ;; when confronted with a message with a MIME-Version header and
+    ;; without a Content-Type header.  For instance, Solaris'
+    ;; /usr/bin/mail.
+    (unless content-type-p
+      (goto-char (point-min))
+      (re-search-forward "^MIME-Version:")
+      (forward-line 1)
+      (insert "Content-Type: text/plain; charset=us-ascii\n"))))
 
 (defvar message-save-buffer " *encoding")
 (defun message-save-drafts ()