From d27eeadad105552b6bef913b0380aa53ccb3342c Mon Sep 17 00:00:00 2001 From: morioka Date: Mon, 9 Mar 1998 12:17:30 +0000 Subject: [PATCH] tm 7.34. --- Changes-7.34.en | 53 ++++++++++++++++ Makefile | 11 ++-- gnus/s-path | 2 +- mk-tm | 2 +- signature.el | 4 +- src/tmpgp | 4 ++ tm-edit.el | 188 ++++++++++++++++++++++++++++++++++++++++++++----------- tm-html.el | 29 +++++++-- tm-pgp.el | 35 ++++++++++- tm-play.el | 4 +- tm-vm.el | 17 +++-- 11 files changed, 292 insertions(+), 57 deletions(-) create mode 100644 Changes-7.34.en create mode 100755 src/tmpgp diff --git a/Changes-7.34.en b/Changes-7.34.en new file mode 100644 index 0000000..8ebc9ba --- /dev/null +++ b/Changes-7.34.en @@ -0,0 +1,53 @@ +Thu Dec 14 17:03:27 1995 Morioka Tomohiko + + * tm: Version 7.34 was released. + + * Makefile: + New file tm/src/tmpgp: it is used to sign by pgp-elkins style. + +Thu Dec 14 15:49:00 1995 Morioka Tomohiko + + * tm-edit.el: + (1) `pgp-elkins' style PGP signature was implemented. + (2) New function `mime-editor/insert-key': It is based on + draft-elkins-pem-pgp-01.txt. + +Thu Dec 14 15:41:18 1995 Morioka Tomohiko + + * tm-pgp.el: New function `mime-article/add-pgp-keys' + +Thu Dec 14 15:37:13 1995 Morioka Tomohiko + + * tm-play.el (mime-article/decode-caesar): + encoding field is symbol, not string. + + * tm-html.el: encoding field is symbol, not string. + +Thu Dec 14 15:17:56 1995 Shuhei KOBAYASHI + + * tm-vm.el(tm-vm/scroll-forward, tm-vm/scroll-backward): + According to AKITO Ishihara 's report, + `vm-scroll-(forward|backward)' was enclosed by + `(let ((vm-inhibit-startup-message t)) ...)'. + (cf. [tm-ja:1313], [tm-ja:1314]) + +Thu Dec 14 06:22:20 1995 Morioka Tomohiko + + * signature.el (signature/insert-signature-at-eof): + `(delete-blank-lines)' was commented out. + +Thu Dec 13 15:37:16 1995 Shuhei KOBAYASHI + + * tm-vm.el (tm-vm/scroll-forward, tm-vm/scroll-backward): + It might be better to treat `vm-honor-page-delimiters' (and + `vm-auto-next-message' too) in tm-vm. (cf. [tm-ja:1292]) + +Wed Dec 13 13:40:58 1995 AKITO Ishihara + + * tm-vm.el (tm-vm/scroll-backward): fixed to comment out + `(goto-char (point-max))'. (cf. [tm-ja:1289]) + +Wed Dec 13 13:10:27 1995 Morioka Tomohiko + + * tm-edit.el (mime-editor/process-pgp-kazu): fixed to insert dummy + mail-header-separator before calling mailcrypt function. diff --git a/Makefile b/Makefile index 66ad54a..d55eb9b 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ # -# $Id: Makefile,v 7.8 1995/12/07 12:07:47 morioka Exp morioka $ +# $Id: Makefile,v 7.9 1995/12/14 17:03:27 morioka Exp morioka $ # include config.tm -UTILS = src/ol2 src/decode-b -GOMI = $(UTILS) *.elc loadpath +BINS = src/ol2 src/decode-b +UTILS = $(BINS) src/tmpgp +GOMI = $(BINS) *.elc loadpath TM_FILES = tm/README.en tm/Changes* \ tm/config.tm tm/Makefile tm/mk-tm \ @@ -19,7 +20,7 @@ TM_FILES = tm/README.en tm/Changes* \ tm/tm-setup.el tm/mime-setup.el \ tm/sc-setup.el \ tm/methods/tm* \ - tm/src/*.c \ + tm/src/*.c tm/src/tmpgp \ tm/doc/Makefile tm/doc/*.ol tm/doc/*.tex \ tm/doc/*.texi @@ -36,7 +37,7 @@ TL_FILES = tl/README.en tl/Makefile tl/mk-tl tl/*.el tl/doc/*.texi \ FILES = $(TM_FILES) $(TM_MUA_FILES) $(MEL_FILES) $(TL_FILES) -TARFILE = tm7.33.tar.gz +TARFILE = tm7.34.tar.gz 18: diff --git a/gnus/s-path b/gnus/s-path index 2b2d041..3394631 100644 --- a/gnus/s-path +++ b/gnus/s-path @@ -7,4 +7,4 @@ ;;; ;; please edit -(add-path "sgnus-0.21/lisp") +(add-path "sgnus-0.22/lisp") diff --git a/mk-tm b/mk-tm index f843c6b..27221b1 100644 --- a/mk-tm +++ b/mk-tm @@ -18,7 +18,7 @@ (add-path "vm-5.95beta/") ;; Please specify Mailcrypt path. -(add-path "mailcrypt-3.4beta/") +(add-path "mailcrypt-3.4/") (setq tm-modules (cons diff --git a/signature.el b/signature.el index ecd1673..937885b 100644 --- a/signature.el +++ b/signature.el @@ -8,7 +8,7 @@ ;;; Author: MORIOKA Tomohiko ;;; OKABE Yasuo (1994/08/01) ;;; Version: -;;; $Id: signature.el,v 7.0 1995/11/16 16:28:53 morioka Exp $ +;;; $Id: signature.el,v 7.1 1995/12/14 06:22:20 morioka Exp $ ;;; Keywords: mail, news, signature ;;; ;;; This file is part of tm (Tools for MIME). @@ -103,7 +103,7 @@ (goto-char (point-max)) (if (not (bolp)) (insert "\n")) - (delete-blank-lines) + ;;(delete-blank-lines) (insert-file-contents signature) (set-buffer-modified-p (buffer-modified-p)) ; force mode line update diff --git a/src/tmpgp b/src/tmpgp new file mode 100755 index 0000000..f43e0ce --- /dev/null +++ b/src/tmpgp @@ -0,0 +1,4 @@ +#!/bin/sh +output=$1 +shift +pgp $* | mmencode -b -o $output diff --git a/tm-edit.el b/tm-edit.el index b163885..139b7b2 100644 --- a/tm-edit.el +++ b/tm-edit.el @@ -7,7 +7,7 @@ ;; Author: UMEDA Masanobu ;; MORIOKA Tomohiko -;; Version: $Revision: 7.32.1.2 $ +;; Version: $Revision: 7.34 $ ;; Keywords: mail, news, MIME, multimedia, multilingual ;; This file is not part of GNU Emacs. @@ -108,7 +108,7 @@ ;; LCD Archive Entry: ;; mime|Masanobu UMEDA|umerin@mse.kyutech.ac.jp| ;; Simple MIME Composer| -;; $Date: 1995/12/10 15:06:34 $|$Revision: 7.32.1.2 $|~/misc/mime.el.Z| +;; $Date: 1995/12/14 15:49:00 $|$Revision: 7.34 $|~/misc/mime.el.Z| ;;; Code: @@ -126,7 +126,7 @@ ;;; (defconst mime-editor/RCS-ID - "$Id: tm-edit.el,v 7.32.1.2 1995/12/10 15:06:34 morioka Exp $") + "$Id: tm-edit.el,v 7.34 1995/12/14 15:49:00 morioka Exp $") (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) @@ -395,8 +395,7 @@ Each elements are regexp of field-name. [tm-edit.el]") ;;; (defvar mime-editor/signing-type nil - "*PGP signing type (pgp-elkins, pgp-kazu or nil). -Sorry `pgp-elkins' is not supported yet. [tm-edit.el]") + "*PGP signing type (pgp-elkins, pgp-kazu or nil). [tm-edit.el]") (defvar mime-editor/encrypting-type nil "*PGP encrypting type (pgp-elkins, pgp-kazu or nil). @@ -484,6 +483,7 @@ Tspecials means any character that matches with it in header must be quoted.") (define-key keymap "\C-m" 'mime-editor/insert-mail) (define-key keymap "\C-w" 'mime-editor/insert-signature) (define-key keymap "\C-s" 'mime-editor/insert-signature) + (define-key keymap "\C-k" 'mime-editor/insert-key) (define-key keymap "t" 'mime-editor/insert-tag) (define-key keymap "a" 'mime-editor/enclose-alternative-region) (define-key keymap "p" 'mime-editor/enclose-parallel-region) @@ -516,6 +516,7 @@ Tspecials means any character that matches with it in header must be quoted.") (digest "Enclose as digest" mime-editor/enclose-digest-region) (signed "Enclose as signed" mime-editor/enclose-signed-region) (encrypted "Enclose as encrypted" mime-editor/enclose-encrypted-region) + (key "Insert Public Key" mime-editor/insert-key) (split "About split" mime-editor/set-split) ) (if (and (featurep 'mailcrypt) @@ -1417,14 +1418,16 @@ while if FLAG is `\\^M' (control-M) the text is hidden." (defun mime-editor/translate-buffer () "Encode the tagged MIME message in current buffer in MIME compliant message." (interactive) - (save-excursion - (if (catch 'mime-editor/error + (if (catch 'mime-editor/error + (save-excursion (mime/encode-message-header) (mime-editor/translate-body) (mime-editor/pgp-processing) - ) + )) + (progn + (undo) (error "Translation error!") - ))) + ))) (defun mime-editor/find-inmost () (goto-char (point-min)) @@ -1479,7 +1482,7 @@ while if FLAG is `\\^M' (control-M) the text is hidden." ))) (cond ((string= type "signed") (cond ((eq mime-editor/signing-type 'pgp-elkins) - (message "Sorry, it is not supported yet") + (mime-editor/sign-pgp-elkins bb eb boundary) ) ((eq mime-editor/signing-type 'pgp-kazu) (mime-editor/process-pgp-kazu 'mc-sign @@ -1506,32 +1509,139 @@ while if FLAG is `\\^M' (control-M) the text is hidden." )) boundary)))) -(defun mime-editor/process-pgp-kazu (type beg end boundary) - (save-restriction - (narrow-to-region beg end) - (let* ((ret - (mime-editor/translate-region beg end boundary)) - (ctype (car ret)) - (encoding (nth 1 ret)) - (parts (nth 3 ret)) - ) - (goto-char beg) - (insert (format "Content-Type: %s\n" ctype)) - (if encoding - (insert (format "Content-Transfer-Encoding: %s\n" encoding)) - ) - (insert "\n") - (if (null - (let ((mail-header-separator "")) - (call-interactively type) - )) - (throw 'mime-editor/error 'pgp-error) +(defun mc-tmpgp-generic-parser (result) + (if (or (not (eq result 0)) + (mc-message "^\aError: +Bad pass phrase\\.$" (current-buffer)) + ) + (progn + (mc-deactivate-passwd t) + nil) + result)) + +(defvar mc-tmpgp-path "tmpgp") + +(defun tm:mc-pgp-sign-region (start end &optional id unclear boundary) + (if (not (boundp 'mc-pgp-user-id)) + (load "mc-pgp") + ) + (let ((process-environment process-environment) + (buffer (get-buffer-create mc-buffer-name)) + passwd args key parser pgp-path + signature-file) + (setq key (mc-pgp-lookup-key (or id mc-pgp-user-id))) + (setq passwd + (mc-activate-passwd + (cdr key) + (format "PGP passphrase for %s (%s): " (car key) (cdr key)))) + (setenv "PGPPASSFD" "0") + (setq args + (list "+verbose=1" "+language=en" + (format "+clearsig=%s" (if unclear "off" "on")) + "+batchmode" "-u" (cdr key))) + (if boundary + (progn + (setq parser 'mc-tmpgp-generic-parser + pgp-path mc-tmpgp-path + signature-file (make-temp-name + (expand-file-name "tm-sign" mime/tmp-dir)) + args (cons "-fbst" args)) + (if mc-pgp-comment + (setq args (cons (format "+comment=%s" mc-pgp-comment) args)) + ) + (setq args (cons signature-file args)) + ) + (setq parser 'mc-pgp-generic-parser + pgp-path mc-pgp-path + args (cons "-fast" args) + ) + (if mc-pgp-comment + (setq args (cons (format "+comment=%s" mc-pgp-comment) args)) ) - (goto-char beg) - (insert - "--[[application/pgp; format=mime][7bit]]\n") - )) - ) + ) + (message "Signing as %s ..." (car key)) + (if (mc-process-region start end passwd pgp-path args parser buffer) + (progn + (if boundary + (progn + (goto-char (point-min)) + (insert + (format "\ +--[[multipart/signed; protocol=\"application/pgp-signature\"; + boundary=\"%s\"; micalg=pgp-md5][7bit]] +--%s\n" boundary boundary)) + (goto-char (point-max)) + (insert (format "\n--%s\n" boundary)) + (insert "Content-Type: application/pgp-signature +Content-Transfer-Encoding: base64 + +") + (insert-file-contents signature-file) + (goto-char (point-max)) + (insert (format "\n--%s--\n" boundary)) + )) + (delete-file signature-file) + (message "Signing as %s ... Done." (car key)) + t) + nil))) + +(defun mime-editor/sign-pgp-elkins (beg end boundary) + (save-excursion + (save-restriction + (narrow-to-region beg end) + (let* ((ret + (mime-editor/translate-region beg end boundary)) + (ctype (car ret)) + (encoding (nth 1 ret)) + (parts (nth 3 ret)) + (pgp-boundary (concat "pgp-sign-" boundary)) + ) + (goto-char beg) + (insert (format "Content-Type: %s\n" ctype)) + (if encoding + (insert (format "Content-Transfer-Encoding: %s\n" encoding)) + ) + (insert "\n") + (or (tm:mc-pgp-sign-region (point-min)(point-max) + nil nil pgp-boundary) + (throw 'mime-editor/error 'pgp-error) + ) + )))) + +(defun mime-editor/process-pgp-kazu (type beg end boundary) + (save-excursion + (save-restriction + (narrow-to-region beg end) + (let* ((ret + (mime-editor/translate-region beg end boundary)) + (ctype (car ret)) + (encoding (nth 1 ret)) + (parts (nth 3 ret)) + ) + (goto-char beg) + (insert (format "Content-Type: %s\n" ctype)) + (if encoding + (insert (format "Content-Transfer-Encoding: %s\n" encoding)) + ) + (insert "\n") + (if (null + (progn + (goto-char beg) + (insert "=\n") + (prog1 + (let ((mail-header-separator "=")) + (call-interactively type) + ) + (goto-char beg) + (and (search-forward "=\n") + (replace-match "")) + ))) + (throw 'mime-editor/error 'pgp-error) + ) + (goto-char beg) + (insert + "--[[application/pgp; format=mime][7bit]]\n") + )) + )) (defun mime-editor/translate-body () "Encode the tagged MIME body in current buffer in MIME compliant message." @@ -2074,6 +2184,14 @@ a recording host instead of local host." (message "Please specify encrypting type.") )) +(defun mime-editor/insert-key (&optional arg) + "Insert a pgp public key." + (interactive "P") + (mime-editor/insert-tag "application" "pgp-keys") + (mime-editor/define-encoding "7bit") + (mc-insert-public-key) + ) + ;;; @ flag setting ;;; diff --git a/tm-html.el b/tm-html.el index 1b20b75..0f832fc 100644 --- a/tm-html.el +++ b/tm-html.el @@ -1,12 +1,33 @@ ;;; ;;; tm-html.el: a tm-view internal decoder for HTML ;;; -;;; by MORIOKA Tomohiko (1995/09/14) +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1995 MORIOKA Tomohiko ;;; -;;; based on tm-latex.el by OKABE Yasuo +;;; Author: MORIOKA Tomohiko +;;; Created: 1995/9/14 +;;; based on tm-latex.el by OKABE Yasuo +;;; Version: +;;; $Id: tm-html.el,v 7.4 1995/12/14 15:33:55 morioka Exp $ +;;; Keywords: mail, news, MIME, multimedia, HTML, WWW ;;; -;;; $Id: tm-html.el,v 7.3 1995/12/04 00:20:31 morioka Exp $ +;;; This file is part of tm (Tools for MIME). ;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with This program. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'tm-view) @@ -16,7 +37,7 @@ (name (or (cdr (assoc "name" cal)) (cdr (assoc "x-name" cal)) (concat (make-temp-name "tm") ".html"))) - (encoding (cdr (assoc "encoding" cal))) + (encoding (cdr (assq 'encoding cal))) ;; modified by Shuhei KOBAYASHI ;; 1995/11/17 (cf. [tm-ja:1117]) (html-helper-build-new-buffer nil) diff --git a/tm-pgp.el b/tm-pgp.el index 48282ec..b452eb8 100644 --- a/tm-pgp.el +++ b/tm-pgp.el @@ -8,7 +8,7 @@ ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1995/12/7 ;;; Version: -;;; $Id: tm-pgp.el,v 4.0 1995/12/09 08:37:21 morioka Exp $ +;;; $Id: tm-pgp.el,v 5.0 1995/12/14 15:41:18 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, PGP, security ;;; ;;; This file is part of tm (Tools for MIME). @@ -177,6 +177,39 @@ (method . mime-article/check-pgp-signature) )) + +;;; @ Internal method for application/pgp-keys +;;; +;;; It is based on draft-elkins-pem-pgp-01.txt + +(defun mime-article/add-pgp-keys (beg end cal) + (let* ((cnum (mime-article/point-content-number beg)) + (cur-buf (current-buffer)) + (new-name (format "%s-%s" (buffer-name) cnum)) + (mother mime::article/preview-buffer) + (charset (cdr (assoc "charset" cal))) + (encoding (cdr (assq 'encoding cal))) + (mode major-mode) + str) + (setq str (buffer-substring beg end)) + (switch-to-buffer new-name) + (setq buffer-read-only nil) + (erase-buffer) + (insert str) + (goto-char (point-min)) + (if (re-search-forward "^\n" nil t) + (delete-region (point-min) (match-end 0)) + ) + (mime/decode-region encoding (point-min)(point-max)) + (mc-snarf-keys) + (kill-buffer (current-buffer)) + )) + +(set-atype 'mime/content-decoding-condition + '((type . "application/pgp-keys") + (method . mime-article/add-pgp-keys) + )) + ;;; @ end ;;; diff --git a/tm-play.el b/tm-play.el index f94b373..1df7786 100644 --- a/tm-play.el +++ b/tm-play.el @@ -8,7 +8,7 @@ ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1995/9/26 (separated from tm-view.el) ;;; Version: -;;; $Id: tm-play.el,v 7.9 1995/12/10 20:33:48 morioka Exp $ +;;; $Id: tm-play.el,v 7.10 1995/12/14 15:37:13 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia ;;; ;;; This file is part of tm (Tools for MIME). @@ -349,7 +349,7 @@ (new-name (format "%s-%s" (buffer-name) cnum)) (mother mime::article/preview-buffer) (charset (cdr (assoc "charset" cal))) - (encoding (cdr (assoc "encoding" cal))) + (encoding (cdr (assq 'encoding cal))) (mode major-mode) str) (setq str (buffer-substring beg end)) diff --git a/tm-vm.el b/tm-vm.el index b5b1174..66a2f2e 100644 --- a/tm-vm.el +++ b/tm-vm.el @@ -9,10 +9,11 @@ ;;; Shuhei KOBAYASHI ;;; Oscar Figueiredo ;;; modified by SHIONO Jun'ichi +;;; and ISHIHARA Akito ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1994/10/29 -;;; Version: $Revision: 7.31 $ -;;; Keywords: news, MIME, multimedia, multilingual, encoded-word +;;; Version: $Revision: 7.35 $ +;;; Keywords: mail, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). ;;; @@ -31,12 +32,14 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with This program. If not, write to the Free Software ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: (require 'tm-view) (require 'vm) (defconst tm-vm/RCS-ID - "$Id: tm-vm.el,v 7.31 1995/12/08 22:32:55 morioka Exp $") + "$Id: tm-vm.el,v 7.35 1995/12/14 16:38:50 morioka Exp $") (defconst tm-vm/version (get-version-string tm-vm/RCS-ID)) (define-key vm-mode-map "Z" 'tm-vm/view-message) @@ -254,7 +257,8 @@ all marked messages are affected, other messages are ignored." ;; fixed by SHIONO Jun'ichi ;; 1995/11/17 (cf.[tm-ja:1119]) (setq this-command 'vm-scroll-forward) - (vm-scroll-forward arg) + (let ((vm-inhibit-startup-message t)) + (vm-scroll-forward arg)) (save-excursion (set-buffer summary-buffer) (setq mail-win (get-buffer-window vm-mail-buffer))) @@ -304,7 +308,8 @@ all marked messages are affected, other messages are ignored." ;; fixed by SHIONO Jun'ichi ;; 1995/11/17 (cf.[tm-ja:1119]) (setq this-command 'vm-scroll-backward) - (vm-scroll-backward arg) + (let ((vm-inhibit-startup-message t)) + (vm-scroll-backward arg)) (save-excursion (set-buffer summary-buffer) (setq mail-win (get-buffer-window vm-mail-buffer))) @@ -313,7 +318,7 @@ all marked messages are affected, other messages are ignored." (get-buffer mime::article/preview-buffer)) (progn (select-window mail-win) - (goto-char (point-max)) +; (goto-char (point-max)) (switch-to-buffer mime::article/preview-buffer) (select-window summary-win))) ))) -- 1.7.10.4