emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102349: Make mm-dissect-buffer pass


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102349: Make mm-dissect-buffer pass sender's mail address to smime-decrypt-region.
Date: Thu, 11 Nov 2010 23:51:05 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102349
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Thu 2010-11-11 23:51:05 +0000
message:
  Make mm-dissect-buffer pass sender's mail address to smime-decrypt-region.
  
  mm-decode.el (mm-dissect-buffer): Pass sender's mail address to 
smime-decrypt-region using function argument.
  mm-decode.el (mm-possibly-verify-or-decrypt, mm-dissect-multipart): Relay it.
  mm-view.el (mm-view-pkcs7, mm-view-pkcs7-decrypt): Relay it.
  smime.el (smime-decrypt-region): Catch it.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/mm-decode.el
  lisp/gnus/mm-view.el
  lisp/gnus/smime.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-11-11 22:24:03 +0000
+++ b/lisp/gnus/ChangeLog       2010-11-11 23:51:05 +0000
@@ -1,3 +1,13 @@
+2010-11-11  Katsumi Yamaoka  <address@hidden>
+
+       * mm-decode.el (mm-dissect-buffer): Pass sender's mail address to
+       smime-decrypt-region using function argument.
+       (mm-possibly-verify-or-decrypt, mm-dissect-multipart): Relay it.
+
+       * mm-view.el (mm-view-pkcs7, mm-view-pkcs7-decrypt): Relay it.
+
+       * smime.el (smime-decrypt-region): Catch it.
+
 2010-11-11  Stefan Monnier  <address@hidden>
 
        * smime.el (smime-mode-map): Move initialization into declaration.

=== modified file 'lisp/gnus/mm-decode.el'
--- a/lisp/gnus/mm-decode.el    2010-11-04 22:18:09 +0000
+++ b/lisp/gnus/mm-decode.el    2010-11-11 23:51:05 +0000
@@ -624,7 +624,7 @@
             no-strict-mime
             (and cd (mail-header-parse-content-disposition cd))
             description id)
-           ctl))))
+           ctl from))))
        (when id
          (when (string-match " *<\\(.*\\)> *" id)
            (setq id (match-string 1 id)))
@@ -666,7 +666,7 @@
        (save-restriction
          (narrow-to-region start end)
          (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts)))))
-    (mm-possibly-verify-or-decrypt (nreverse parts) ctl)))
+    (mm-possibly-verify-or-decrypt (nreverse parts) ctl from)))
 
 (defun mm-copy-to-buffer ()
   "Copy the contents of the current buffer to a fresh buffer."
@@ -1569,7 +1569,7 @@
 
 (autoload 'mm-view-pkcs7 "mm-view")
 
-(defun mm-possibly-verify-or-decrypt (parts ctl)
+(defun mm-possibly-verify-or-decrypt (parts ctl &optional from)
   (let ((type (car ctl))
        (subtype (cadr (split-string (car ctl) "/")))
        (mm-security-handle ctl) ;; (car CTL) is the type.
@@ -1584,7 +1584,7 @@
                    ((eq mm-decrypt-option 'known) t)
                    (t (y-or-n-p
                        (format "Decrypt (S/MIME) part? "))))
-                  (mm-view-pkcs7 parts))
+                  (mm-view-pkcs7 parts from))
          (setq parts (mm-dissect-buffer t)))))
      ((equal subtype "signed")
       (unless (and (setq protocol

=== modified file 'lisp/gnus/mm-view.el'
--- a/lisp/gnus/mm-view.el      2010-11-01 01:49:16 +0000
+++ b/lisp/gnus/mm-view.el      2010-11-11 23:51:05 +0000
@@ -653,9 +653,9 @@
          (t
           (error "Could not identify PKCS#7 type")))))
 
-(defun mm-view-pkcs7 (handle)
+(defun mm-view-pkcs7 (handle &optional from)
   (case (mm-view-pkcs7-get-type handle)
-    (enveloped (mm-view-pkcs7-decrypt handle))
+    (enveloped (mm-view-pkcs7-decrypt handle from))
     (signed (mm-view-pkcs7-verify handle))
     (otherwise (error "Unknown or unimplemented PKCS#7 type"))))
 
@@ -680,7 +680,7 @@
     (replace-match "\n"))
   t)
 
-(defun mm-view-pkcs7-decrypt (handle)
+(defun mm-view-pkcs7-decrypt (handle &optional from)
   (insert-buffer-substring (mm-handle-buffer handle))
   (goto-char (point-min))
   (insert "MIME-Version: 1.0\n")
@@ -692,7 +692,8 @@
      (smime-get-key-by-email
       (gnus-completing-read
        "Decipher using key"
-       smime-keys nil nil nil (car-safe (car-safe smime-keys))))))
+       smime-keys nil nil nil (car-safe (car-safe smime-keys)))))
+   from)
   (goto-char (point-min))
   (while (search-forward "\r\n" nil t)
     (replace-match "\n"))

=== modified file 'lisp/gnus/smime.el'
--- a/lisp/gnus/smime.el        2010-11-11 22:24:03 +0000
+++ b/lisp/gnus/smime.el        2010-11-11 23:51:05 +0000
@@ -426,11 +426,7 @@
     (insert-buffer-substring smime-details-buffer)
     nil))
 
-;; TODO: fix this properly by giving it a prefix.
-(if (featurep 'xemacs)
-    (defvar from))
-
-(defun smime-decrypt-region (b e keyfile)
+(defun smime-decrypt-region (b e keyfile &optional from)
   "Decrypt S/MIME message in region between B and E with key in KEYFILE.
 On success, replaces region with decrypted data and return non-nil.
 Any details (stderr on success, stdout and stderr on error) are left
@@ -454,8 +450,7 @@
            (delete-file tmpfile)))
        (progn
          (delete-region b e)
-         (when (boundp 'from)
-           ;; `from' is dynamically bound in mm-dissect.
+         (when from
            (insert "From: " from "\n"))
          (insert-buffer-substring buffer)
          (kill-buffer buffer)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]