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 |
;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
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> |
139 |
mailhost))) |
mailhost))) |
140 |
(erase-buffer) |
(erase-buffer) |
141 |
(setq pop3-read-point (point-min)) |
(setq pop3-read-point (point-min)) |
142 |
(setq process (open-network-stream "POP"(current-buffer) mailhost port)) |
(setq process (open-network-stream "POP" (current-buffer) mailhost port)) |
143 |
(let ((response (pop3-read-response process t))) |
(let ((response (pop3-read-response process t))) |
144 |
(setq pop3-timestamp |
(setq pop3-timestamp |
145 |
(substring response (or (string-match "<" response) 0) |
(substring response (or (string-match "<" response) 0) |
244 |
(looking-at "\001\001\001\001\n") ; MMDF |
(looking-at "\001\001\001\001\n") ; MMDF |
245 |
(looking-at "BABYL OPTIONS:") ; Babyl |
(looking-at "BABYL OPTIONS:") ; Babyl |
246 |
)) |
)) |
247 |
(let ((from (mail-strip-quoted-names (mail-fetch-field "From"))) |
(let* ((from (mail-strip-quoted-names (mail-fetch-field "From"))) |
248 |
(date (split-string (or (mail-fetch-field "Date") |
(tdate (mail-fetch-field "Date")) |
249 |
(pop3-make-date)) |
(date (split-string (or (and tdate |
250 |
" ")) |
(not (string= "" tdate)) |
251 |
(From_)) |
tdate) |
252 |
|
(pop3-make-date)) |
253 |
|
" ")) |
254 |
|
(From_)) |
255 |
;; sample date formats I have seen |
;; sample date formats I have seen |
256 |
;; Date: Tue, 9 Jul 1996 09:04:21 -0400 (EDT) |
;; Date: Tue, 9 Jul 1996 09:04:21 -0400 (EDT) |
257 |
;; Date: 08 Jul 1996 23:22:24 -0400 |
;; Date: 08 Jul 1996 23:22:24 -0400 |
258 |
;; should be |
;; should be |
259 |
;; Tue Jul 9 09:04:21 1996 |
;; Tue Jul 9 09:04:21 1996 |
260 |
(setq date |
(setq date |
261 |
(cond ((string-match "[A-Z]" (nth 0 date)) |
(cond ((not date) |
262 |
|
"Tue Jan 1 00:00:0 1900") |
263 |
|
((string-match "[A-Z]" (nth 0 date)) |
264 |
(format "%s %s %s %s %s" |
(format "%s %s %s %s %s" |
265 |
(nth 0 date) (nth 2 date) (nth 1 date) |
(nth 0 date) (nth 2 date) (nth 1 date) |
266 |
(nth 4 date) (nth 3 date))) |
(nth 4 date) (nth 3 date))) |
337 |
t (current-buffer) nil) |
t (current-buffer) nil) |
338 |
;; The meaningful output is the first 32 characters. |
;; The meaningful output is the first 32 characters. |
339 |
;; Don't return the newline that follows them! |
;; Don't return the newline that follows them! |
340 |
(buffer-substring 1 33))))) |
(buffer-substring (point-min) (+ 32 (point-min))))))) |
341 |
|
|
342 |
(defun pop3-stat (process) |
(defun pop3-stat (process) |
343 |
"Return the number of messages in the maildrop and the maildrop's size." |
"Return the number of messages in the maildrop and the maildrop's size." |