Give a better error message in the "go offline" case.
[gnus] / lisp / mml2015.el
index d6d06c3..838813e 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mml2015.el --- MIME Security with Pretty Good Privacy (PGP)
 
 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008, 2009 Free Software Foundation, Inc.
+;;   2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: PGP MIME MML
 
 ;; For Emacs < 22.2.
 (eval-and-compile
-  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
+
+  (if (locate-library "password-cache")
+      (require 'password-cache)
+    (require 'password)))
 
 (eval-when-compile (require 'cl))
 (require 'mm-decode)
@@ -676,6 +680,7 @@ Whether the passphrase is cached at all is controlled by
        cipher)
     (mm-with-unibyte-current-buffer
       (with-temp-buffer
+       (mm-disable-multibyte)
        ;; set up a function to call the correct gpg encrypt routine
        ;; with the right arguments. (FIXME: this should be done
        ;; differently.)
@@ -986,8 +991,6 @@ Whether the passphrase is cached at all is controlled by
 (autoload 'epg-expand-group "epg-config")
 (autoload 'epa-select-keys "epa")
 
-(defvar password-cache-expiry)
-
 (defvar mml2015-epg-secret-key-id-list nil)
 
 (defun mml2015-epg-passphrase-callback (context key-id ignore)
@@ -1019,6 +1022,7 @@ Whether the passphrase is cached at all is controlled by
       (let ((pointer (epg-key-sub-key-list (car keys))))
        (while pointer
          (if (and (memq usage (epg-sub-key-capability (car pointer)))
+                  (not (memq 'disabled (epg-sub-key-capability (car pointer))))
                   (not (memq (epg-sub-key-validity (car pointer))
                              '(revoked expired))))
              (throw 'found (car keys)))
@@ -1416,5 +1420,4 @@ If no one is selected, default secret key is used.  "
 
 (provide 'mml2015)
 
-;; arch-tag: b04701d5-0b09-44d8-bed8-de901bf435f2
 ;;; mml2015.el ends here