From 4a64136ac8a104e22f7b473af9715396db9ffc89 Mon Sep 17 00:00:00 2001 From: czkmt Date: Sat, 22 May 1999 14:22:43 +0000 Subject: [PATCH] * lisp/pop3.el : Add an autoload for `open-ssl-stream' defined inv`ssl'. (pop3-connection-type, pop3-ssl-program-arguments): New variables. (pop3-open-ssl-stream-1, pop3-open-ssl-stream): New functions. (pop3-open-server): Call the latter when `pop3-connection-type' is ssl. * lisp/pop3-fma.el (pop3-fma-movemail): Bind `pop3-port' and `pop3-connection-type' according to `pop3-fma-spool-file-alist'. --- ChangeLog | 13 +++++++++++++ lisp/pop3-fma.el | 13 +++++++++++-- lisp/pop3.el | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4176f51..1691985 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +1999-05-22 Daiki Ueno + Tsukamoto Tetsuo + + * lisp/pop3.el : Add an autoload for `open-ssl-stream' defined in + `ssl'. + (pop3-connection-type, pop3-ssl-program-arguments): New variables. + (pop3-open-ssl-stream-1, pop3-open-ssl-stream): New functions. + (pop3-open-server): Call the latter when `pop3-connection-type' is + ssl. + + * lisp/pop3-fma.el (pop3-fma-movemail): Bind `pop3-port' and + `pop3-connection-type' according to `pop3-fma-spool-file-alist'. + 1999-05-16 Tsukamoto Tetsuo * texi/gnusref-ja.tex (subsec Notes): Complete words. diff --git a/lisp/pop3-fma.el b/lisp/pop3-fma.el index d6ecf68..73550f2 100644 --- a/lisp/pop3-fma.el +++ b/lisp/pop3-fma.el @@ -206,13 +206,22 @@ If there is any problem , please set this variable to nil(default). (pop3-password (if (and pop3-fma-save-password-information pop3-fma-password) - (pop3-fma-read-passwd (substring inbox (match-end (string-match "^.*@" inbox)))) + (let ((stored-passwd (pop3-fma-read-passwd (substring inbox (match-end (string-match "^.*@" inbox)))))) + (if stored-passwd + stored-passwd + (pop3-fma-set-pop3-password) + (pop3-fma-read-passwd (substring inbox (match-end (string-match "^.*@" inbox)))))) (pop3-fma-input-password (substring inbox (match-end (string-match "^.*@" inbox))) (substring inbox (match-end (string-match "^po:" inbox)) (- (match-end (string-match "^.*@" inbox)) 1))))) (pop3-authentication-scheme - (nth 1 (assoc inbox pop3-fma-spool-file-alist)))) + (nth 1 (assoc inbox pop3-fma-spool-file-alist))) + (pop3-port + (or (nth 2 (assoc inbox pop3-fma-spool-file-alist)) + 110)) + (pop3-connection-type + (nth 3 (assoc inbox pop3-fma-spool-file-alist)))) ;; (pop3-fma-movemail-type (pop3-fma-get-movemail-type inbox))) (if (eq pop3-authentication-scheme 'pass) (message "Checking new mail user %s at %s using USER/PASS ..." pop3-maildrop pop3-mailhost) diff --git a/lisp/pop3.el b/lisp/pop3.el index 1bc7a47..4556518 100644 --- a/lisp/pop3.el +++ b/lisp/pop3.el @@ -45,6 +45,8 @@ "*POP3 mailhost.") (defvar pop3-port 110 "*POP3 port.") +(defvar pop3-connection-type nil + "*POP3 connection type.") (defvar pop3-password-required t "*Non-nil if a password is required when connecting to POP server.") @@ -63,6 +65,13 @@ Used for APOP authentication.") (defvar pop3-read-point nil) (defvar pop3-debug nil) +(eval-and-compile + (autoload 'open-ssl-stream "ssl")) + +(defvar pop3-ssl-program-arguments + '("-quiet") + "Arguments to be passed to the program `pop3-ssl-program-name'.") + (defun pop3-movemail (&optional crashbox) "Transfer contents of a maildrop to the specified CRASHBOX." (or crashbox (setq crashbox (expand-file-name "~/.crashbox"))) @@ -119,13 +128,40 @@ Returns the process associated with the connection." (setq pop3-read-point (point-min)) ) (setq process - (open-network-stream-as-binary "POP" process-buffer mailhost port)) + (cond ((eq pop3-connection-type 'ssl) + (pop3-open-ssl-stream "POP" process-buffer mailhost port)) + (t + (open-network-stream-as-binary "POP" process-buffer mailhost port)))) (let ((response (pop3-read-response process t))) (setq pop3-timestamp (substring response (or (string-match "<" response) 0) (+ 1 (or (string-match ">" response) -1))))) process)) +(defun pop3-open-ssl-stream-1 (name buffer host service extra-arg) + (let* ((ssl-program-arguments + (` ((,@ pop3-ssl-program-arguments) (, extra-arg) + "-connect" (, (format "%s:%d" host service))))) + (process (open-ssl-stream name buffer host service))) + (when process + (with-current-buffer buffer + (goto-char (point-min)) + (while (and (memq (process-status process) '(open run)) + (goto-char (point-max)) + (forward-line -1) + (not (looking-at "+OK"))) + (accept-process-output process 1) + (sit-for 1)) + (delete-region (point-min) (point))) + (and process (memq (process-status process) '(open run)) + process)))) + +(defun pop3-open-ssl-stream (name buffer host service) + "Open a SSL connection for a service to a host." + (as-binary-process + (or (pop3-open-ssl-stream-1 name buffer host service "-ssl3") + (pop3-open-ssl-stream-1 name buffer host service "-ssl2")))) + ;; Support functions (defun pop3-process-filter (process output) -- 1.7.10.4