PGG
Simon Josefsson
jas at extundo.com
Sun Sep 29 00:58:16 JST 2002
Simon Josefsson <jas at extundo.com> writes:
> Simon Josefsson <jas at extundo.com> writes:
>
>> This was trivial, fortunately. With the following patch, PGG
>
> I forgot pgg-gpg and pgg-pgp5...
And to test the patches... this (in addition to the earlier one's)
works under Emacs 21.2 and XEmacs 21.4. They are committed to Oort
CVS.
I didn't understand why the luna.el patch was necessary, but without
it building it in the XEmacs package build system bails out (try the
XEmacs package in CVS under unsupported/simon/pgg/).
Index: luna.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/luna.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- luna.el 2002/09/26 04:50:05 1.2
+++ luna.el 2002/09/28 16:34:35 1.3
@@ -176,13 +176,13 @@ The optional 5th BODY is the body of the
(put 'luna-define-method 'lisp-indent-function 'defun)
-(def-edebug-spec luna-define-method
- (&define name [&optional &or ":before" ":after" ":around"]
- ((arg symbolp)
- [&rest arg]
- [&optional ["&optional" arg &rest arg]]
- &optional ["&rest" arg])
- def-body))
+;(def-edebug-spec luna-define-method
+; (&define name [&optional &or ":before" ":after" ":around"]
+; ((arg symbolp)
+; [&rest arg]
+; [&optional ["&optional" arg &rest arg]]
+; &optional ["&rest" arg])
+; def-body))
;; Return a list of method functions named SERVICE registered in the
Index: pgg-parse.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg-parse.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- pgg-parse.el 2002/09/28 14:47:41 1.2
+++ pgg-parse.el 2002/09/28 16:34:35 1.3
@@ -99,8 +99,12 @@
"^-----BEGIN PGP SIGNATURE-----\r?$")
"Armor headers.")
+(defalias 'pgg-char-int (if (fboundp 'char-int)
+ 'char-int
+ 'identity))
+
(defmacro pgg-format-key-identifier (string)
- `(mapconcat (lambda (c) (format "%02X" (char-int c)))
+ `(mapconcat (lambda (c) (format "%02X" (pgg-char-int c)))
,string "")
;; `(upcase (apply #'format "%02x%02x%02x%02x%02x%02x%02x%02x"
;; (string-to-int-list ,string)))
@@ -114,10 +118,10 @@
0))
(defmacro pgg-byte-after (&optional pos)
- `(char-int (char-after ,(or pos `(point)))))
+ `(pgg-char-int (char-after ,(or pos `(point)))))
(defmacro pgg-read-byte ()
- `(char-int (char-after (prog1 (point) (forward-char)))))
+ `(pgg-char-int (char-after (prog1 (point) (forward-char)))))
(defmacro pgg-read-bytes-string (nbytes)
`(buffer-substring
@@ -125,7 +129,7 @@
(forward-char ,nbytes))))
(defmacro pgg-read-bytes (nbytes)
- `(mapcar #'char-int (pgg-read-bytes-string ,nbytes))
+ `(mapcar #'pgg-char-int (pgg-read-bytes-string ,nbytes))
;; `(string-to-int-list (pgg-read-bytes-string ,nbytes))
)
@@ -135,7 +139,7 @@
(pgg-read-bytes-string (- (point-max) (point)))))
(defmacro pgg-read-body (ptag)
- `(mapcar #'char-int (pgg-read-body-string ,ptag))
+ `(mapcar #'pgg-char-int (pgg-read-body-string ,ptag))
;; `(string-to-int-list (pgg-read-body-string ,ptag))
)
@@ -460,13 +464,12 @@
(match-beginning 0))))
(checksum (buffer-substring (point) (+ 4 (point)))))
(delete-region marker (point-max))
- (mime-decode-region (point-min) marker "base64")
- (when (fboundp 'pgg-parse-crc24-string )
+ (base64-decode-region (point-min) marker)
+ (when (fboundp 'pgg-parse-crc24-string)
(or pgg-ignore-packet-checksum
(string-equal
- (funcall (mel-find-function 'mime-encode-string "base64")
- (pgg-parse-crc24-string
- (buffer-string)))
+ (base64-encode-string (pgg-parse-crc24-string
+ (buffer-string)))
checksum)
(error "PGP packet checksum does not match")))))
@@ -485,12 +488,17 @@
(defun pgg-parse-armor (string)
(with-temp-buffer
(buffer-disable-undo)
- (set-buffer-multibyte nil)
+ (if (fboundp 'set-buffer-multibyte)
+ (set-buffer-multibyte nil))
(insert string)
(pgg-decode-armor-region (point-min)(point))))
+(defalias 'pgg-string-as-unibyte (if (fboundp 'string-as-unibyte)
+ 'string-as-unibyte
+ 'identity))
+
(defun pgg-parse-armor-region (start end)
- (pgg-parse-armor (string-as-unibyte (buffer-substring start end))))
+ (pgg-parse-armor (pgg-string-as-unibyte (buffer-substring start end))))
(provide 'pgg-parse)
Index: pgg-pgp5.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg-pgp5.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- pgg-pgp5.el 2002/09/28 15:13:22 1.2
+++ pgg-pgp5.el 2002/09/28 16:34:35 1.3
@@ -83,7 +83,7 @@ Bourne shell or its equivalent \(not tcs
(defun pgg-pgp5-process-region (start end passphrase program args)
(let* ((errors-file-name
- (concat temporary-file-directory
+ (concat pgg-temporary-file-directory
(make-temp-name "pgg-errors")))
(args
(append args
@@ -203,7 +203,7 @@ Bourne shell or its equivalent \(not tcs
(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp5)
start end &optional signature)
- (let* ((basename (expand-file-name "pgg" temporary-file-directory))
+ (let* ((basename (expand-file-name "pgg" pgg-temporary-file-directory))
(orig-file (make-temp-name basename))
(args '("+verbose=1" "+batchmode=1" "+language=us"))
(orig-mode (default-file-modes)))
@@ -240,7 +240,7 @@ Bourne shell or its equivalent \(not tcs
(luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-pgp5)
start end)
(let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id))
- (basename (expand-file-name "pgg" temporary-file-directory))
+ (basename (expand-file-name "pgg" pgg-temporary-file-directory))
(key-file (make-temp-name basename))
(args
(list "+verbose=1" "+batchmode=1" "+language=us" "-a"
Index: pgg-gpg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg-gpg.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- pgg-gpg.el 2002/09/28 15:13:22 1.2
+++ pgg-gpg.el 2002/09/28 16:34:35 1.3
@@ -57,7 +57,7 @@
(defun pgg-gpg-process-region (start end passphrase program args)
(let* ((output-file-name
- (concat temporary-file-directory (make-temp-name "pgg-output")))
+ (concat pgg-temporary-file-directory (make-temp-name "pgg-output")))
(args
`("--status-fd" "2"
,@(if passphrase '("--passphrase-fd" "0"))
Index: pgg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg.el,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -p -r1.1 -r1.3
--- pgg.el 2002/09/24 15:15:31 1.1
+++ pgg.el 2002/09/28 16:40:30 1.3
@@ -41,6 +41,11 @@
(require 'w3)
(require 'url)))
+(defvar pgg-temporary-file-directory
+ (cond ((fboundp 'temp-directory) (temp-directory))
+ ((boundp 'temporary-file-directory) temporary-file-directory)
+ ("/tmp/")))
+
(in-calist-package 'pgg)
(defun pgg-field-match-method-with-containment
@@ -245,7 +250,6 @@
`(with-current-buffer pgg-output-buffer
(if (zerop (buffer-size)) nil , at body t)))
-
;;; @ interface functions
;;;
@@ -311,7 +315,8 @@ signer's public key from `pgg-default-ke
(if (null signature) nil
(with-temp-buffer
(buffer-disable-undo)
- (set-buffer-multibyte nil)
+ (if (fboundp 'set-buffer-multibyte)
+ (set-buffer-multibyte nil))
(insert-file-contents signature)
(cdr (assq 2 (pgg-decode-armor-region
(point-min)(point-max)))))))
More information about the Emacs-mime-en
mailing list