* pgg-pgp.el (sign-region): Use `pgg-as-lbt'.
authorueno <ueno>
Sat, 6 Nov 1999 10:41:09 +0000 (10:41 +0000)
committerueno <ueno>
Sat, 6 Nov 1999 10:41:09 +0000 (10:41 +0000)
(pgg-gpg-process-region): Use `pgg-convert-lbt-region'.
(encrypt-region): Don't ask passphrase.

* pgg-pgp5.el (sign-region): Use `pgg-as-lbt'.
(pgg-pgp5-process-region): Use `pgg-convert-lbt-region'.
(encrypt-region): Don't ask passphrase.

* pgg-pgp.el (verify-region): Fill errors buffer.
(pgg-pgp-process-region): Use `pgg-convert-lbt-region'.
(sign-region): Use `pgg-as-lbt'.
(encrypt-region): Don't ask passphrase.

pgg-gpg.el
pgg-pgp.el
pgg-pgp5.el

index c98504e..0f5a140 100644 (file)
          exit-status (process-exit-status process))
     (delete-process process)
     (with-current-buffer output-buffer
-      (goto-char (point-min))
-      (while (search-forward "\r$" nil t)
-       (replace-match ""))
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF)
+
       (if (memq status '(stop signal))
          (error "%s exited abnormally: '%s'" program exit-status))
       (if (= 127 exit-status)
                         (mapcar (lambda (rcpt) 
                                   (list "--remote-user" 
                                         (concat "\"" rcpt "\""))) 
-                                recipients)))))
-        (inhibit-read-only t)
-        buffer-read-only)
-    (goto-char start)
-    (setq end (set-marker (make-marker) (point-max)))
-    (while (progn (end-of-line) (> (marker-position end) (point)))
-      (insert "\r")
-      (forward-line 1))
-    (pgg-gpg-process-region start end passphrase pgg-gpg-program args)
-    (goto-char start)
-    (while (re-search-forward "\r$" end t)
-      (replace-match ""))
+                                recipients))))))
+    (pgg-as-lbt start end 'CRLF
+      (pgg-gpg-process-region start end passphrase 
+                             pgg-gpg-program args)
+      )
     (pgg-process-when-success
-      (goto-char (point-min))
-      (while (re-search-forward "\r$" nil t)
-       (replace-match ""))
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF)
       (let ((packet 
             (cdr (assq 1 (pgg-parse-armor-region 
                           (point-min)(point-max))))))
                "--local-user" pgg-gpg-user-id))
         (inhibit-read-only t)
         buffer-read-only)
