comparison lisp/tm/tm-edit.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents 821dec489c24
children 8619ce7e4c50
comparison
equal deleted inserted replaced
97:498bf5da1c90 98:0d2f883870bc
4 4
5 ;; Author: UMEDA Masanobu <umerin@mse.kyutech.ac.jp> 5 ;; Author: UMEDA Masanobu <umerin@mse.kyutech.ac.jp>
6 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp> 6 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp> 7 ;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;; Created: 1994/08/21 renamed from mime.el 8 ;; Created: 1994/08/21 renamed from mime.el
9 ;; Version: $Revision: 1.7 $ 9 ;; Version: $Revision: 1.8 $
10 ;; Keywords: mail, news, MIME, multimedia, multilingual 10 ;; Keywords: mail, news, MIME, multimedia, multilingual
11 11
12 ;; This file is part of tm (Tools for MIME). 12 ;; This file is part of tm (Tools for MIME).
13 13
14 ;; This program is free software; you can redistribute it and/or 14 ;; This program is free software; you can redistribute it and/or
92 ;; This is a conventional plain text. It should be translated into 92 ;; This is a conventional plain text. It should be translated into
93 ;; text/plain. 93 ;; text/plain.
94 ;; 94 ;;
95 ;;--[[text/plain]] 95 ;;--[[text/plain]]
96 ;; This is also a plain text. But, it is explicitly specified as is. 96 ;; This is also a plain text. But, it is explicitly specified as is.
97 ;;--[[text/plain; charset=ISO-8859-1]]
98 ;; This is also a plain text. But charset is specified as iso-8859-1.
97 ;; 99 ;;
98 ;;--[[text/plain; charset=ISO-2022-JP]] 100 ;; ¡Hola! Buenos días. ¿Cómo está usted?
99 ;; [Insert Japanese text here] 101 ;;--[[text/enriched]]
100 ;;
101 ;;--[[text/richtext]]
102 ;; <center>This is a richtext.</center> 102 ;; <center>This is a richtext.</center>
103 ;; 103 ;;
104 ;;--[[image/gif][base64]]^M...image encoded in base64 comes here... 104 ;;--[[image/gif][base64]]^M...image encoded in base64 comes here...
105 ;; 105 ;;
106 ;;--[[audio/basic][base64]]^M...audio encoded in base64 comes here... 106 ;;--[[audio/basic][base64]]^M...audio encoded in base64 comes here...
118 118
119 ;;; @ version 119 ;;; @ version
120 ;;; 120 ;;;
121 121
122 (defconst mime-editor/RCS-ID 122 (defconst mime-editor/RCS-ID
123 "$Id: tm-edit.el,v 1.7 1997/02/02 02:16:16 steve Exp $") 123 "$Id: tm-edit.el,v 1.8 1997/02/15 22:21:28 steve Exp $")
124 124
125 (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) 125 (defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
126 126
127 (defconst mime-editor/version-name 127 (defconst mime-editor/version-name
128 (concat "tm-edit " mime-editor/version)) 128 (concat "tm-edit " mime-editor/version))
431 "*PGP signing type (pgp-elkins, pgp-kazu or nil). [tm-edit.el]") 431 "*PGP signing type (pgp-elkins, pgp-kazu or nil). [tm-edit.el]")
432 432
433 (defvar mime-editor/encrypting-type 'pgp-elkins 433 (defvar mime-editor/encrypting-type 'pgp-elkins
434 "*PGP encrypting type (pgp-elkins, pgp-kazu or nil). [tm-edit.el]") 434 "*PGP encrypting type (pgp-elkins, pgp-kazu or nil). [tm-edit.el]")
435 435
436 (defvar mime-editor/pgp-sign-function 'tm:mc-pgp-sign-region)
437 (defvar mime-editor/pgp-encrypt-function 'tm:mc-pgp-encrypt-region)
438 (defvar mime-editor/traditional-pgp-sign-function 'mc-pgp-sign-region)
439 (defvar mime-editor/pgp-insert-public-key-function 'mc-insert-public-key)
440
441 (autoload mime-editor/pgp-sign-function "tm-edit-mc")
442 (autoload mime-editor/pgp-encrypt-function "tm-edit-mc")
443 (autoload mime-editor/traditional-pgp-sign-function "mc-pgp")
444 (autoload mime-editor/pgp-insert-public-key-function "mc-toplev")
445
446 436
447 ;;; @@ about tag 437 ;;; @@ about tag
448 ;;; 438 ;;;
449 439
450 (defconst mime-editor/single-part-tag-regexp 440 (defconst mime-editor/single-part-tag-regexp
878 (princ (documentation 'mime/editor-mode)) 868 (princ (documentation 'mime/editor-mode))
879 (print-help-return-message))) 869 (print-help-return-message)))
880 870
881 (defun mime-editor/insert-text () 871 (defun mime-editor/insert-text ()
882 "Insert a text message. 872 "Insert a text message.
883 Charset is automatically obtained from the `mime/lc-charset-alist'." 873 Charset is automatically obtained from the `charsets-mime-charset-alist'."
884 (interactive) 874 (interactive)
885 (let ((ret (mime-editor/insert-tag "text" nil nil))) 875 (let ((ret (mime-editor/insert-tag "text" nil nil)))
886 (if ret 876 (if ret
887 (progn 877 (progn
888 (if (looking-at mime-editor/single-part-tag-regexp) 878 (if (looking-at mime-editor/single-part-tag-regexp)
1556 (insert (format "Content-Type: %s\n" ctype)) 1546 (insert (format "Content-Type: %s\n" ctype))
1557 (if encoding 1547 (if encoding
1558 (insert (format "Content-Transfer-Encoding: %s\n" encoding)) 1548 (insert (format "Content-Transfer-Encoding: %s\n" encoding))
1559 ) 1549 )
1560 (insert "\n") 1550 (insert "\n")
1561 (or (funcall mime-editor/pgp-sign-function 1551 (or (funcall (pgp-function 'mime-sign)
1562 (point-min)(point-max) nil nil pgp-boundary) 1552 (point-min)(point-max) nil nil pgp-boundary)
1563 (throw 'mime-editor/error 'pgp-error) 1553 (throw 'mime-editor/error 'pgp-error)
1564 ) 1554 )
1565 )))) 1555 ))))
1566 1556
1620 (insert (format "Content-Type: %s\n" ctype)) 1610 (insert (format "Content-Type: %s\n" ctype))
1621 (if encoding 1611 (if encoding
1622 (insert (format "Content-Transfer-Encoding: %s\n" encoding)) 1612 (insert (format "Content-Transfer-Encoding: %s\n" encoding))
1623 ) 1613 )
1624 (insert "\n") 1614 (insert "\n")
1625 (or (funcall mime-editor/pgp-encrypt-function 1615 (or (funcall (pgp-function 'encrypt)
1626 recipients (point-min) (point-max) from) 1616 recipients (point-min) (point-max) from)
1627 (throw 'mime-editor/error 'pgp-error) 1617 (throw 'mime-editor/error 'pgp-error)
1628 ) 1618 )
1629 (goto-char beg) 1619 (goto-char beg)
1630 (insert (format "--[[multipart/encrypted; 1620 (insert (format "--[[multipart/encrypted;
1657 (if encoding 1647 (if encoding
1658 (insert (format "Content-Transfer-Encoding: %s\n" encoding)) 1648 (insert (format "Content-Transfer-Encoding: %s\n" encoding))
1659 ) 1649 )
1660 (insert "\n") 1650 (insert "\n")
1661 (or (as-binary-process 1651 (or (as-binary-process
1662 (funcall mime-editor/traditional-pgp-sign-function 1652 (funcall (pgp-function 'traditional-sign)
1663 beg (point-max))) 1653 beg (point-max)))
1664 (throw 'mime-editor/error 'pgp-error) 1654 (throw 'mime-editor/error 'pgp-error)
1665 ) 1655 )
1666 (goto-char beg) 1656 (goto-char beg)
1667 (insert 1657 (insert
1691 (if encoding 1681 (if encoding
1692 (insert (format "Content-Transfer-Encoding: %s\n" encoding)) 1682 (insert (format "Content-Transfer-Encoding: %s\n" encoding))
1693 ) 1683 )
1694 (insert "\n") 1684 (insert "\n")
1695 (or (as-binary-process 1685 (or (as-binary-process
1696 (funcall mime-editor/pgp-encrypt-function 1686 (funcall (pgp-function 'encrypt)
1697 recipients beg (point-max) nil 'maybe) 1687 recipients beg (point-max) nil 'maybe)
1698 ) 1688 )
1699 (throw 'mime-editor/error 'pgp-error) 1689 (throw 'mime-editor/error 'pgp-error)
1700 ) 1690 )
1701 (goto-char beg) 1691 (goto-char beg)
2072 (defun mime-editor/insert-key (&optional arg) 2062 (defun mime-editor/insert-key (&optional arg)
2073 "Insert a pgp public key." 2063 "Insert a pgp public key."
2074 (interactive "P") 2064 (interactive "P")
2075 (mime-editor/insert-tag "application" "pgp-keys") 2065 (mime-editor/insert-tag "application" "pgp-keys")
2076 (mime-editor/define-encoding "7bit") 2066 (mime-editor/define-encoding "7bit")
2077 (funcall mime-editor/pgp-insert-public-key-function) 2067 (funcall (pgp-function 'insert-key))
2078 ) 2068 )
2079 2069
2080 2070
2081 ;;; @ flag setting 2071 ;;; @ flag setting
2082 ;;; 2072 ;;;
2442 (setq stype (substring ctype (match-end 0))) 2432 (setq stype (substring ctype (match-end 0)))
2443 ) 2433 )
2444 (setq type ctype) 2434 (setq type ctype)
2445 ) 2435 )
2446 (cond 2436 (cond
2447 ((string-equal type "multipart") 2437 ((string= ctype "application/pgp-signature")
2438 (delete-region (point-min)(point-max))
2439 )
2440 ((string= type "multipart")
2448 (let* ((boundary (assoc-value "boundary" params)) 2441 (let* ((boundary (assoc-value "boundary" params))
2449 (boundary-pat 2442 (boundary-pat
2450 (concat "\n--" (regexp-quote boundary) "[ \t]*\n")) 2443 (concat "\n--" (regexp-quote boundary) "[ \t]*\n"))
2451 ) 2444 )
2452 (re-search-forward boundary-pat nil t) 2445 (re-search-forward boundary-pat nil t)