(bbdb-extract-field-value): Use `eword-decode-string' instead of
[elisp/tm.git] / tm-edit.el
index 26f2732..fc4ceb7 100644 (file)
@@ -1,12 +1,12 @@
 ;;; tm-edit.el --- Simple MIME Composer for GNU Emacs
 
-;; Copyright (C) 1993 .. 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1993,1994,1995,1996,1997 Free Software Foundation, Inc.
 
 ;; Author: UMEDA Masanobu <umerin@mse.kyutech.ac.jp>
 ;;         MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;; Created: 1994/08/21 renamed from mime.el
-;; Version: $Revision: 7.100 $
+;; Version: $Revision: 7.106 $
 ;; Keywords: mail, news, MIME, multimedia, multilingual
 
 ;; This file is part of tm (Tools for MIME).
@@ -41,8 +41,8 @@
 ;; resulted in RFC 1468 (ISO-2022-JP charset for MIME).  In order to
 ;; enable multilingual capability in single text message in MIME,
 ;; charset of multilingual text written in Mule is declared as either
-;; `ISO-2022-JP-2' [RFC 1554] or `ISO-2022-INT-1'.  Mule is required
-;; for reading the such messages.
+;; `ISO-2022-JP-2' [RFC 1554].  Mule is required for reading the such
+;; messages.
 
 ;; This MIME composer can work with Mail mode, mh-e letter Mode, and
 ;; News mode.  First of all, you need the following autoload
 ;; 
 ;;--[[text/plain]]
 ;; This is also a plain text.  But, it is explicitly specified as is.
+;;--[[text/plain; charset=ISO-8859-1]]
+;; This is also a plain text.  But charset is specified as iso-8859-1.
 ;;
-;;--[[text/plain; charset=ISO-2022-JP]]
-;; \e$B$3$l$O\e(B charset \e$B$r\e(B ISO-2022-JP \e$B$K;XDj$7$?F|K\8l$N\e(B plain \e$B%F%-%9%H$G$9\e(B.
-;;
-;;--[[text/richtext]]
+;; ¡Hola!  Buenos días.  ¿Cómo está usted?
+;;--[[text/enriched]]
 ;; <center>This is a richtext.</center>
 ;;
 ;;--[[image/gif][base64]]^M...image encoded in base64 comes here...
 ;;;
 
 (defconst mime-editor/RCS-ID
-  "$Id: tm-edit.el,v 7.100 1996/12/25 17:10:58 morioka Exp $")
+  "$Id: tm-edit.el,v 7.106 1997/03/20 07:20:15 morioka Exp $")
 
 (defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
 
@@ -433,16 +433,6 @@ If it is not specified for a major-mode,
 (defvar mime-editor/encrypting-type 'pgp-elkins
   "*PGP encrypting type (pgp-elkins, pgp-kazu or nil). [tm-edit.el]")
 
-(defvar mime-editor/pgp-sign-function 'tm:mc-pgp-sign-region)
-(defvar mime-editor/pgp-encrypt-function 'tm:mc-pgp-encrypt-region)
-(defvar mime-editor/traditional-pgp-sign-function 'mc-pgp-sign-region)
-(defvar mime-editor/pgp-insert-public-key-function 'mc-insert-public-key)
-
-(autoload mime-editor/pgp-sign-function "tm-edit-mc")
-(autoload mime-editor/pgp-encrypt-function "tm-edit-mc")
-(autoload mime-editor/traditional-pgp-sign-function "mc-pgp")
-(autoload mime-editor/pgp-insert-public-key-function "mc-toplev")
-
 
 ;;; @@ about tag
 ;;;
@@ -741,13 +731,15 @@ TABs at the beginning of the line are not a part of the message:
        --[[text/plain]]
        This is also a plain text.  But, it is explicitly specified as
        is.
-       --[[text/plain; charset=ISO-2022-JP]]
-       \e$B$3$l$O\e(B charset \e$B$r\e(B ISO-2022-JP \e$B$K;XDj$7$?F|K\8l$N\e(B plain \e$B%F%-%9\e(B
-       \e$B%H$G$9\e(B.
-       --[[text/richtext]]
-       <center>This is a richtext.</center>
-       --[[image/gif][base64]]^M...image encoded in base64 here...
-       --[[audio/basic][base64]]^M...audio encoded in base64 here...
+       --[[text/plain; charset=ISO-8859-1]]
+       This is also a plain text.  But charset is specified as
+       iso-8859-1.
+
+       ¡Hola!  Buenos días.  ¿Cómo está usted?
+       --[[text/enriched]]
+       This is a <bold>enriched text</bold>.
+       --[[image/gif][base64]]...image encoded in base64 here...
+       --[[audio/basic][base64]]...audio encoded in base64 here...
 
 User customizable variables (not documented all of them):
  mime-prefix
@@ -851,7 +843,8 @@ just return to previous mode."
     ;; Restore previous state.
     (setq mime/editor-mode-flag nil)
     (cond (running-xemacs
-          (delete-menu-item (list mime-editor/menu-title)))
+          (if (featurep 'menubar) 
+              (delete-menu-item (list mime-editor/menu-title))))
          (t
           (use-local-map mime/editor-mode-old-local-map)))
     
@@ -877,7 +870,7 @@ just return to previous mode."
 
 (defun mime-editor/insert-text ()
   "Insert a text message.
-Charset is automatically obtained from the `mime/lc-charset-alist'."
+Charset is automatically obtained from the `charsets-mime-charset-alist'."
   (interactive)
   (let ((ret (mime-editor/insert-tag "text" nil nil)))
   (if ret
@@ -1555,7 +1548,7 @@ Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
            (insert (format "Content-Transfer-Encoding: %s\n" encoding))
          )
        (insert "\n")
-       (or (funcall mime-editor/pgp-sign-function
+       (or (funcall (pgp-function 'mime-sign)
                     (point-min)(point-max) nil nil pgp-boundary)
            (throw 'mime-editor/error 'pgp-error)
            )
@@ -1619,7 +1612,7 @@ Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
              (insert (format "Content-Transfer-Encoding: %s\n" encoding))
            )
          (insert "\n")
-         (or (funcall mime-editor/pgp-encrypt-function
+         (or (funcall (pgp-function 'encrypt)
                       recipients (point-min) (point-max) from)
              (throw 'mime-editor/error 'pgp-error)
              )
@@ -1656,7 +1649,7 @@ Content-Transfer-Encoding: 7bit
          )
        (insert "\n")
        (or (as-binary-process
-            (funcall mime-editor/traditional-pgp-sign-function
+            (funcall (pgp-function 'traditional-sign)
                      beg (point-max)))
            (throw 'mime-editor/error 'pgp-error)
            )
@@ -1690,7 +1683,7 @@ Content-Transfer-Encoding: 7bit
            )
          (insert "\n")
          (or (as-binary-process
-              (funcall mime-editor/pgp-encrypt-function
+              (funcall (pgp-function 'encrypt)
                        recipients beg (point-max) nil 'maybe)
               )
              (throw 'mime-editor/error 'pgp-error)
@@ -1767,16 +1760,17 @@ Content-Transfer-Encoding: 7bit
             (tag (buffer-substring beg end))
             )
        (delete-region beg end)
-       (setq contype (mime-editor/get-contype tag))
-       (setq encoding (mime-editor/get-encoding tag))
-       (insert (concat prefix "--" boundary "\n"))
-       (save-restriction
-         (narrow-to-region (point)(point))
-         (insert "Content-Type: " contype "\n")
-         (if encoding
-             (insert "Content-Transfer-Encoding: " encoding "\n"))
-         (mime/encode-message-header)
-         )
+       (let ((contype (mime-editor/get-contype tag))
+             (encoding (mime-editor/get-encoding tag))
+             )
+         (insert (concat prefix "--" boundary "\n"))
+         (save-restriction
+           (narrow-to-region (point)(point))
+           (insert "Content-Type: " contype "\n")
+           (if encoding
+               (insert "Content-Transfer-Encoding: " encoding "\n"))
+           (mime/encode-message-header)
+           ))
        t)))
 
 (defun mime-editor/translate-region (beg end &optional boundary multipart)
@@ -2071,7 +2065,7 @@ and insert data encoded as ENCODING. [tm-edit.el]"
   (interactive "P")
   (mime-editor/insert-tag "application" "pgp-keys")
   (mime-editor/define-encoding "7bit")
-  (funcall mime-editor/pgp-insert-public-key-function)
+  (funcall (pgp-function 'insert-key))
   )
 
 
@@ -2441,7 +2435,10 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
              (setq type ctype)
              )
            (cond
-            ((string-equal type "multipart")
+            ((string= ctype "application/pgp-signature")
+             (delete-region (point-min)(point-max))
+             )
+            ((string= type "multipart")
              (let* ((boundary (assoc-value "boundary" params))
                     (boundary-pat
                      (concat "\n--" (regexp-quote boundary) "[ \t]*\n"))