X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fpop3.el;h=81d9f941f3b8d2290c0e365de72a790bff8945ba;hb=249142f014344b6f7e1a85fdebc289fd45819a84;hp=9f78bcb3fd8acd32312a7808ea22eb64b134365e;hpb=ebdecdf203f300217a9a7f533dcf43fec5d427b4;p=elisp%2Fgnus.git- diff --git a/lisp/pop3.el b/lisp/pop3.el index 9f78bcb..81d9f94 100644 --- a/lisp/pop3.el +++ b/lisp/pop3.el @@ -1,6 +1,6 @@ ;;; pop3.el --- Post Office Protocol (RFC 1460) interface -;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 ;; Free Software Foundation, Inc. ;; Author: Richard L. Pieri @@ -36,6 +36,7 @@ ;;; Code: (require 'mail-utils) +(require 'nnheader) (defvar pop3-maildrop (or (user-login-name) (getenv "LOGNAME") (getenv "USER") nil) "*POP3 maildrop.") @@ -75,7 +76,7 @@ Used for APOP authentication.") ;; query for password (if (and pop3-password-required (not pop3-password)) (setq pop3-password - (pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) + (read-passwd (format "Password for %s: " pop3-maildrop)))) (cond ((equal 'apop pop3-authentication-scheme) (pop3-apop process pop3-maildrop)) ((equal 'pass pop3-authentication-scheme) @@ -85,8 +86,8 @@ Used for APOP authentication.") (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) @@ -117,7 +118,7 @@ Used for APOP authentication.") ;; query for password (if (and pop3-password-required (not pop3-password)) (setq pop3-password - (pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) + (read-passwd (format "Password for %s: " pop3-maildrop)))) (cond ((equal 'apop pop3-authentication-scheme) (pop3-apop process pop3-maildrop)) ((equal 'pass pop3-authentication-scheme) @@ -173,8 +174,9 @@ Return the response string if optional second argument is non-nil." (save-excursion (set-buffer (process-buffer process)) (goto-char pop3-read-point) - (while (not (search-forward "\r\n" nil t)) - (accept-process-output process 0 500) + (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)) (goto-char pop3-read-point) @@ -188,17 +190,6 @@ Return the response string if optional second argument is non-nil." t) ))))) -(defvar pop3-read-passwd nil) -(defun pop3-read-passwd (prompt) - (if (not pop3-read-passwd) - (if (fboundp 'read-passwd) - (setq pop3-read-passwd 'read-passwd) - (if (load "passwd" t) - (setq pop3-read-passwd 'read-passwd) - (autoload 'ange-ftp-read-passwd "ange-ftp") - (setq pop3-read-passwd 'ange-ftp-read-passwd)))) - (funcall pop3-read-passwd prompt)) - (defun pop3-clean-region (start end) (setq end (set-marker (make-marker) end)) (save-excursion @@ -312,9 +303,9 @@ If NOW, use that time instead." (let ((pass pop3-password)) (if (and pop3-password-required (not pass)) (setq pass - (pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) + (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))) @@ -323,22 +314,6 @@ If NOW, use that time instead." ;; 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") @@ -359,7 +334,8 @@ This function currently does nothing.") (save-excursion (set-buffer (process-buffer process)) (while (not (re-search-forward "^\\.\r\n" nil t)) - (accept-process-output process 0 500) + ;; 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 ;; some.