[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r118319: Make rmail-epa-decrypt handle more ways of
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] trunk r118319: Make rmail-epa-decrypt handle more ways of formatting the message. |
Date: |
Sat, 08 Nov 2014 15:48:17 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 118319
revision-id: address@hidden
parent: address@hidden
committer: Richard Stallman <address@hidden>
branch nick: trunk
timestamp: Sat 2014-11-08 10:48:13 -0500
message:
Make rmail-epa-decrypt handle more ways of formatting the message.
* mail/rmail.el (rmail-epa-decrypt): Detect armor with line prefixes.
Check more carefully for mime-part specified character set.
Check for mime-part Content Transfer Encoding.
Notify if no armor found.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/mail/rmail.el rmail.el-20091113204419-o5vbwnq5f7feedwu-8812
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-11-08 11:11:50 +0000
+++ b/lisp/ChangeLog 2014-11-08 15:48:13 +0000
@@ -1,3 +1,10 @@
+2014-11-08 Richard Stallman <address@hidden>
+
+ * mail/rmail.el (rmail-epa-decrypt): Detect armor with line prefixes.
+ Check more carefully for mime-part specified character set.
+ Check for mime-part Content Transfer Encoding.
+ Notify if no armor found.
+
2014-11-08 Martin Rudalics <address@hidden>
* faces.el (face-set-after-frame-default): Enable running
=== modified file 'lisp/mail/rmail.el'
--- a/lisp/mail/rmail.el 2014-09-30 10:21:33 +0000
+++ b/lisp/mail/rmail.el 2014-11-08 15:48:13 +0000
@@ -4512,11 +4512,11 @@
;; change it in one of the calls to `epa-decrypt-region'.
(save-excursion
- (let (decrypts)
+ (let (decrypts (mime (rmail-mime-message-p)))
(goto-char (point-min))
;; Turn off mime processing.
- (when (and (rmail-mime-message-p)
+ (when (and mime
(not (get-text-property (point-min) 'rmail-mime-hidden)))
(rmail-mime))
@@ -4525,10 +4525,19 @@
(goto-char (point-min))
(while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
(let ((coding-system-for-read coding-system-for-read)
- armor-start armor-end after-end)
+ (case-fold-search t)
+ unquote
+ armor-start armor-prefix armor-end after-end)
+
(setq armor-start (match-beginning 0)
- armor-end (re-search-forward "^-----END PGP MESSAGE-----$"
- nil t))
+ armor-prefix (buffer-substring
+ (line-beginning-position)
+ armor-start)
+ armor-end (re-search-forward
+ (concat "^"
+ armor-prefix
+ "-----END PGP MESSAGE-----$")
+ nil t))
(unless armor-end
(error "Encryption armor beginning has no matching end"))
(goto-char armor-start)
@@ -4536,30 +4545,49 @@
;; Because epa--find-coding-system-for-mime-charset not autoloaded.
(require 'epa)
- ;; Use the charset specified in the armor.
- (unless coding-system-for-read
- (if (re-search-forward "^Charset: \\(.*\\)" armor-end t)
- (setq coding-system-for-read
- (epa--find-coding-system-for-mime-charset
- (intern (downcase (match-string 1)))))))
-
;; Advance over this armor.
(goto-char armor-end)
(setq after-end (- (point-max) armor-end))
+ (when mime
+ (save-excursion
+ (goto-char armor-start)
+ (re-search-backward "^--" nil t)
+ (save-restriction
+ (narrow-to-region (point) armor-start)
+
+ ;; Use the charset specified in the armor.
+ (unless coding-system-for-read
+ (if (re-search-forward "^Charset: \\(.*\\)" nil t)
+ (setq coding-system-for-read
+ (epa--find-coding-system-for-mime-charset
+ (intern (downcase (match-string 1)))))))
+
+ (goto-char (point-min))
+ (if (re-search-forward "^[ \t]*Content-transfer-encoding[
\t]*:[ \t]*quoted-printable[ \t]*$" nil t)
+ (setq unquote t)))))
+
+ (when unquote
+ (let ((inhibit-read-only t))
+ (mail-unquote-printable-region armor-start
+ (- (point-max) after-end))))
+
;; Decrypt it, maybe in place, maybe making new buffer.
(epa-decrypt-region
- armor-start armor-end
+ armor-start (- (point-max) after-end)
;; Call back this function to prepare the output.
(lambda ()
(let ((inhibit-read-only t))
- (delete-region armor-start armor-end)
+ (delete-region armor-start (- (point-max) after-end))
(goto-char armor-start)
(current-buffer))))
(push (list armor-start (- (point-max) after-end))
decrypts)))
+ (unless decrypts
+ (error "Nothing to decrypt"))
+
(when (and decrypts (rmail-buffers-swapped-p))
(when (y-or-n-p "Replace the original message? ")
(setq decrypts (nreverse decrypts))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r118319: Make rmail-epa-decrypt handle more ways of formatting the message.,
Richard M. Stallman <=