summaryrefslogtreecommitdiff
path: root/lisp/gnus/mm-view.el
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2011-01-02 11:23:02 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-01-02 11:23:02 +0000
commitbb7f5cbcda931661c8dc3311603ac764fa87a639 (patch)
tree311c07278ad7497e54b3f7cafb50fbf6185b026f /lisp/gnus/mm-view.el
parent7927f48d454f33668f9dcef6b2d9476d24fe54bb (diff)
downloademacs-bb7f5cbcda931661c8dc3311603ac764fa87a639.tar.gz
Merge changes made in Gnus trunk.
mm-view.el (mml-smime): Require. mm-view.el (mm-view-pkcs7-decrypt): If mml-smime-use is set to 'epg, use EPG to decrypt S/MIME messages instead of openssl. nnimap.el (nnimap-request-group): Avoid double SELECT on `M-g'. gnus-group.el (gnus-group-kill-group): Don't try to update the group status is the group clearly is unreachable. auth-source.el (auth-source-create): Add the optional second parameter to `local-variable-p' to be compatible with XEmacs. nnml.el (nnml-request-article): Allow requesting by Message-ID to work when using a compressed nnml folder. gnus-sum.el (gnus-select-newsgroup): Don't propagate marks to backends after sanitising on entry, because this never makes sense: If the articles have gone missing, then the data no longer exists on the backend, and if they haven't, then Gnus is wrong, and shouldn't overwrite anything anyway. shr.el (shr-insert-document): Bind shr-width dynamically to window-width if it's nil. shr.el (shr-width, shr-insert-document): Allow nil as shr-width value with the meaning of using the full emacs window width for rendering.
Diffstat (limited to 'lisp/gnus/mm-view.el')
-rw-r--r--lisp/gnus/mm-view.el31
1 files changed, 19 insertions, 12 deletions
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 083781b0f9d..61d5b32b2c7 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -1,7 +1,7 @@
;;; mm-view.el --- functions for viewing MIME objects
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; This file is part of GNU Emacs.
@@ -32,6 +32,7 @@
(require 'mm-bodies)
(require 'mm-decode)
(require 'smime)
+(require 'mml-smime)
(autoload 'gnus-completing-read "gnus-util")
(autoload 'gnus-window-inside-pixel-edges "gnus-ems")
@@ -683,17 +684,23 @@
(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")
- (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
- (smime-decrypt-region
- (point-min) (point-max)
- (if (= (length smime-keys) 1)
- (cadar smime-keys)
- (smime-get-key-by-email
- (gnus-completing-read
- "Decipher using key"
- smime-keys nil nil nil (car-safe (car-safe smime-keys)))))
- from)
+ (if (eq mml-smime-use 'epg)
+ ;; Use EPG/gpgsm
+ (let ((part (base64-decode-string (buffer-string))))
+ (erase-buffer)
+ (insert (epg-decrypt-string (epg-make-context 'CMS) part)))
+ ;; Use openssl
+ (insert "MIME-Version: 1.0\n")
+ (mm-insert-headers "application/pkcs7-mime" "base64" "smime.p7m")
+ (smime-decrypt-region
+ (point-min) (point-max)
+ (if (= (length smime-keys) 1)
+ (cadar smime-keys)
+ (smime-get-key-by-email
+ (gnus-completing-read
+ "Decipher using key"
+ 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"))