OSDN Git Service

Undo the last change.
authorDaiki Ueno <ueno@unixuser.org>
Thu, 8 Mar 2007 11:46:52 +0000 (11:46 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Thu, 8 Mar 2007 11:46:52 +0000 (11:46 +0000)
ChangeLog
epg.el

index 1240230..96c1ed7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,6 @@
 2007-03-08  Daiki Ueno  <ueno@unixuser.org>
 
        * epg.el (epg-list-keys): Parse GnuPG's print_string escape.
-       (epg-wait-for-plaintext): New function.
-       (epg--status-PLAINTEXT_LENGTH): New function.
-       (epg-decrypt-string): Don't use a temp output file.
-       (epg--status-BEGIN_DECRYPTION): New function; reset 'plaintext
-       result.
-       (epg--status-DECRYPTION_OKAY): Copy 'plaintext result to
-       'decrypted-plaintext.
-       (epg-verify-file): Don't use a temp output file.
-       (epg-verify-string): Ditto.
 
 2007-03-08  Daiki Ueno  <ueno@unixuser.org>
 
diff --git a/epg.el b/epg.el
index 63d40b5..5a3ce86 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -1120,7 +1120,6 @@ This function is for internal use only."
                       args)))
       (set-default-file-modes orig-mode))
     (set-process-filter process #'epg--process-filter)
-    (set-process-sentinel process #'ignore)
     (epg-context-set-process context process)))
 
 (defun epg--process-filter (process input)
@@ -1148,17 +1147,14 @@ This function is for internal use only."
                             (string (match-string 2))
                             (symbol (intern-soft (concat "epg--status-"
                                                          status))))
-                       (forward-line)
-                       (setq epg-read-point (point))
                        (if (member status epg-pending-status-list)
                            (setq epg-pending-status-list nil))
                        (if (and symbol
                                 (fboundp symbol))
                            (funcall symbol epg-context string))
-                       (goto-char epg-read-point)
-                       (setq epg-last-status (cons status string)))
-                   (forward-line)
-                   (setq epg-read-point (point)))))
+                       (setq epg-last-status (cons status string))))
+                 (forward-line)
+                 (setq epg-read-point (point))))
            (setq epg-process-filter-running nil))))))
 
 (defun epg-read-output (context)
@@ -1184,12 +1180,6 @@ This function is for internal use only."
   (while (eq (process-status (epg-context-process context)) 'run)
     (accept-process-output (epg-context-process context) 1)))
 
-(defun epg-wait-for-plaintext (context length)
-  "Wait data from the `epg-gpg-program' process."
-  (while (and (eq (process-status (epg-context-process context)) 'run)
-             (< (- (point-max) epg-read-point) length))
-    (accept-process-output (epg-context-process context) 1)))
-
 (defun epg-reset (context)
   "Reset the CONTEXT."
   (if (and (epg-context-process context)
@@ -1497,27 +1487,11 @@ This function is for internal use only."
               (if (consp (epg-context-progress-callback context))
                   (cdr (epg-context-progress-callback context))))))
 
-(defun epg--status-BEGIN_DECRYPTION (context string)
-  (epg-context-set-result-for context 'plaintext nil))
-
 (defun epg--status-DECRYPTION_FAILED (context string)
   (epg-context-set-result-for context 'decryption-failed t))
 
 (defun epg--status-DECRYPTION_OKAY (context string)
-  (epg-context-set-result-for context 'decryption-okay t)
-  (epg-context-set-result-for
-   context
-   'decrypted-plaintext
-   (epg-context-result-for context 'plaintext)))
-
-(defun epg--status-PLAINTEXT_LENGTH (context string)
-  (when (string-match "\\`\\([0-9]+\\)" string)
-    (let ((length (string-to-number (match-string 1 string))))
-      (epg-wait-for-plaintext context length)
-      (epg-context-set-result-for
-       context 'plaintext
-       (buffer-substring epg-read-point
-                        (setq epg-read-point (+ epg-read-point length)))))))
+  (epg-context-set-result-for context 'decryption-okay t))
 
 (defun epg--status-NODATA (context string)
   (epg-context-set-result-for
@@ -1971,10 +1945,13 @@ If PLAIN is nil, it returns the result as a string."
     (unwind-protect
        (progn
          (write-region cipher nil input-file nil 'quiet)
+         (epg-context-set-output-file context
+                                      (epg--make-temp-file "epg-output"))
          (epg-start-decrypt context (epg-make-data-from-file input-file))
          (epg-wait-for-completion context)
          (epg--check-error-for-decrypt context)
-         (epg-context-result-for context 'decrypted-plaintext))
+         (epg-read-output context))
+      (epg-delete-output-file context)
       (if (file-exists-p input-file)
          (delete-file input-file))
       (epg-reset context))))
@@ -2028,7 +2005,9 @@ stored into the file after successful verification."
   (unwind-protect
       (progn
        (if plain
-           (epg-context-set-output-file context plain))
+           (epg-context-set-output-file context plain)
+         (epg-context-set-output-file context
+                                      (epg--make-temp-file "epg-output")))
        (if signed-text
            (epg-start-verify context
                              (epg-make-data-from-file signature)
@@ -2037,7 +2016,9 @@ stored into the file after successful verification."
                            (epg-make-data-from-file signature)))
        (epg-wait-for-completion context)
        (unless plain
-         (epg-context-result-for context 'plaintext)))
+         (epg-read-output context)))
+    (unless plain
+      (epg-delete-output-file context))
     (epg-reset context)))
 
 ;;;###autoload
@@ -2053,6 +2034,8 @@ successful verification."
        input-file)
     (unwind-protect
        (progn
+         (epg-context-set-output-file context
+                                      (epg--make-temp-file "epg-output"))
          (if signed-text
              (progn
                (setq input-file (epg--make-temp-file "epg-signature"))
@@ -2062,7 +2045,8 @@ successful verification."
                                  (epg-make-data-from-string signed-text)))
            (epg-start-verify context (epg-make-data-from-string signature)))
          (epg-wait-for-completion context)
-         (epg-context-result-for context 'plaintext))
+         (epg-read-output context))
+      (epg-delete-output-file context)
       (if (and input-file
               (file-exists-p input-file))
          (delete-file input-file))