Commit 7828001a authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Allow the user to specify Content-type in Message mode

* lisp/gnus/message.el (message-encode-message-body): Pass in the
content type if the user has given one.

* lisp/gnus/mml.el (mml-parse-1): Remove bogus peek at
Content-type (there are no headers here)  (bug#36527).

* lisp/gnus/mml.el (mml-generate-mime): Respect that.
parent c56fabdf
Pipeline #3227 passed with stage
in 65 minutes and 26 seconds
......@@ -8061,7 +8061,10 @@ regexp VARSTR."
(narrow-to-region (point) (point-max))
(let ((new (mml-generate-mime)))
(let ((new (mml-generate-mime nil
(mail-fetch-field "content-type")))))
(when new
(delete-region (point-min) (point-max))
(insert new)
......@@ -295,14 +295,6 @@ part. This is for the internal use, you should never modify the value.")
(mm-find-mime-charset-region point (point)
;; If the user has inserted a Content-Type header, then
;; respect that instead of overwriting with "text/plain".
(narrow-to-region point (point))
(let ((content-type (mail-fetch-field "content-type")))
(when (and content-type
(eq (car tag) 'part))
(setcdr (assq 'type tag) content-type))))
(when (and (not raw) (memq nil charsets))
(if (or (memq 'unknown-encoding mml-confirmation-set)
(message-options-get 'unknown-encoding)
......@@ -479,15 +471,22 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
(declare-function libxml-parse-html-region "xml.c"
(start end &optional base-url discard-comments))
(defun mml-generate-mime (&optional multipart-type)
(defun mml-generate-mime (&optional multipart-type content-type)
"Generate a MIME message based on the current MML document.
MULTIPART-TYPE defaults to \"mixed\", but can also
be \"related\" or \"alternate\"."
be \"related\" or \"alternate\".
If CONTENT-TYPE (and there's only one part), override the content
type detected."
(let ((cont (mml-parse))
(mml-multipart-number mml-multipart-number)
(options message-options))
(if (not cont)
(when (and (consp (car cont))
(= (length cont) 1)
(setcdr (assq 'type (cdr (car cont))) content-type))
(when (and (consp (car cont))
(= (length cont) 1)
(fboundp 'libxml-parse-html-region)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment