* spam-report.el (spam-report-gmane-ham): Renamed from
[gnus] / lisp / pgg-gpg.el
index 94c1b3a..6ba017c 100644 (file)
@@ -1,6 +1,7 @@
 ;;; pgg-gpg.el --- GnuPG support for PGG.
 
-;; Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
+;;   2005 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/10/28
@@ -20,8 +21,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
 
@@ -30,7 +31,7 @@
   (require 'pgg))
 
 (defgroup pgg-gpg ()
-  "GnuPG interface"
+  "GnuPG interface."
   :group 'pgg)
 
 (defcustom pgg-gpg-program "gpg"
   (if (and pgg-cache-passphrase
           (progn
             (goto-char (point-min))
-            (re-search-forward "^\\[GNUPG:] GOOD_PASSPHRASE\\>" nil t)))
+            (re-search-forward "^\\[GNUPG:] \\(GOOD_PASSPHRASE\\>\\)\\|\\(SIG_CREATED\\)" nil t)))
       (pgg-add-passphrase-cache
        (or key
           (progn
             (goto-char (point-min))
             (if (re-search-forward
-                 "^\\[GNUPG:] NEED_PASSPHRASE \\w+ ?\\w*" nil t)
+                 "^\\[GNUPG:] NEED_PASSPHRASE\\(_PIN\\)? \\w+ ?\\w*" nil t)
                 (substring (match-string 0) -8))))
        passphrase)))
 
       (with-temp-buffer
        (apply #'call-process pgg-gpg-program nil t nil args)
        (goto-char (point-min))
-       (while (re-search-forward "^\\(sec\\|pub\\):"  nil t)
-         (push (substring
-                (nth 3 (split-string
-                        (buffer-substring (match-end 0)
-                                          (progn (end-of-line) (point)))
-                        ":")) 8)
+       (while (re-search-forward
+               "^\\(sec\\|pub\\):[^:]*:[^:]*:[^:]*:\\([^:]*\\)" nil t)
+         (push (substring (match-string 2) 8)
                pgg-gpg-all-secret-keys)))))
   pgg-gpg-all-secret-keys)
 
     (with-temp-buffer
       (apply #'call-process pgg-gpg-program nil t nil args)
       (goto-char (point-min))
-      (if (re-search-forward "^\\(sec\\|pub\\):"  nil t)
-         (substring
-          (nth 3 (split-string
-                  (buffer-substring (match-end 0)
-                                    (progn (end-of-line)(point)))
-                  ":")) 8)))))
+      (if (re-search-forward "^\\(sec\\|pub\\):[^:]*:[^:]*:[^:]*:\\([^:]*\\)"
+                            nil t)
+         (substring (match-string 2) 8)))))
 
 (defun pgg-gpg-encrypt-region (start end recipients &optional sign)
   "Encrypt the current region between START and END.
@@ -258,7 +253,7 @@ If optional argument SIGN is non-nil, do a combined sign and encrypt."
     (when (re-search-forward "^\\[GNUPG:] IMPORT_RES\\>" nil t)
       (setq status (buffer-substring (match-end 0)
                                     (progn (end-of-line)(point)))
-           status (vconcat (mapcar #'string-to-int (split-string status))))
+           status (vconcat (mapcar #'string-to-number (split-string status))))
       (erase-buffer)
       (insert (format "Imported %d key(s).
 \tArmor contains %d key(s) [%d bad, %d old].\n"
@@ -276,4 +271,5 @@ If optional argument SIGN is non-nil, do a combined sign and encrypt."
 
 (provide 'pgg-gpg)
 
+;;; arch-tag: 2aa5d5d8-93a0-4865-9312-33e29830e000
 ;;; pgg-gpg.el ends here