1 |
;;; pop3.el --- Post Office Protocol (RFC 1460) interface |
;;; pop3.el --- Post Office Protocol (RFC 1460) interface |
2 |
|
|
3 |
;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
4 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Richard L. Pieri <ratinox@peorth.gweep.net> |
;; Author: Richard L. Pieri <ratinox@peorth.gweep.net> |
78 |
;; query for password |
;; query for password |
79 |
(if (and pop3-password-required (not pop3-password)) |
(if (and pop3-password-required (not pop3-password)) |
80 |
(setq pop3-password |
(setq pop3-password |
81 |
(pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) |
(read-passwd (format "Password for %s: " pop3-maildrop)))) |
82 |
(cond ((equal 'apop pop3-authentication-scheme) |
(cond ((equal 'apop pop3-authentication-scheme) |
83 |
(pop3-apop process pop3-maildrop)) |
(pop3-apop process pop3-maildrop)) |
84 |
((equal 'pass pop3-authentication-scheme) |
((equal 'pass pop3-authentication-scheme) |
88 |
(setq message-count (car (pop3-stat process))) |
(setq message-count (car (pop3-stat process))) |
89 |
(unwind-protect |
(unwind-protect |
90 |
(while (<= n message-count) |
(while (<= n message-count) |
91 |
(message (format "Retrieving message %d of %d from %s..." |
(message "Retrieving message %d of %d from %s..." |
92 |
n message-count pop3-mailhost)) |
n message-count pop3-mailhost) |
93 |
(pop3-retr process n crashbuf) |
(pop3-retr process n crashbuf) |
94 |
(save-excursion |
(save-excursion |
95 |
(set-buffer crashbuf) |
(set-buffer crashbuf) |
121 |
;; query for password |
;; query for password |
122 |
(if (and pop3-password-required (not pop3-password)) |
(if (and pop3-password-required (not pop3-password)) |
123 |
(setq pop3-password |
(setq pop3-password |
124 |
(pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) |
(read-passwd (format "Password for %s: " pop3-maildrop)))) |
125 |
(cond ((equal 'apop pop3-authentication-scheme) |
(cond ((equal 'apop pop3-authentication-scheme) |
126 |
(pop3-apop process pop3-maildrop)) |
(pop3-apop process pop3-maildrop)) |
127 |
((equal 'pass pop3-authentication-scheme) |
((equal 'pass pop3-authentication-scheme) |
177 |
(save-excursion |
(save-excursion |
178 |
(set-buffer (process-buffer process)) |
(set-buffer (process-buffer process)) |
179 |
(goto-char pop3-read-point) |
(goto-char pop3-read-point) |
180 |
(while (not (search-forward "\r\n" nil t)) |
(while (and (memq (process-status process) '(open run)) |
181 |
(accept-process-output process 3) |
(not (search-forward "\r\n" nil t))) |
182 |
|
(nnheader-accept-process-output process) |
183 |
(goto-char pop3-read-point)) |
(goto-char pop3-read-point)) |
184 |
(setq match-end (point)) |
(setq match-end (point)) |
185 |
(goto-char pop3-read-point) |
(goto-char pop3-read-point) |
193 |
t) |
t) |
194 |
))))) |
))))) |
195 |
|
|
|
(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)) |
|
|
|
|
196 |
(defun pop3-clean-region (start end) |
(defun pop3-clean-region (start end) |
197 |
(setq end (set-marker (make-marker) end)) |
(setq end (set-marker (make-marker) end)) |
198 |
(save-excursion |
(save-excursion |
253 |
;; Tue Jul 9 09:04:21 1996 |
;; Tue Jul 9 09:04:21 1996 |
254 |
(setq date |
(setq date |
255 |
(cond ((not date) |
(cond ((not date) |
256 |
"Tue Jan 1 00:00:0 1900") |
"Tue Jan 1 00:00:0 1900") |
257 |
((string-match "[A-Z]" (nth 0 date)) |
((string-match "[A-Z]" (nth 0 date)) |
258 |
(format "%s %s %s %s %s" |
(format "%s %s %s %s %s" |
259 |
(nth 0 date) (nth 2 date) (nth 1 date) |
(nth 0 date) (nth 2 date) (nth 1 date) |
306 |
(let ((pass pop3-password)) |
(let ((pass pop3-password)) |
307 |
(if (and pop3-password-required (not pass)) |
(if (and pop3-password-required (not pass)) |
308 |
(setq pass |
(setq pass |
309 |
(pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) |
(read-passwd (format "Password for %s: " pop3-maildrop)))) |
310 |
(if pass |
(if pass |
311 |
(let ((hash (pop3-md5 (concat pop3-timestamp pass)))) |
(let ((hash (pop3-md5 (concat pop3-timestamp pass)))) |
312 |
(pop3-send-command process (format "APOP %s %s" user hash)) |
(pop3-send-command process (format "APOP %s %s" user hash)) |
353 |
(save-excursion |
(save-excursion |
354 |
(set-buffer (process-buffer process)) |
(set-buffer (process-buffer process)) |
355 |
(while (not (re-search-forward "^\\.\r\n" nil t)) |
(while (not (re-search-forward "^\\.\r\n" nil t)) |
356 |
(accept-process-output process 3) |
;; Fixme: Shouldn't depend on nnheader. |
357 |
|
(nnheader-accept-process-output process) |
358 |
;; bill@att.com ... to save wear and tear on the heap |
;; bill@att.com ... to save wear and tear on the heap |
359 |
;; uncommented because the condensed version below is a problem for |
;; uncommented because the condensed version below is a problem for |
360 |
;; some. |
;; some. |