;;; Code:
(require 'mail-utils)
+(require 'nnheader)
(defvar pop3-maildrop (or (user-login-name) (getenv "LOGNAME") (getenv "USER") nil)
"*POP3 maildrop.")
(setq message-count (car (pop3-stat process)))
(unwind-protect
(while (<= n message-count)
- (message (format "Retrieving message %d of %d from %s..."
- n message-count pop3-mailhost))
+ (message "Retrieving message %d of %d from %s..."
+ n message-count pop3-mailhost)
(pop3-retr process n crashbuf)
(save-excursion
(set-buffer crashbuf)
(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))
(setq pass
(read-passwd (format "Password for %s: " pop3-maildrop))))
(if pass
- (let ((hash (pop3-md5 (concat pop3-timestamp pass))))
+ (let ((hash (md5 (concat pop3-timestamp pass))))
(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)))
;; TRANSACTION STATE
-(eval-and-compile
- (if (fboundp 'md5)
- (defalias 'pop3-md5 'md5)
- (defvar pop3-md5-program "md5"
- "*Program to encode its input in MD5.")
-
- (defun pop3-md5 (string)
- (with-temp-buffer
- (insert string)
- (call-process-region (point-min) (point-max)
- pop3-md5-program
- t (current-buffer) nil)
- ;; The meaningful output is the first 32 characters.
- ;; Don't return the newline that follows them!
- (buffer-substring (point-min) (+ 32 (point-min)))))))
-
(defun pop3-stat (process)
"Return the number of messages in the maildrop and the maildrop's size."
(pop3-send-command process "STAT")
(save-excursion
(set-buffer (process-buffer process))
(while (not (re-search-forward "^\\.\r\n" nil t))
+ ;; Fixme: Shouldn't depend on nnheader.
(nnheader-accept-process-output process)
;; bill@att.com ... to save wear and tear on the heap
;; uncommented because the condensed version below is a problem for
(provide 'pop3)
+;;; arch-tag: 2facc142-1d74-498e-82af-4659b64cac12
;;; pop3.el ends here