(require 'path-util)
(require 'mail-utils)
+(require 'nnheader)
(defvar pop3-maildrop (or (user-login-name) (getenv "LOGNAME") (getenv "USER") nil)
"*POP3 maildrop.")
(+ 1 (or (string-match ">" response) -1)))))
process)))
+(eval-when-compile
+ (autoload 'open-ssl-stream "ssl"))
+
(defun pop3-open-ssl-stream-1 (name buffer host service extra-arg)
(require 'ssl)
(let* ((ssl-program-name
(save-excursion
(set-buffer (process-buffer process))
(goto-char pop3-read-point)
- (while (not (search-forward "\r\n" nil t))
+ (while (and (memq (process-status process) '(open run))
+ (not (search-forward "\r\n" nil t)))
(nnheader-accept-process-output process)
(goto-char pop3-read-point))
(setq match-end (point))
(if (not (and response (string-match "+OK" response)))
(pop3-quit process))))
-;; When this file is being compiled in the Gnus (not T-gnus) source
-;; tree, `md5' might have been defined in w3/md5.el, ./lpath.el or one
-;; of some other libraries and `md5' will accept only 3 arguments. We
-;; will deceive the byte-compiler not to say warnings.
-(eval-and-compile
- (if (fboundp 'eval-when)
- ;; `eval-when' might not be provided when loading .el file.
- (eval-when 'compile
- (let ((def (assq 'md5 byte-compile-function-environment)))
- (if def
- (setcdr def '(lambda (object &optional start end
- coding-system noerror)))
- (setq byte-compile-function-environment
- (cons '(md5 . (lambda (object &optional start end
- coding-system noerror)))
- byte-compile-function-environment)))))))
-
-;; Note that `pop3-md5' should never encode a given string to use for
-;; the apop authentication.
-(eval-and-compile
- (if (fboundp 'md5)
- (if (condition-case nil
- (md5 "\
-Check whether the 4th argument CODING-SYSTEM is allowed"
- nil nil 'binary)
- (error nil))
- ;; Emacs 21 or XEmacs 21
- ;; (md5 OBJECT &optional START END CODING-SYSTEM NOERROR)
- (defun pop3-md5 (string)
- (md5 string nil nil 'binary))
- ;; The reason why the program reaches here:
- ;; 1. XEmacs 20 is running and the built-in `md5' doesn't
- ;; allow the 4th argument.
- ;; 2. `md5' has been defined by one of some lisp libraries.
- ;; 3. This file is being compiled in the Gnus source tree,
- ;; and `md5' has been defined in lpath.el.
- (defalias 'pop3-md5 'md5))
- ;; The lisp function will be provided by FLIM or other libraries.
- (autoload 'md5 "md5")
- (defalias 'pop3-md5 'md5)))
-
(defun pop3-apop (process user)
"Send alternate authentication information to the server."
(let ((pass pop3-password))
(setq pass
(read-passwd (format "Password for %s: " pop3-maildrop))))
(if pass
- (let ((hash (pop3-md5 (concat pop3-timestamp pass))))
+ ;; Note that `md5' should never encode a given string to use for
+ ;; the apop authentication, so we should specify `binary'.
+ (let ((hash (md5 (concat pop3-timestamp pass) nil nil 'binary)))
(pop3-send-command process (format "APOP %s %s" user hash))
(let ((response (pop3-read-response process t)))
(if (not (and response (string-match "+OK" response)))
(set-buffer (process-buffer process))
(goto-char start)
(while (not (re-search-forward "^\\.\r\n" nil t))
+ ;; Fixme: Shouldn't depend on nnheader.
(nnheader-accept-process-output process)
(goto-char start))
(setq pop3-read-point (point-marker))