-    (goto-char start)
-    (setq end (set-marker (make-marker) (point-max)))
-    (while (progn (end-of-line) (> (marker-position end) (point)))
-      (insert "\r")
-      (forward-line 1))
-    (pgg-gpg-process-region start end passphrase pgg-gpg-program args)
-    (goto-char start)
-    (while (re-search-forward "\r$" end t)
-      (replace-match ""))
+    (pgg-as-lbt start end 'CRLF
+      (pgg-gpg-process-region start end passphrase pgg-gpg-program args)
+      )
     (pgg-process-when-success
-      (goto-char (point-min))
-      (while (re-search-forward "\r$" nil t)
-       (replace-match ""))
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF)
       (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX
        (let ((packet 
               (cdr (assq 2 (pgg-parse-armor-region 
index b66e5b8..448fd30 100644 (file)
          exit-status (process-exit-status process))
     (delete-process process)
     (with-current-buffer output-buffer
-      (goto-char (point-min))
-      (while (search-forward "\r$" nil t)
-       (replace-match ""))
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF)
+
       (if (memq status '(stop signal))
          (error "%s exited abnormally: '%s'" program exit-status))
       (if (= 127 exit-status)
 (luna-define-method encrypt-region ((scheme pgg-scheme-pgp) 
                                    start end recipients)
   (let* ((pgg-pgp-user-id pgg-default-user-id)
-        (passphrase
-         (pgg-read-passphrase 
-          (format "PGP passphrase for %s: " pgg-pgp-user-id)
-          (luna-send scheme 'lookup-key-string 
-                     scheme pgg-pgp-user-id 'encrypt)))
         (args 
          `("+encrypttoself=off +verbose=1" "+batchmode"
            "+language=us" "-fate"
            ,@(if recipients
                  (mapcar (lambda (rcpt) (concat "\"" rcpt "\""))
                          recipients)))))
-    (pgg-pgp-process-region start end passphrase 
+    (pgg-pgp-process-region start end nil
                            pgg-pgp-program args)
-    (pgg-process-when-success
-      (let ((packet 
-            (cdr (assq 1 (pgg-parse-armor-region 
-                          (point-min)(point-max))))))
-       (pgg-add-passphrase-cache 
-        (cdr (assq 'key-identifier packet))
-        passphrase)))
+    (pgg-process-when-success nil)
     ))
 
 (luna-define-method decrypt-region ((scheme pgg-scheme-pgp) 
         (args 
          (list (if clearsign "-fast" "-fbast")
                "+verbose=1" "+language=us" "+batchmode"
-               "-u" pgg-pgp-user-id)))
-    (pgg-pgp-process-region start end passphrase 
-                            pgg-pgp-program args)
+               "-u" pgg-pgp-user-id))
+        (inhibit-read-only t)
+        buffer-read-only)
+    (pgg-as-lbt start end 'CRLF
+      (pgg-pgp-process-region start end passphrase 
+                             pgg-pgp-program args)
+      )
     (pgg-process-when-success
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF)
       (goto-char (point-min))
       (when (re-search-forward "^-+BEGIN PGP" nil t);XXX
        (let ((packet 
                            pgg-pgp-program args)
     (delete-file orig-file)
     (if signature (delete-file signature))
-    (pgg-process-when-success nil)
+    (pgg-process-when-success
+      (goto-char (point-min))
+      (let ((case-fold-search t))
+       (while (re-search-forward "^warning: " nil t)
+         (delete-region (match-beginning 0)
+                        (progn (beginning-of-line 2) (point)))))
+      (goto-char (point-min))
+      (when (re-search-forward "^\\.$" nil t)
+       (delete-region (point-min) 
+                      (progn (beginning-of-line 2)
+                             (point)))))
     ))
 
 (luna-define-method insert-key ((scheme pgg-scheme-pgp))
index e4d4136..4ca4b16 100644 (file)
          exit-status (process-exit-status process))
     (delete-process process)
     (with-current-buffer output-buffer
-      (goto-char (point-min))
-      (while (search-forward "\r$" nil t)
-       (replace-match ""))
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF)
+
       (if (memq status '(stop signal))
          (error "%s exited abnormally: '%s'" program exit-status))
       (if (= 127 exit-status)
 (luna-define-method encrypt-region ((scheme pgg-scheme-pgp5) 
                                    start end recipients)
   (let* ((pgg-pgp5-user-id pgg-default-user-id)
-        (passphrase
-         (pgg-read-passphrase 
-          (format "PGP passphrase for %s: " pgg-pgp5-user-id)
-          (luna-send scheme 'lookup-key-string 
-                     scheme pgg-pgp5-user-id 'encrypt)))
         (args 
          `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1"
            ,@(if recipients
                                   (list "-r" 
                                         (concat "\"" rcpt "\""))) 
                                 recipients))))))
-    (pgg-pgp5-process-region start end passphrase 
+    (pgg-pgp5-process-region start end nil
                             pgg-pgp5-pgpe-program args)
-    (with-current-buffer pgg-output-buffer
-      (if (zerop (buffer-size))
-         (insert-buffer-substring pgg-errors-buffer)
-       (let ((packet 
-              (cdr (assq 1 (pgg-parse-armor-region 
-                            (point-min)(point-max))))))
-         (pgg-add-passphrase-cache 
-          (cdr (assq 'key-identifier packet))
-          passphrase))))
-    (pgg-process-when-success
-      (let ((packet 
-            (cdr (assq 1 (pgg-parse-armor-region 
-                          (point-min)(point-max))))))
-       (pgg-add-passphrase-cache 
-        (cdr (assq 'key-identifier packet))
-        passphrase)))
+    (pgg-process-when-success nil)
     ))
 
 (luna-define-method decrypt-region ((scheme pgg-scheme-pgp5) 
          (list (if clearsign "-fat" "-fbat")
                "+verbose=1" "+language=us" "+batchmode=1"
                "-u" pgg-pgp5-user-id)))
-    (pgg-pgp5-process-region start end passphrase 
-                            pgg-pgp5-pgps-program args)
+    (pgg-as-lbt start end 'CRLF
+      (pgg-pgp5-process-region start end passphrase 
+                              pgg-pgp5-pgps-program args)
+      )
     (pgg-process-when-success
-      (goto-char (point-min))
-      (while (re-search-forward "\r$" nil t)
-       (replace-match ""))
+      (pgg-convert-lbt-region (point-min)(point-max) 'LF)
       (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX
        (let ((packet 
               (cdr (assq 2 (pgg-parse-armor-region