X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tm-edit.el;h=15b0e7ccf1290af0c90fcefc4c12fd7105dea50c;hb=d1f12c89ac3491cdbbba0e24173e9b31f79ba73a;hp=5e2eff62c2ae6d478404ed6b20252d3dcac0e3c5;hpb=1180d8a2d6cb54ad1b944db81924ad7bab4f6b00;p=elisp%2Ftm.git diff --git a/tm-edit.el b/tm-edit.el index 5e2eff6..15b0e7c 100644 --- a/tm-edit.el +++ b/tm-edit.el @@ -1,31 +1,30 @@ -;;; ;;; tm-edit.el --- Simple MIME Composer for GNU Emacs -;;; -;;; Copyright (C) 1993 UMEDA Masanobu -;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko -;;; -;;; Author: UMEDA Masanobu -;;; MORIOKA Tomohiko -;;; Maintainer: MORIOKA Tomohiko -;;; Created: 1994/08/21 renamed from mime.el -;;; Version: $Revision: 7.75 $ -;;; Keywords: mail, news, MIME, multimedia, multilingual -;;; -;;; 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. + +;; Copyright (C) 1993 .. 1996 Free Software Foundation, Inc. + +;; Author: UMEDA Masanobu +;; MORIOKA Tomohiko +;; Maintainer: MORIOKA Tomohiko +;; Created: 1994/08/21 renamed from mime.el +;; Version: $Revision: 7.80 $ +;; Keywords: mail, news, MIME, multimedia, multilingual + +;; 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; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. ;;; Commentary: @@ -122,7 +121,7 @@ ;;; (defconst mime-editor/RCS-ID - "$Id: tm-edit.el,v 7.75 1996/07/31 02:51:16 morioka Exp $") + "$Id: tm-edit.el,v 7.80 1996/08/30 15:16:52 morioka Exp $") (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) @@ -524,6 +523,11 @@ Tspecials means any character that matches with it in header must be quoted.") (define-key keymap "s" 'mime-editor/enclose-signed-region) (define-key keymap "e" 'mime-editor/enclose-encrypted-region) (define-key keymap "q" 'mime-editor/enclose-quote-region) + (define-key keymap "7" 'mime-editor/set-transfer-level-7bit) + (define-key keymap "8" 'mime-editor/set-transfer-level-8bit) + (define-key keymap "/" 'mime-editor/set-split) + (define-key keymap "v" 'mime-editor/set-sign) + (define-key keymap "h" 'mime-editor/set-encrypt) (define-key keymap "\C-p" 'mime-editor/preview-message) (define-key keymap "\C-z" 'mime-editor/exit) (define-key keymap "?" 'mime-editor/help) @@ -1662,13 +1666,49 @@ Content-Transfer-Encoding: 7bit ) )))) +(defvar mime-editor/encrypt-recipient-fields-list '("To" "cc")) + +(defun mime-editor/make-encrypt-recipient-header () + (let* ((names mime-editor/encrypt-recipient-fields-list) + (values + (rfc822/get-field-bodies (cons "From" names) + nil mail-header-separator)) + (from (prog1 + (car values) + (setq values (cdr values)))) + (header (and (stringp from) + (if (string-equal from "") + "" + (format "From: %s\n" from) + ))) + recipients) + (while (and names values) + (let ((name (car names)) + (value (car values)) + ) + (and (stringp value) + (or (string-equal value "") + (progn + (setq header (concat header name ": " value "\n") + recipients (if recipients + (concat recipients " ," value) + value)) + )))) + (setq names (cdr names) + values (cdr values)) + ) + (vector from recipients header) + )) + (defun mime-editor/encrypt-pgp-elkins (beg end boundary) (save-excursion (save-restriction - (let ((from (rfc822/get-field-body "From" mail-header-separator)) - (to (rfc822/get-field-body "To" mail-header-separator)) - (cc (rfc822/get-field-body "cc" mail-header-separator)) - recipients) + (let (from recipients header) + (let ((ret (mime-editor/make-encrypt-recipient-header))) + (setq from (aref ret 0) + recipients (aref ret 1) + header (aref ret 2)) + ) (narrow-to-region beg end) (let* ((ret (mime-editor/translate-region beg end boundary)) @@ -1678,24 +1718,7 @@ Content-Transfer-Encoding: 7bit (pgp-boundary (concat "pgp-" boundary)) ) (goto-char beg) - (if (and (stringp from) - (not (string-equal from ""))) - (insert (format "From: %s\n" from)) - ) - (if (and (stringp to) - (not (string-equal to ""))) - (progn - (insert (format "To: %s\n" to)) - (setq recipients to) - )) - (if (and (stringp cc) - (not (string-equal cc ""))) - (progn - (insert (format "cc: %s\n" cc)) - (if recipients - (setq recipients (concat recipients "," cc)) - (setq recipients cc) - ))) + (insert header) (insert (format "Content-Type: %s\n" ctype)) (if encoding (insert (format "Content-Transfer-Encoding: %s\n" encoding)) @@ -1752,10 +1775,12 @@ Content-Transfer-Encoding: 7bit (defun mime-editor/encrypt-pgp-kazu (beg end boundary) (save-excursion - (let ((from (rfc822/get-field-body "From")) - (to (rfc822/get-field-body "To")) - (cc (rfc822/get-field-body "cc")) - recipients) + (let (from recipients header) + (let ((ret (mime-editor/make-encrypt-recipient-header))) + (setq from (aref ret 0) + recipients (aref ret 1) + header (aref ret 2)) + ) (save-restriction (narrow-to-region beg end) (let* ((ret @@ -1765,24 +1790,7 @@ Content-Transfer-Encoding: 7bit (parts (nth 3 ret)) ) (goto-char beg) - (if (and (stringp from) - (not (string-equal from ""))) - (insert (format "From: %s\n" from)) - ) - (if (and (stringp to) - (not (string-equal to ""))) - (progn - (insert (format "To: %s\n" to)) - (setq recipients to) - )) - (if (and (stringp cc) - (not (string-equal cc ""))) - (progn - (insert (format "cc: %s\n" cc)) - (if recipients - (setq recipients (concat recipients "," cc)) - (setq recipients cc) - ))) + (insert header) (insert (format "Content-Type: %s\n" ctype)) (if encoding (insert (format "Content-Transfer-Encoding: %s\n" encoding)) @@ -1952,11 +1960,13 @@ Content-Transfer-Encoding: 7bit (let ((beg (point)) (end (mime-editor/content-end)) ) - (goto-char end) - (or (looking-at mime-editor/beginning-tag-regexp) - (eobp) - (insert (mime-make-text-tag) "\n") - ) + (if (= end (point-max)) + nil + (goto-char end) + (or (looking-at mime-editor/beginning-tag-regexp) + (eobp) + (insert (mime-make-text-tag) "\n") + )) (visible-region beg end) (goto-char beg) ) @@ -2233,6 +2243,16 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8." (force-mode-line-update) ) +(defun mime-editor/set-transfer-level-7bit () + (interactive) + (mime-editor/toggle-transfer-level 7) + ) + +(defun mime-editor/set-transfer-level-8bit () + (interactive) + (mime-editor/toggle-transfer-level 8) + ) + ;;; @ pgp ;;;