comparison lisp/gnus/mml.el @ 90223:edf295560b5a

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-77 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 504-513) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: .cvsignore: Add `lock'. * gnus--rel--5.10 (patch 99-103) - Update from CVS
author Miles Bader <miles@gnu.org>
date Fri, 05 Aug 2005 10:57:36 +0000
parents 187d6a1f84f7 4db92b217e85
children 2d92f5c9d6ae
comparison
equal deleted inserted replaced
90222:709f27353024 90223:edf295560b5a
121 `unknown-encoding': always send messages contain characters with 121 `unknown-encoding': always send messages contain characters with
122 unknown encoding; `use-ascii': always use ASCII for those characters 122 unknown encoding; `use-ascii': always use ASCII for those characters
123 with unknown encoding; `multipart': always send messages with more than 123 with unknown encoding; `multipart': always send messages with more than
124 one charsets.") 124 one charsets.")
125 125
126 (defvar mml-generate-default-type "text/plain") 126 (defvar mml-generate-default-type "text/plain"
127 "Content type by which the Content-Type header can be omitted.
128 The Content-Type header will not be put in the MIME part if the type
129 equals the value and there's no parameter (e.g. charset, format, etc.)
130 and `mml-insert-mime-headers-always' is nil. The value will be bound
131 to \"message/rfc822\" when encoding an article to be forwarded as a MIME
132 part. This is for the internal use, you should never modify the value.")
127 133
128 (defvar mml-buffer-list nil) 134 (defvar mml-buffer-list nil)
129 135
130 (defun mml-generate-new-buffer (name) 136 (defun mml-generate-new-buffer (name)
131 (let ((buf (generate-new-buffer name))) 137 (let ((buf (generate-new-buffer name)))
397 (save-restriction 403 (save-restriction
398 (narrow-to-region (point) (point)) 404 (narrow-to-region (point) (point))
399 (mml-tweak-part cont) 405 (mml-tweak-part cont)
400 (cond 406 (cond
401 ((or (eq (car cont) 'part) (eq (car cont) 'mml)) 407 ((or (eq (car cont) 'part) (eq (car cont) 'mml))
402 (let ((raw (cdr (assq 'raw cont))) 408 (let* ((raw (cdr (assq 'raw cont)))
403 coded encoding charset filename type flowed) 409 (filename (cdr (assq 'filename cont)))
404 (setq type (or (cdr (assq 'type cont)) "text/plain")) 410 (type (or (cdr (assq 'type cont))
411 (if filename
412 (or (mm-default-file-encoding filename)
413 "application/octet-stream")
414 "text/plain")))
415 coded encoding charset flowed)
405 (if (and (not raw) 416 (if (and (not raw)
406 (member (car (split-string type "/")) '("text" "message"))) 417 (member (car (split-string type "/")) '("text" "message")))
407 (progn 418 (progn
408 (with-temp-buffer 419 (with-temp-buffer
409 (setq charset (mm-charset-to-coding-system 420 (setq charset (mm-charset-to-coding-system
411 (when (eq charset 'ascii) 422 (when (eq charset 'ascii)
412 (setq charset nil)) 423 (setq charset nil))
413 (cond 424 (cond
414 ((cdr (assq 'buffer cont)) 425 ((cdr (assq 'buffer cont))
415 (insert-buffer-substring (cdr (assq 'buffer cont)))) 426 (insert-buffer-substring (cdr (assq 'buffer cont))))
416 ((and (setq filename (cdr (assq 'filename cont))) 427 ((and filename
417 (not (equal (cdr (assq 'nofile cont)) "yes"))) 428 (not (equal (cdr (assq 'nofile cont)) "yes")))
418 (let ((coding-system-for-read charset)) 429 (let ((coding-system-for-read charset))
419 (mm-insert-file-contents filename))) 430 (mm-insert-file-contents filename)))
420 ((eq 'mml (car cont)) 431 ((eq 'mml (car cont))
421 (insert (cdr (assq 'contents cont)))) 432 (insert (cdr (assq 'contents cont))))
431 (delete-region (+ (match-beginning 0) 2) 442 (delete-region (+ (match-beginning 0) 2)
432 (+ (match-beginning 0) 3)))))) 443 (+ (match-beginning 0) 3))))))
433 (cond 444 (cond
434 ((eq (car cont) 'mml) 445 ((eq (car cont) 'mml)
435 (let ((mml-boundary (mml-compute-boundary cont)) 446 (let ((mml-boundary (mml-compute-boundary cont))
447 ;; It is necessary for the case where this
448 ;; function is called recursively since
449 ;; `m-g-d-t' will be bound to "message/rfc822"
450 ;; when encoding an article to be forwarded.
436 (mml-generate-default-type "text/plain")) 451 (mml-generate-default-type "text/plain"))
437 (mml-to-mime)) 452 (mml-to-mime))
438 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) 453 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
439 ;; ignore 0x1b, it is part of iso-2022-jp 454 ;; ignore 0x1b, it is part of iso-2022-jp
440 (setq encoding (mm-body-7-or-8)))) 455 (setq encoding (mm-body-7-or-8))))
472 (cond 487 (cond
473 ((cdr (assq 'buffer cont)) 488 ((cdr (assq 'buffer cont))
474 (insert (with-current-buffer (cdr (assq 'buffer cont)) 489 (insert (with-current-buffer (cdr (assq 'buffer cont))
475 (mm-with-unibyte-current-buffer 490 (mm-with-unibyte-current-buffer
476 (buffer-string))))) 491 (buffer-string)))))
477 ((and (setq filename (cdr (assq 'filename cont))) 492 ((and filename
478 (not (equal (cdr (assq 'nofile cont)) "yes"))) 493 (not (equal (cdr (assq 'nofile cont)) "yes")))
479 (let ((coding-system-for-read mm-binary-coding-system)) 494 (let ((coding-system-for-read mm-binary-coding-system))
480 (mm-insert-file-contents filename nil nil nil nil t))) 495 (mm-insert-file-contents filename nil nil nil nil t)))
481 (t 496 (t
482 (insert (cdr (assq 'contents cont))))) 497 (insert (cdr (assq 'contents cont)))))
513 (mml-insert-parameter 528 (mml-insert-parameter
514 (mail-header-encode-parameter "url" url) 529 (mail-header-encode-parameter "url" url)
515 "access-type=url")) 530 "access-type=url"))
516 (when parameters 531 (when parameters
517 (mml-insert-parameter-string 532 (mml-insert-parameter-string
518 cont '(expiration size permission)))) 533 cont '(expiration size permission)))
519 (insert "\n\n") 534 (insert "\n\n")
520 (insert "Content-Type: " (cdr (assq 'type cont)) "\n") 535 (insert "Content-Type: "
521 (insert "Content-ID: " (message-make-message-id) "\n") 536 (or (cdr (assq 'type cont))
522 (insert "Content-Transfer-Encoding: " 537 (if name
523 (or (cdr (assq 'encoding cont)) "binary")) 538 (or (mm-default-file-encoding name)
524 (insert "\n\n") 539 "application/octet-stream")
525 (insert (or (cdr (assq 'contents cont)))) 540 "text/plain"))
526 (insert "\n")) 541 "\n")
542 (insert "Content-ID: " (message-make-message-id) "\n")
543 (insert "Content-Transfer-Encoding: "
544 (or (cdr (assq 'encoding cont)) "binary"))
545 (insert "\n\n")
546 (insert (or (cdr (assq 'contents cont))))
547 (insert "\n")))
527 ((eq (car cont) 'multipart) 548 ((eq (car cont) 'multipart)
528 (let* ((type (or (cdr (assq 'type cont)) "mixed")) 549 (let* ((type (or (cdr (assq 'type cont)) "mixed"))
529 (mml-generate-default-type (if (equal type "digest") 550 (mml-generate-default-type (if (equal type "digest")
530 "message/rfc822" 551 "message/rfc822"
531 "text/plain")) 552 "text/plain"))
557 (when (setq sender (cdr (assq 'sender cont))) 578 (when (setq sender (cdr (assq 'sender cont)))
558 (message-options-set 'mml-sender sender) 579 (message-options-set 'mml-sender sender)
559 (message-options-set 'message-sender sender)) 580 (message-options-set 'message-sender sender))
560 (if (setq recipients (cdr (assq 'recipients cont))) 581 (if (setq recipients (cdr (assq 'recipients cont)))
561 (message-options-set 'message-recipients recipients)) 582 (message-options-set 'message-recipients recipients))
562 (let ((style (mml-signencrypt-style (first (or sign-item encrypt-item))))) 583 (let ((style (mml-signencrypt-style
584 (first (or sign-item encrypt-item)))))
563 ;; check if: we're both signing & encrypting, both methods 585 ;; check if: we're both signing & encrypting, both methods
564 ;; are the same (why would they be different?!), and that 586 ;; are the same (why would they be different?!), and that
565 ;; the signencrypt style allows for combined operation. 587 ;; the signencrypt style allows for combined operation.
566 (if (and sign-item encrypt-item (equal (first sign-item) 588 (if (and sign-item encrypt-item (equal (first sign-item)
567 (first encrypt-item)) 589 (first encrypt-item))