Silence XEmacs compilation warnings.
[gnus] / lisp / mml2015.el
index d7070ef..78293f6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mml2015.el --- MIME Security with Pretty Good Privacy (PGP)
 
-;; Copyright (C) 2000-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: PGP MIME MML
@@ -59,8 +59,8 @@
                         ;; Don't load PGG if it is marked as obsolete
                         ;; (Emacs 24).
                         (when (and abs-file
-                                   (not (string-match-p "/obsolete/[^/]*\\'"
-                                                        abs-file)))
+                                   (not (string-match "/obsolete/[^/]*\\'"
+                                                      abs-file)))
                           (ignore-errors (require 'pgg))
                           (and (fboundp 'pgg-sign-region)
                                'pgg))))
@@ -788,13 +788,16 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
   (catch 'found
     (while keys
       (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)))
-         (setq pointer (cdr pointer))))
+       ;; The primary key will be marked as disabled, when the entire
+       ;; key is disabled (see 12 Field, Format of colon listings, in
+       ;; gnupg/doc/DETAILS)
+       (unless (memq 'disabled (epg-sub-key-capability (car pointer)))
+         (while pointer
+           (if (and (memq usage (epg-sub-key-capability (car pointer)))
+                    (not (memq (epg-sub-key-validity (car pointer))
+                               '(revoked expired))))
+               (throw 'found (car keys)))
+           (setq pointer (cdr pointer)))))
       (setq keys (cdr keys)))))
 
 ;; XXX: since gpg --list-secret-keys does not return validity of each
@@ -923,7 +926,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
        (mm-set-handle-multipart-parameter
         mm-security-handle 'gnus-info "Corrupted")
        (throw 'error handle))
-      (setq part (mm-replace-in-string part "\n" "\r\n" t)
+      (setq part (mm-replace-in-string part "\n" "\r\n")
            signature (mm-get-part signature)
            context (epg-make-context))
       (condition-case error