Change to support (FILE <filename>) password option for POP mail.
authorChris Hanson <org/chris-hanson/cph>
Thu, 12 Oct 1995 22:47:48 +0000 (22:47 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 12 Oct 1995 22:47:48 +0000 (22:47 +0000)
v7/src/edwin/os2.scm

index 8d272c383ee8e233d2375e4cb7027ee13569bc40..2b2e7ebd96456af8f008fd765ad317344d32e0a5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: os2.scm,v 1.22 1995/10/03 21:14:24 cph Exp $
+;;;    $Id: os2.scm,v 1.23 1995/10/12 22:47:48 cph Exp $
 ;;;
 ;;;    Copyright (c) 1994-95 Massachusetts Institute of Technology
 ;;;
@@ -714,15 +714,17 @@ filename suffix \".gz\"."
                           directory))))
     (let ((buffer (temporary-buffer "*popclient*")))
       (let ((status.reason
-            (run-synchronous-process #f (buffer-end buffer) #f #f
-                                     "popclient"
-                                     (if (ref-variable rmail-pop-delete)
-                                         "-3"
-                                         "-3 -k")
-                                     "-u" user-name
-                                     "-p" password
-                                     "-o" target
-                                     server)))
+            (let ((args
+                   (list "-u" user-name
+                         "-p" (os2-pop-client-password password)
+                         "-o" target
+                         server)))
+              (apply run-synchronous-process #f (buffer-end buffer) #f #f
+                     "popclient"
+                     "-3"
+                     (if (ref-variable rmail-pop-delete)
+                         args
+                         (cons "-k" args))))))
        (if (and (eq? 'EXITED (car status.reason))
                 (memv (cdr status.reason) '(0 1)))
            (kill-buffer buffer)
@@ -731,6 +733,16 @@ filename suffix \".gz\"."
              (editor-error "Error getting mail from POP server.")))))
     target))
 
+(define (os2-pop-client-password password)
+  (cond ((string? password)
+        password)
+       ((and (pair? password) (eq? 'FILE (car password)))
+        (call-with-input-file (cadr password)
+          (lambda (port)
+            (read-string (char-set #\newline) port))))
+       (else
+        (error "Illegal password:" password))))
+
 (define-variable rmail-pop-delete
   "If true, messages are deleted from the POP server after being retrieved.
 Otherwise, messages remain on the server and will be re-fetched later."