(gnus-large-newsgroup): Mention gnus-large-ephemeral-newsgroup.
[gnus] / lisp / mml1991.el
1 ;;; mml1991.el --- Old PGP message format (RFC 1991) support for MML
2
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
4 ;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
5
6 ;; Author: Sascha Lüdecke <sascha@meta-x.de>,
7 ;;      Simon Josefsson <simon@josefsson.org> (Mailcrypt interface, Gnus glue)
8 ;; Keywords PGP
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Commentary:
26
27 ;;; Code:
28
29 ;; For Emacs < 22.2.
30 (eval-and-compile
31   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
32
33   (if (locate-library "password-cache")
34       (require 'password-cache)
35     (require 'password)))
36
37 (eval-when-compile
38   (require 'cl)
39   (require 'mm-util))
40
41 (require 'mm-encode)
42 (require 'mml-sec)
43
44 (defvar mc-pgp-always-sign)
45
46 (autoload 'quoted-printable-decode-region "qp")
47 (autoload 'quoted-printable-encode-region "qp")
48
49 (autoload 'mm-decode-content-transfer-encoding "mm-bodies")
50 (autoload 'mm-encode-content-transfer-encoding "mm-bodies")
51 (autoload 'message-options-get "message")
52 (autoload 'message-options-set "message")
53
54 (defvar mml1991-use mml2015-use
55   "The package used for PGP.")
56
57 (defvar mml1991-function-alist
58   '((mailcrypt mml1991-mailcrypt-sign
59                mml1991-mailcrypt-encrypt)
60     (pgg mml1991-pgg-sign
61          mml1991-pgg-encrypt)
62     (epg mml1991-epg-sign
63          mml1991-epg-encrypt))
64   "Alist of PGP functions.")
65
66 (defvar mml1991-cache-passphrase mml-secure-cache-passphrase
67   "If t, cache passphrase.")
68
69 (defvar mml1991-passphrase-cache-expiry mml-secure-passphrase-cache-expiry
70   "How many seconds the passphrase is cached.
71 Whether the passphrase is cached at all is controlled by
72 `mml1991-cache-passphrase'.")
73
74 (defvar mml1991-signers nil
75   "A list of your own key ID which will be used to sign a message.")
76
77 (defvar mml1991-encrypt-to-self nil
78   "If t, add your own key ID to recipient list when encryption.")
79
80 ;;; mailcrypt wrapper
81
82 (autoload 'mc-sign-generic "mc-toplev")
83
84 (defvar mml1991-decrypt-function 'mailcrypt-decrypt)
85 (defvar mml1991-verify-function 'mailcrypt-verify)
86
87 (defun mml1991-mailcrypt-sign (cont)
88   (let ((text (current-buffer))
89         headers signature
90         (result-buffer (get-buffer-create "*GPG Result*")))
91     ;; Save MIME Content[^ ]+: headers from signing
92     (goto-char (point-min))
93     (while (looking-at "^Content[^ ]+:") (forward-line))
94     (unless (bobp)