39 |
(defvar mml-generate-multipart-alist nil |
(defvar mml-generate-multipart-alist nil |
40 |
"*Alist of multipart generation functions. |
"*Alist of multipart generation functions. |
41 |
Each entry has the form (NAME . FUNCTION), where |
Each entry has the form (NAME . FUNCTION), where |
42 |
NAME is a string containing the name of the part (without the |
NAME is a string containing the name of the part (without the |
43 |
leading \"/multipart/\"), |
leading \"/multipart/\"), |
44 |
FUNCTION is a Lisp function which is called to generate the part. |
FUNCTION is a Lisp function which is called to generate the part. |
45 |
|
|
75 |
|
|
76 |
(defvar mml-generate-mime-preprocess-function nil |
(defvar mml-generate-mime-preprocess-function nil |
77 |
"A function called before generating a mime part. |
"A function called before generating a mime part. |
78 |
The function is called with one parameter, which is the part to be |
The function is called with one parameter, which is the part to be |
79 |
generated.") |
generated.") |
80 |
|
|
81 |
(defvar mml-generate-mime-postprocess-function nil |
(defvar mml-generate-mime-postprocess-function nil |
86 |
|
|
87 |
(defvar mml-buffer-list nil) |
(defvar mml-buffer-list nil) |
88 |
|
|
89 |
(defun mml-generate-new-buffer (name) |
(defun mml-generate-new-buffer (name) |
90 |
(let ((buf (generate-new-buffer name))) |
(let ((buf (generate-new-buffer name))) |
91 |
(push buf mml-buffer-list) |
(push buf mml-buffer-list) |
92 |
buf)) |
buf)) |
128 |
(setq raw (cdr (assq 'raw tag)) |
(setq raw (cdr (assq 'raw tag)) |
129 |
point (point) |
point (point) |
130 |
contents (mml-read-part (eq 'mml (car tag))) |
contents (mml-read-part (eq 'mml (car tag))) |
131 |
charsets (if raw nil |
charsets (if raw nil |
132 |
(mm-find-mime-charset-region point (point)))) |
(mm-find-mime-charset-region point (point)))) |
133 |
(when (and (not raw) (memq nil charsets)) |
(when (and (not raw) (memq nil charsets)) |
134 |
(if (or (memq 'unknown-encoding mml-confirmation-set) |
(if (or (memq 'unknown-encoding mml-confirmation-set) |
137 |
Message contains characters with unknown encoding. Really send?") |
Message contains characters with unknown encoding. Really send?") |
138 |
(set (make-local-variable 'mml-confirmation-set) |
(set (make-local-variable 'mml-confirmation-set) |
139 |
(push 'unknown-encoding mml-confirmation-set)))) |
(push 'unknown-encoding mml-confirmation-set)))) |
140 |
(if (setq use-ascii |
(if (setq use-ascii |
141 |
(or (memq 'use-ascii mml-confirmation-set) |
(or (memq 'use-ascii mml-confirmation-set) |
142 |
(y-or-n-p "Use ASCII as charset?"))) |
(y-or-n-p "Use ASCII as charset?"))) |
143 |
(setq charsets (delq nil charsets)) |
(setq charsets (delq nil charsets)) |
169 |
(forward-line 1)) |
(forward-line 1)) |
170 |
(nreverse struct))) |
(nreverse struct))) |
171 |
|
|
172 |
(defun mml-parse-singlepart-with-multiple-charsets |
(defun mml-parse-singlepart-with-multiple-charsets |
173 |
(orig-tag beg end &optional use-ascii) |
(orig-tag beg end &optional use-ascii) |
174 |
(save-excursion |
(save-excursion |
175 |
(save-restriction |
(save-restriction |
261 |
(if (re-search-forward "<#\\(/\\)?mml." nil t) |
(if (re-search-forward "<#\\(/\\)?mml." nil t) |
262 |
(setq count (+ count (if (match-beginning 1) -1 1))) |
(setq count (+ count (if (match-beginning 1) -1 1))) |
263 |
(goto-char (point-max)))) |
(goto-char (point-max)))) |
264 |
(buffer-substring-no-properties beg (if (> count 0) |
(buffer-substring-no-properties beg (if (> count 0) |
265 |
(point) |
(point) |
266 |
(match-beginning 0)))) |
(match-beginning 0)))) |
267 |
(if (re-search-forward |
(if (re-search-forward |
325 |
"<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t) |
"<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t) |
326 |
(delete-region (+ (match-beginning 0) 2) |
(delete-region (+ (match-beginning 0) 2) |
327 |
(+ (match-beginning 0) 3)))))) |
(+ (match-beginning 0) 3)))))) |
328 |
(cond |
(cond |
329 |
((eq (car cont) 'mml) |
((eq (car cont) 'mml) |
330 |
(let ((mml-boundary (funcall mml-boundary-function |
(let ((mml-boundary (funcall mml-boundary-function |
331 |
(incf mml-multipart-number))) |
(incf mml-multipart-number))) |
338 |
(let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) |
(let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) |
339 |
;; ignore 0x1b, it is part of iso-2022-jp |
;; ignore 0x1b, it is part of iso-2022-jp |
340 |
(setq encoding (mm-body-7-or-8)))) |
(setq encoding (mm-body-7-or-8)))) |
341 |
(t |
(t |
342 |
(setq charset (mm-encode-body)) |
(setq charset (mm-encode-body)) |
343 |
(setq encoding (mm-body-encoding |
(setq encoding (mm-body-encoding |
344 |
charset (cdr (assq 'encoding cont)))))) |
charset (cdr (assq 'encoding cont)))))) |
579 |
(save-excursion |
(save-excursion |
580 |
(set-buffer (setq buffer (mml-generate-new-buffer " *mml*"))) |
(set-buffer (setq buffer (mml-generate-new-buffer " *mml*"))) |
581 |
(mm-insert-part handle) |
(mm-insert-part handle) |
582 |
(if (setq mmlp (equal (mm-handle-media-type handle) |
(if (setq mmlp (equal (mm-handle-media-type handle) |
583 |
"message/rfc822")) |
"message/rfc822")) |
584 |
(mime-to-mml))))) |
(mime-to-mml))))) |
585 |
(if mmlp |
(if mmlp |
588 |
(equal (mm-handle-media-type handle) "text/plain")) |
(equal (mm-handle-media-type handle) "text/plain")) |
589 |
(mml-insert-mml-markup handle buffer textp))) |
(mml-insert-mml-markup handle buffer textp))) |
590 |
(cond |
(cond |
591 |
(mmlp |
(mmlp |
592 |
(insert-buffer buffer) |
(insert-buffer buffer) |
593 |
(goto-char (point-max)) |
(goto-char (point-max)) |
594 |
(insert "<#/mml>\n")) |
(insert "<#/mml>\n")) |
828 |
If RAW, don't highlight the article." |
If RAW, don't highlight the article." |
829 |
(interactive "P") |
(interactive "P") |
830 |
(let ((buf (current-buffer)) |
(let ((buf (current-buffer)) |
831 |
(message-posting-charset (or (gnus-setup-posting-charset |
(message-posting-charset (or (gnus-setup-posting-charset |
832 |
(save-restriction |
(save-restriction |
833 |
(message-narrow-to-headers-or-head) |
(message-narrow-to-headers-or-head) |
834 |
(message-fetch-field "Newsgroups"))) |
(message-fetch-field "Newsgroups"))) |
835 |
message-posting-charset))) |
message-posting-charset))) |
836 |
(switch-to-buffer (get-buffer-create |
(switch-to-buffer (get-buffer-create |
837 |
(concat (if raw "*Raw MIME preview of " |
(concat (if raw "*Raw MIME preview of " |
838 |
"*MIME preview of ") (buffer-name)))) |
"*MIME preview of ") (buffer-name)))) |
839 |
(erase-buffer) |
(erase-buffer) |