+1999-05-22 Daiki Ueno <daiki@kiss.kake.info.waseda.ac.jp>
+ Tsukamoto Tetsuo <czkmt@remus.dti.ne.jp>
+
+ * 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 <czkmt@remus.dti.ne.jp>
* texi/gnusref-ja.tex (subsec Notes): Complete words.
(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)
"*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.")
(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")))
(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)