comparison lisp/vm/vm-reply.el @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 49a24b4fd526
children 4103f0995bd7
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
1 ;;; Mailing, forwarding, and replying commands for VM 1 ;;; Mailing, forwarding, and replying commands for VM
2 ;;; Copyright (C) 1989, 1990, 1991, 1993, 1994, 1995 Kyle E. Jones 2 ;;; Copyright (C) 1989-1997 Kyle E. Jones
3 ;;; 3 ;;;
4 ;;; This program is free software; you can redistribute it and/or modify 4 ;;; This program is free software; you can redistribute it and/or modify
5 ;;; it under the terms of the GNU General Public License as published by 5 ;;; it under the terms of the GNU General Public License as published by
6 ;;; the Free Software Foundation; either version 1, or (at your option) 6 ;;; the Free Software Foundation; either version 1, or (at your option)
7 ;;; any later version. 7 ;;; any later version.
27 (while mp 27 (while mp
28 (cond 28 (cond
29 ((eq mlist mp) 29 ((eq mlist mp)
30 (cond ((setq to 30 (cond ((setq to
31 (let ((reply-to 31 (let ((reply-to
32 (vm-get-header-contents (car mp) "Reply-To:"))) 32 (vm-get-header-contents (car mp) "Reply-To:"
33 ", ")))
33 (if (vm-ignored-reply-to reply-to) 34 (if (vm-ignored-reply-to reply-to)
34 nil 35 nil
35 reply-to )))) 36 reply-to ))))
36 ((setq to (vm-get-header-contents (car mp) "From:"))) 37 ((setq to (vm-get-header-contents (car mp) "From:" ", ")))
37 ;; bad, but better than nothing for some 38 ;; bad, but better than nothing for some
38 ((setq to (vm-grok-From_-author (car mp)))) 39 ((setq to (vm-grok-From_-author (car mp))))
39 (t (error "No From: or Reply-To: header in message"))) 40 (t (error "No From: or Reply-To: header in message")))
40 (setq subject (vm-get-header-contents (car mp) "Subject:") 41 (setq subject (vm-get-header-contents (car mp) "Subject:")
41 in-reply-to 42 in-reply-to
49 (equal 50 (equal
50 (string-match (regexp-quote vm-reply-subject-prefix) 51 (string-match (regexp-quote vm-reply-subject-prefix)
51 subject) 52 subject)
52 0))) 53 0)))
53 (setq subject (concat vm-reply-subject-prefix subject)))) 54 (setq subject (concat vm-reply-subject-prefix subject))))
54 (t (cond ((setq tmp (vm-get-header-contents (car mp) "Reply-To:")) 55 (t (cond ((setq tmp (vm-get-header-contents (car mp) "Reply-To:"
56 ", "))
55 (setq to (concat to "," tmp))) 57 (setq to (concat to "," tmp)))
56 ((setq tmp (vm-get-header-contents (car mp) "From:")) 58 ((setq tmp (vm-get-header-contents (car mp) "From:"
59 ", "))
57 (setq to (concat to "," tmp))) 60 (setq to (concat to "," tmp)))
58 ;; bad, but better than nothing for some 61 ;; bad, but better than nothing for some
59 ((setq tmp (vm-grok-From_-author (car mp))) 62 ((setq tmp (vm-grok-From_-author (car mp)))
60 (setq to (concat to "," tmp))) 63 (setq to (concat to "," tmp)))
61 (t (error "No From: or Reply-To: header in message"))))) 64 (t (error "No From: or Reply-To: header in message")))))
62 (if to-all 65 (if to-all
63 (progn 66 (progn
64 (setq tmp (vm-get-header-contents (car mp) "To:")) 67 (setq tmp (vm-get-header-contents (car mp) "To:"
65 (setq tmp2 (vm-get-header-contents (car mp) "Cc:")) 68 ", "))
69 (setq tmp2 (vm-get-header-contents (car mp) "Cc:"
70 ", "))
66 (if tmp 71 (if tmp
67 (if cc 72 (if cc
68 (setq cc (concat cc "," tmp)) 73 (setq cc (concat cc "," tmp))
69 (setq cc tmp))) 74 (setq cc tmp)))
70 (if tmp2 75 (if tmp2
71 (if cc 76 (if cc
72 (setq cc (concat cc "," tmp2)) 77 (setq cc (concat cc "," tmp2))
73 (setq cc tmp2))))) 78 (setq cc tmp2)))))
74 (setq references 79 (setq references
75 (cons (vm-get-header-contents (car mp) "References:") 80 (cons (vm-get-header-contents (car mp) "References:" " ")
76 (cons (vm-get-header-contents (car mp) "In-reply-to:") 81 (cons (vm-get-header-contents (car mp) "In-reply-to:" " ")
77 (cons (vm-get-header-contents (car mp) "Message-ID:") 82 (cons (vm-get-header-contents (car mp) "Message-ID:"
83 " ")
78 references)))) 84 references))))
79 (setq newsgroups 85 (setq newsgroups
80 (cons (or (and to-all (vm-get-header-contents (car mp) "Followup-To:")) 86 (cons (or (and to-all (vm-get-header-contents (car mp) "Followup-To:" ","))
81 (vm-get-header-contents (car mp) "Newsgroups:")) 87 (vm-get-header-contents (car mp) "Newsgroups:" ","))
82 newsgroups)) 88 newsgroups))
83 (setq mp (cdr mp))) 89 (setq mp (cdr mp)))
84 (if vm-strip-reply-headers 90 (if vm-strip-reply-headers
85 (let ((mail-use-rfc822 t)) 91 (let ((mail-use-rfc822 t))
86 (and to (setq to (mail-strip-quoted-names to))) 92 (and to (setq to (mail-strip-quoted-names to)))
190 (let ((b (current-buffer)) newbuf sumbuf default result prompt mp) 196 (let ((b (current-buffer)) newbuf sumbuf default result prompt mp)
191 (set-buffer (or (vm-get-file-buffer folder) (find-file-noselect folder))) 197 (set-buffer (or (vm-get-file-buffer folder) (find-file-noselect folder)))
192 (setq newbuf (current-buffer)) 198 (setq newbuf (current-buffer))
193 (if (not (eq major-mode 'vm-mode)) 199 (if (not (eq major-mode 'vm-mode))
194 (vm-mode)) 200 (vm-mode))
201 (if vm-presentation-buffer-handle
202 (vm-bury-buffer vm-presentation-buffer-handle))
195 (if (null vm-message-pointer) 203 (if (null vm-message-pointer)
196 (error "No messages in folder %s" folder)) 204 (error "No messages in folder %s" folder))
197 (setq default (vm-number-of (car vm-message-pointer))) 205 (setq default (vm-number-of (car vm-message-pointer)))
198 (save-excursion 206 (save-excursion
199 (save-window-excursion 207 (save-window-excursion
273 (setq message (vm-real-message-of message)) 281 (setq message (vm-real-message-of message))
274 (let ((b (current-buffer)) (start (point)) end) 282 (let ((b (current-buffer)) (start (point)) end)
275 (save-restriction 283 (save-restriction
276 (widen) 284 (widen)
277 (save-excursion 285 (save-excursion
278 (set-buffer (vm-buffer-of message)) 286 (if (vectorp (vm-mm-layout message))
279 (save-restriction 287 (let* ((o (vm-mm-layout message))
280 (widen) 288 (type (car (vm-mm-layout-type o)))
281 (append-to-buffer b (vm-headers-of message) (vm-text-end-of message)) 289 parts)
282 (setq end (vm-marker (+ start (- (vm-text-end-of message) 290 (vm-insert-region-from-buffer (vm-buffer-of message)
283 (vm-headers-of message))) b)))) 291 (vm-headers-of message)
292 (vm-text-of message))
293 (cond ((vm-mime-types-match "multipart" type)
294 (setq parts (vm-mm-layout-parts o)))
295 (t (setq parts (list o))))
296 (while parts
297 (cond ((vm-mime-text-type-p (car parts))
298 (if (vm-mime-display-internal-text/plain (car parts) t)
299 nil
300 ;; charset problems probably
301 ;; just dump the raw bits
302 (vm-mime-insert-mime-body (car parts))
303 (vm-mime-transfer-decode-region (car parts)
304 start (point)))))
305 (setq parts (cdr parts)))
306 (setq end (point-marker)))
307 (set-buffer (vm-buffer-of message))
308 (save-restriction
309 (widen)
310 (append-to-buffer b (vm-headers-of message)
311 (vm-text-end-of message))
312 (setq end (vm-marker (+ start (- (vm-text-end-of message)
313 (vm-headers-of message))) b)))))
284 (push-mark end) 314 (push-mark end)
285 (cond (mail-citation-hook (run-hooks 'mail-citation-hook)) 315 (cond (mail-citation-hook (run-hooks 'mail-citation-hook))
286 (mail-yank-hooks (run-hooks 'mail-yank-hooks)) 316 (mail-yank-hooks (run-hooks 'mail-yank-hooks))
287 (t (vm-mail-yank-default message)))))) 317 (t (vm-mail-yank-default message))))))
288 318
289 (defun vm-mail-send-and-exit (arg) 319 (defun vm-mail-send-and-exit (arg)
290 "Just like mail-send-and-exit except that VM flags the appropriate message(s) 320 "Just like mail-send-and-exit except that VM flags the appropriate message(s)
291 as having been replied to, if appropriate." 321 as having been replied to, if appropriate."
292 (interactive "P") 322 (interactive "P")
323 (vm-check-for-killed-folder)
293 (let ((b (current-buffer))) 324 (let ((b (current-buffer)))
294 (vm-mail-send) 325 (vm-mail-send)
295 (cond ((null (buffer-name b)) ;; dead buffer 326 (cond ((null (buffer-name b)) ;; dead buffer
296 (vm-display nil nil '(vm-mail-send-and-exit) 327 (vm-display nil nil '(vm-mail-send-and-exit)
297 '(vm-mail-send-and-exit reading-message startup))) 328 '(vm-mail-send-and-exit
329 reading-message
330 startup)))
298 (t 331 (t
299 (vm-display b nil '(vm-mail-send-and-exit) 332 (vm-display b nil '(vm-mail-send-and-exit)
300 '(vm-mail-send-and-exit reading-message startup)) 333 '(vm-mail-send-and-exit reading-message startup))
301 (vm-bury-buffer b))))) 334 (vm-bury-buffer b)))))
302 335
335 "Just like mail-send except that VM flags the appropriate message(s) 368 "Just like mail-send except that VM flags the appropriate message(s)
336 as replied to, forwarded, etc, if appropriate." 369 as replied to, forwarded, etc, if appropriate."
337 (interactive) 370 (interactive)
338 (if vm-tale-is-an-idiot 371 (if vm-tale-is-an-idiot
339 (vm-help-tale)) 372 (vm-help-tale))
340 (if (and vm-confirm-mail-send 373 ;; protect value of this-command from minibuffer read
341 (not (y-or-n-p "Send the message? "))) 374 (let ((this-command this-command))
342 (error "Message not sent.")) 375 (if (and vm-confirm-mail-send
376 (not (y-or-n-p "Send the message? ")))
377 (error "Message not sent.")))
378 ;; send mail using MIME if user requests it and if the buffer
379 ;; has not already been MIME encoded.
380 (if (and vm-send-using-mime
381 (null (vm-mail-mode-get-header-contents "MIME-Version:")))
382 (vm-mime-encode-composition))
343 ;; this to prevent Emacs 19 from asking whether a message that 383 ;; this to prevent Emacs 19 from asking whether a message that
344 ;; has already been sent should be sent again. VM renames mail 384 ;; has already been sent should be sent again. VM renames mail
345 ;; buffers after the message has been sent, so the user should 385 ;; buffers after the message has been sent, so the user should
346 ;; already know that the message has been sent. 386 ;; already know that the message has been sent.
347 (set-buffer-modified-p t) 387 (set-buffer-modified-p t)
348 ;; don't want a buffer change to occur here 388 (let ((composition-buffer (current-buffer))
349 ;; save-excursion to be sure. 389 ;; preserve these in case the composition buffer gets
350 (save-excursion 390 ;; killed.
351 (mail-send)) 391 (vm-reply-list vm-reply-list)
352 (vm-rename-current-mail-buffer) 392 (vm-forward-list vm-forward-list)
353 (cond ((eq vm-system-state 'replying) 393 (vm-redistribute-list vm-redistribute-list))
354 (vm-mail-mark-replied)) 394 ;; fragment message using message/partial if it is too big.
355 ((eq vm-system-state 'forwarding) 395 (if (and vm-send-using-mime
356 (vm-mail-mark-forwarded)) 396 (integerp vm-mime-max-message-size)
357 ((eq vm-system-state 'redistributing) 397 (> (buffer-size) vm-mime-max-message-size))
358 (vm-mail-mark-redistributed))) 398 (let (list)
359 (vm-keep-mail-buffer (current-buffer)) 399 (setq list (vm-mime-fragment-composition vm-mime-max-message-size))
360 (vm-display nil nil '(vm-mail-send) '(vm-mail-send))) 400 (while list
401 (save-excursion
402 (set-buffer (car list))
403 (vm-mail-send)
404 (kill-buffer (car list)))
405 (setq list (cdr list)))
406 ;; what mail-send would have done
407 (set-buffer-modified-p nil))
408 ;; don't want a buffer change to occur here
409 ;; save-excursion to be sure.
410 ;;
411 ;; also protect value of this-command from minibuffer reads
412 (let ((this-command this-command))
413 (save-excursion
414 (mail-send))))
415 (cond ((eq vm-system-state 'replying)
416 (vm-mail-mark-replied))
417 ((eq vm-system-state 'forwarding)
418 (vm-mail-mark-forwarded))
419 ((eq vm-system-state 'redistributing)
420 (vm-mail-mark-redistributed)))
421 ;; be careful, something could have killed the composition
422 ;; buffer inside mail-send.
423 (if (eq (current-buffer) composition-buffer)
424 (progn
425 (vm-rename-current-mail-buffer)
426 (vm-keep-mail-buffer (current-buffer))))
427 (vm-display nil nil '(vm-mail-send) '(vm-mail-send))))
428
429 (defun vm-mail-mode-get-header-contents (header-name-regexp)
430 (let ((contents nil)
431 regexp)
432 (setq regexp (concat "^\\(" header-name-regexp "\\)\\|\\(^"
433 (regexp-quote mail-header-separator) "$\\)"))
434 (save-excursion
435 (save-restriction
436 (widen)
437 (goto-char (point-min))
438 (let ((case-fold-search t))
439 (if (and (re-search-forward regexp nil t)
440 (match-beginning 1)
441 (progn (goto-char (match-beginning 0))
442 (vm-match-header)))
443 (vm-matched-header-contents)
444 nil ))))))
361 445
362 (defun vm-rename-current-mail-buffer () 446 (defun vm-rename-current-mail-buffer ()
363 (if vm-rename-current-buffer-function 447 (if vm-rename-current-buffer-function
364 (funcall vm-rename-current-buffer-function) 448 (funcall vm-rename-current-buffer-function)
365 (let ((case-fold-search nil)) 449 (let ((case-fold-search nil))
501 (if (eq last-command 'vm-next-command-uses-marks) 585 (if (eq last-command 'vm-next-command-uses-marks)
502 (let ((vm-digest-send-type vm-forwarding-digest-type)) 586 (let ((vm-digest-send-type vm-forwarding-digest-type))
503 (setq this-command 'vm-next-command-uses-marks) 587 (setq this-command 'vm-next-command-uses-marks)
504 (command-execute 'vm-send-digest)) 588 (command-execute 'vm-send-digest))
505 (let ((dir default-directory) 589 (let ((dir default-directory)
590 (miming (and vm-send-using-mime
591 (equal vm-forwarding-digest-type "mime")))
592 mail-buffer
593 header-end boundary
506 (mp vm-message-pointer)) 594 (mp vm-message-pointer))
507 (save-restriction 595 (save-restriction
508 (widen) 596 (widen)
509 (vm-mail-internal 597 (vm-mail-internal
510 (format "forward of %s's note re: %s" 598 (format "forward of %s's note re: %s"
516 (vm-sprintf 'vm-forwarding-subject-format (car mp))))) 604 (vm-sprintf 'vm-forwarding-subject-format (car mp)))))
517 (make-local-variable 'vm-forward-list) 605 (make-local-variable 'vm-forward-list)
518 (setq vm-system-state 'forwarding 606 (setq vm-system-state 'forwarding
519 vm-forward-list (list (car mp)) 607 vm-forward-list (list (car mp))
520 default-directory dir) 608 default-directory dir)
521 (goto-char (point-min)) 609 (if miming
522 (re-search-forward 610 (progn
523 (concat "^" (regexp-quote mail-header-separator) "\n") nil 0) 611 (setq mail-buffer (current-buffer))
524 (cond ((equal vm-forwarding-digest-type "rfc934") 612 (set-buffer (generate-new-buffer "*vm-forward-buffer*"))
613 (setq header-end (point))
614 (insert "\n"))
615 (goto-char (point-min))
616 (re-search-forward (concat "^" (regexp-quote mail-header-separator)
617 "\n"))
618 (goto-char (match-end 0))
619 (setq header-end (match-beginning 0)))
620 (cond ((equal vm-forwarding-digest-type "mime")
621 (setq boundary (vm-mime-encapsulate-messages
622 (list (car mp)) vm-forwarded-headers
623 vm-unforwarded-header-regexp))
624 (goto-char header-end)
625 (insert "MIME-Version: 1.0\n")
626 (insert (if vm-mime-avoid-folding-content-type
627 "Content-Type: multipart/digest; boundary=\""
628 "Content-Type: multipart/digest;\n\tboundary=\"")
629 boundary "\"\n")
630 (insert "Content-Transfer-Encoding: "
631 (vm-determine-proper-content-transfer-encoding
632 (point)
633 (point-max))
634 "\n"))
635 ((equal vm-forwarding-digest-type "rfc934")
525 (vm-rfc934-encapsulate-messages 636 (vm-rfc934-encapsulate-messages
526 vm-forward-list vm-forwarded-headers 637 vm-forward-list vm-forwarded-headers
527 vm-unforwarded-header-regexp)) 638 vm-unforwarded-header-regexp))
528 ((equal vm-forwarding-digest-type "rfc1153") 639 ((equal vm-forwarding-digest-type "rfc1153")
529 (vm-rfc1153-encapsulate-messages 640 (vm-rfc1153-encapsulate-messages
531 vm-unforwarded-header-regexp)) 642 vm-unforwarded-header-regexp))
532 ((equal vm-forwarding-digest-type nil) 643 ((equal vm-forwarding-digest-type nil)
533 (vm-no-frills-encapsulate-message 644 (vm-no-frills-encapsulate-message
534 (car vm-forward-list) vm-forwarded-headers 645 (car vm-forward-list) vm-forwarded-headers
535 vm-unforwarded-header-regexp))) 646 vm-unforwarded-header-regexp)))
647 (if miming
648 (let ((b (current-buffer)))
649 (set-buffer mail-buffer)
650 (mail-text)
651 (vm-mime-attach-object b "multipart/digest"
652 (list (concat "boundary=\""
653 boundary "\"")) t)
654 (add-hook 'kill-buffer-hook
655 (list 'lambda ()
656 (list 'if (list 'eq mail-buffer '(current-buffer))
657 (list 'kill-buffer b))))))
536 (mail-position-on-field "To")) 658 (mail-position-on-field "To"))
537 (run-hooks 'vm-forward-message-hook) 659 (run-hooks 'vm-forward-message-hook)
538 (run-hooks 'vm-mail-mode-hook)))) 660 (run-hooks 'vm-mail-mode-hook))))
539 661
540 (defun vm-resend-bounced-message () 662 (defun vm-resend-bounced-message ()
546 (vm-select-folder-buffer) 668 (vm-select-folder-buffer)
547 (vm-check-for-killed-summary) 669 (vm-check-for-killed-summary)
548 (vm-error-if-folder-empty) 670 (vm-error-if-folder-empty)
549 (let ((b (current-buffer)) start 671 (let ((b (current-buffer)) start
550 (dir default-directory) 672 (dir default-directory)
673 (layout (vm-mm-layout (car vm-message-pointer)))
551 (lim (vm-text-end-of (car vm-message-pointer)))) 674 (lim (vm-text-end-of (car vm-message-pointer))))
552 (save-restriction 675 (save-restriction
553 (widen) 676 (widen)
554 (save-excursion 677 (if (or (not (vectorp layout))
555 (goto-char (vm-text-of (car vm-message-pointer))) 678 (not (setq layout (vm-mime-layout-contains-type
556 (let ((case-fold-search t)) 679 layout "message/rfc822"))))
557 ;; What a wonderful world it would be if mailers used a single 680 (save-excursion
558 ;; message encapsulation standard instead all the weird variants 681 (goto-char (vm-text-of (car vm-message-pointer)))
559 ;; It is useless to try to cover them all. 682 (let ((case-fold-search t))
560 ;; This simple rule should cover the sanest of the formats 683 ;; What a wonderful world it would be if mailers
561 (if (not (re-search-forward "^Received:" lim t)) 684 ;; used a single message encapsulation standard
562 (error "This doesn't look like a bounced message.")) 685 ;; instead of all the weird variants. It is
563 (beginning-of-line) 686 ;; useless to try to cover them all. This simple
564 (setq start (point)))) 687 ;; rule should cover the sanest of the formats
688 (if (not (re-search-forward "^Received:" lim t))
689 (error "This doesn't look like a bounced message."))
690 (beginning-of-line)
691 (setq start (point)))))
565 ;; briefly nullify vm-mail-header-from to keep vm-mail-internal 692 ;; briefly nullify vm-mail-header-from to keep vm-mail-internal
566 ;; from inserting another From header. 693 ;; from inserting another From header.
567 (let ((vm-mail-header-from nil)) 694 (let ((vm-mail-header-from nil))
568 (vm-mail-internal 695 (vm-mail-internal
569 (format "retry of bounce from %s" 696 (format "retry of bounce from %s"
570 (vm-su-from (car vm-message-pointer))))) 697 (vm-su-from (car vm-message-pointer)))))
571 (goto-char (point-min)) 698 (goto-char (point-min))
572 (insert-buffer-substring b start lim) 699 (if (vectorp layout)
700 (progn
701 (setq start (point))
702 (vm-mime-insert-mime-body layout)
703 (vm-mime-transfer-decode-region layout start (point)))
704 (insert-buffer-substring b start lim))
573 (delete-region (point) (point-max)) 705 (delete-region (point) (point-max))
574 (goto-char (point-min)) 706 (goto-char (point-min))
575 ;; delete all but pertinent headers 707 ;; delete all but pertinent headers
576 (vm-reorder-message-headers nil nil "\\(X-VM-\\|Status:\\|Sender:\\)") 708 (vm-reorder-message-headers nil nil "\\(X-VM-\\|Status:\\|Sender:\\)")
577 (vm-reorder-message-headers nil vm-resend-bounced-headers 709 (vm-reorder-message-headers nil vm-resend-bounced-headers
656 (interactive "P") 788 (interactive "P")
657 (vm-select-folder-buffer) 789 (vm-select-folder-buffer)
658 (vm-check-for-killed-summary) 790 (vm-check-for-killed-summary)
659 (vm-error-if-folder-empty) 791 (vm-error-if-folder-empty)
660 (let ((dir default-directory) 792 (let ((dir default-directory)
661 (mp vm-message-pointer) 793 (miming (and vm-send-using-mime (equal vm-digest-send-type "mime")))
794 mp mail-buffer b
662 ;; prefix arg doesn't have "normal" meaning here, so only call 795 ;; prefix arg doesn't have "normal" meaning here, so only call
663 ;; vm-select-marked-or-prefixed-messages if we're using marks. 796 ;; vm-select-marked-or-prefixed-messages if we're using marks.
664 (mlist (if (eq last-command 'vm-next-command-uses-marks) 797 (mlist (if (eq last-command 'vm-next-command-uses-marks)
665 (vm-select-marked-or-prefixed-messages 0) 798 (vm-select-marked-or-prefixed-messages 0)
666 vm-message-list)) 799 vm-message-list))
667 start) 800 start header-end boundary)
668 (save-restriction 801 (save-restriction
669 (widen) 802 (widen)
670 (vm-mail-internal (format "digest from %s" (buffer-name))) 803 (vm-mail-internal (format "digest from %s" (buffer-name)))
671 (make-local-variable 'vm-forward-list) 804 (make-local-variable 'vm-forward-list)
672 (setq vm-system-state 'forwarding 805 (setq vm-system-state 'forwarding
673 vm-forward-list mlist 806 vm-forward-list mlist
674 default-directory dir) 807 default-directory dir)
675 (goto-char (point-min)) 808 (if miming
676 (re-search-forward (concat "^" (regexp-quote mail-header-separator) 809 (progn
677 "\n")) 810 (setq mail-buffer (current-buffer))
678 (goto-char (match-end 0)) 811 (set-buffer (generate-new-buffer "*vm-digest-buffer*"))
679 (setq start (point) 812 (setq header-end (point))
680 mp mlist) 813 (insert "\n")
814 (setq start (point-marker)))
815 (goto-char (point-min))
816 (re-search-forward (concat "^" (regexp-quote mail-header-separator)
817 "\n"))
818 (goto-char (match-end 0))
819 (setq start (point-marker)
820 header-end (match-beginning 0)))
681 (vm-unsaved-message "Building %s digest..." vm-digest-send-type) 821 (vm-unsaved-message "Building %s digest..." vm-digest-send-type)
682 (cond ((equal vm-digest-send-type "rfc934") 822 (cond ((equal vm-digest-send-type "mime")
823 (setq boundary (vm-mime-encapsulate-messages
824 mlist vm-mime-digest-headers
825 vm-mime-digest-discard-header-regexp))
826 (goto-char header-end)
827 (insert "MIME-Version: 1.0\n")
828 (insert (if vm-mime-avoid-folding-content-type
829 "Content-Type: multipart/digest; boundary=\""
830 "Content-Type: multipart/digest;\n\tboundary=\"")
831 boundary "\"\n")
832 (insert "Content-Transfer-Encoding: "
833 (vm-determine-proper-content-transfer-encoding
834 (point)
835 (point-max))
836 "\n"))
837 ((equal vm-digest-send-type "rfc934")
683 (vm-rfc934-encapsulate-messages 838 (vm-rfc934-encapsulate-messages
684 mlist vm-rfc934-digest-headers 839 mlist vm-rfc934-digest-headers
685 vm-rfc934-digest-discard-header-regexp)) 840 vm-rfc934-digest-discard-header-regexp))
686 ((equal vm-digest-send-type "rfc1153") 841 ((equal vm-digest-send-type "rfc1153")
687 (vm-rfc1153-encapsulate-messages 842 (vm-rfc1153-encapsulate-messages
699 (progn 854 (progn
700 (forward-char -1) 855 (forward-char -1)
701 (center-line) 856 (center-line)
702 (forward-char 1))) 857 (forward-char 1)))
703 (setq mp (cdr mp))))) 858 (setq mp (cdr mp)))))
859 (if miming
860 (let ((b (current-buffer)))
861 (set-buffer mail-buffer)
862 (mail-text)
863 (vm-mime-attach-object b "multipart/digest"
864 (list (concat "boundary=\""
865 boundary "\"")) t)
866 (add-hook 'kill-buffer-hook
867 (list 'lambda ()
868 (list 'if (list 'eq mail-buffer '(current-buffer))
869 (list 'kill-buffer b))))))
704 (mail-position-on-field "To") 870 (mail-position-on-field "To")
705 (message "Building %s digest... done" vm-digest-send-type))) 871 (message "Building %s digest... done" vm-digest-send-type)))
706 (run-hooks 'vm-send-digest-hook) 872 (run-hooks 'vm-send-digest-hook)
707 (run-hooks 'vm-mail-mode-hook)) 873 (run-hooks 'vm-mail-mode-hook))
708 874
714 880
715 (defun vm-send-rfc1153-digest (&optional preamble) 881 (defun vm-send-rfc1153-digest (&optional preamble)
716 "Like vm-send-digest but always sends an RFC 1153 digest." 882 "Like vm-send-digest but always sends an RFC 1153 digest."
717 (interactive "P") 883 (interactive "P")
718 (let ((vm-digest-send-type "rfc1153")) 884 (let ((vm-digest-send-type "rfc1153"))
885 (vm-send-digest preamble)))
886
887 (defun vm-send-mime-digest (&optional preamble)
888 "Like vm-send-digest but always sends an MIME (multipart/digest) digest."
889 (interactive "P")
890 (let ((vm-digest-send-type "mime"))
719 (vm-send-digest preamble))) 891 (vm-send-digest preamble)))
720 892
721 (defun vm-continue-composing-message (&optional not-picky) 893 (defun vm-continue-composing-message (&optional not-picky)
722 "Find and select the most recently used mail composition buffer. 894 "Find and select the most recently used mail composition buffer.
723 If the selected buffer is already a Mail mode buffer then it is 895 If the selected buffer is already a Mail mode buffer then it is
751 (vm-set-hooks-for-frame-deletion))) 923 (vm-set-hooks-for-frame-deletion)))
752 (vm-display b t '(vm-continue-composing-message) 924 (vm-display b t '(vm-continue-composing-message)
753 '(vm-continue-composing-message composing-message))) 925 '(vm-continue-composing-message composing-message)))
754 (message "No composition buffers found")))) 926 (message "No composition buffers found"))))
755 927
928 (defun vm-mail-to-mailto-url (url)
929 (let ((address (car (vm-parse url "^mailto:\\(.+\\)"))))
930 (vm-select-folder-buffer)
931 (vm-check-for-killed-summary)
932 (vm-mail-internal nil address)
933 (run-hooks 'vm-mail-hook)
934 (run-hooks 'vm-mail-mode-hook)))
935
756 ;; to quiet the v19 byte compiler 936 ;; to quiet the v19 byte compiler
757 (defvar mail-mode-map) 937 (defvar mail-mode-map)
758 (defvar mail-aliases) 938 (defvar mail-aliases)
759 (defvar mail-default-reply-to) 939 (defvar mail-default-reply-to)
760 (defvar mail-signature-file) 940 (defvar mail-signature-file)
778 (set-keymap-parents vm-mail-mode-map (list mail-mode-map))) 958 (set-keymap-parents vm-mail-mode-map (list mail-mode-map)))
779 ((consp mail-mode-map) 959 ((consp mail-mode-map)
780 (nconc vm-mail-mode-map mail-mode-map) 960 (nconc vm-mail-mode-map mail-mode-map)
781 (setq vm-mail-mode-map-parented t)))) 961 (setq vm-mail-mode-map-parented t))))
782 (setq vm-mail-buffer folder-buffer 962 (setq vm-mail-buffer folder-buffer
783 mode-popup-menu (and vm-use-menus 963 mode-popup-menu (and vm-use-menus vm-popup-menu-on-mouse-3
784 (vm-menu-support-possible-p) 964 (vm-menu-support-possible-p)
785 (vm-menu-mode-menu))) 965 (vm-menu-mode-menu)))
786 ;; sets up popup menu for FSF Emacs 966 ;; sets up popup menu for FSF Emacs
787 (and vm-use-menus (vm-menu-support-possible-p) 967 (and vm-use-menus (vm-menu-support-possible-p)
788 (vm-menu-install-mail-mode-menu)) 968 (vm-menu-install-mail-mode-menu))
850 vm-send-digest-other-frame 1030 vm-send-digest-other-frame
851 vm-send-rfc934-digest 1031 vm-send-rfc934-digest
852 vm-send-rfc934-digest-other-frame 1032 vm-send-rfc934-digest-other-frame
853 vm-send-rfc1153-digest 1033 vm-send-rfc1153-digest
854 vm-send-rfc1153-digest-other-frame 1034 vm-send-rfc1153-digest-other-frame
1035 vm-send-mime-digest
1036 vm-send-mime-digest-other-frame
855 vm-forward-message 1037 vm-forward-message
856 vm-forward-message-other-frame 1038 vm-forward-message-other-frame
857 vm-forward-message-all-headers 1039 vm-forward-message-all-headers
858 vm-forward-message-all-headers-other-frame 1040 vm-forward-message-all-headers-other-frame
859 vm-resend-message 1041 vm-resend-message
983 (let ((vm-frame-per-composition nil) 1165 (let ((vm-frame-per-composition nil)
984 (vm-search-other-frames nil)) 1166 (vm-search-other-frames nil))
985 (vm-send-rfc1153-digest prefix)) 1167 (vm-send-rfc1153-digest prefix))
986 (if (vm-multiple-frames-possible-p) 1168 (if (vm-multiple-frames-possible-p)
987 (vm-set-hooks-for-frame-deletion))) 1169 (vm-set-hooks-for-frame-deletion)))
1170
1171 (defun vm-send-mime-digest-other-frame (&optional prefix)
1172 "Like vm-send-mime-digest, but run in a newly created frame."
1173 (interactive "P")
1174 (if (vm-multiple-frames-possible-p)
1175 (vm-goto-new-frame 'composition))
1176 (let ((vm-frame-per-composition nil)
1177 (vm-search-other-frames nil))
1178 (vm-send-mime-digest prefix))
1179 (if (vm-multiple-frames-possible-p)
1180 (vm-set-hooks-for-frame-deletion)))