1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

Import changes from current Gnus.

(pop3-open-server): Bind coding systems before creating buffer and
fix creating its name.
(pop3-string-to-list): Function deleted.  Change callers to use
split-string.
This commit is contained in:
Dave Love 2000-05-08 17:59:45 +00:00
parent 6abca616a3
commit 4cac7481ee
2 changed files with 24 additions and 36 deletions

View File

@ -1,3 +1,11 @@
2000-05-08 Dave Love <fx@gnu.org>
* pop3.el: Import changes from current Gnus.
(pop3-open-server): Bind coding systems before creating buffer and
fix creating its name.
(pop3-string-to-list): Function deleted. Change callers to use
split-string.
1999-12-19 Dave Love <fx@gnu.org> 1999-12-19 Dave Love <fx@gnu.org>
* mail/pop3.el (pop3-movemail-file-coding-system): Doc fix. * mail/pop3.el (pop3-movemail-file-coding-system): Doc fix.

View File

@ -114,25 +114,20 @@ Used for APOP authentication.")
(defun pop3-open-server (mailhost port) (defun pop3-open-server (mailhost port)
"Open TCP connection to MAILHOST on PORT. "Open TCP connection to MAILHOST on PORT.
Returns the process associated with the connection." Returns the process associated with the connection."
(let ((process-buffer (let ((coding-system-for-read 'binary)
(get-buffer-create (format "trace of POP session to %s" mailhost)))
(process)
(coding-system-for-read 'binary)
(coding-system-for-write 'binary) (coding-system-for-write 'binary)
) process)
(save-excursion (save-excursion
(set-buffer process-buffer) (set-buffer (get-buffer-create (concat " trace of POP session to "
mailhost)))
(erase-buffer) (erase-buffer)
(setq pop3-read-point (point-min)) (setq pop3-read-point (point-min))
) (setq process (open-network-stream "POP"(current-buffer) mailhost port))
(setq process (let ((response (pop3-read-response process t)))
(open-network-stream "POP" process-buffer mailhost port)) (setq pop3-timestamp
(let ((response (pop3-read-response process t))) (substring response (or (string-match "<" response) 0)
(setq pop3-timestamp (+ 1 (or (string-match ">" response) -1)))))
(substring response (or (string-match "<" response) 0) process)))
(+ 1 (or (string-match ">" response) -1)))))
process
))
;; Support functions ;; Support functions
@ -176,22 +171,6 @@ Return the response string if optional second argument is non-nil."
t) t)
))))) )))))
(defun pop3-string-to-list (string &optional regexp)
"Chop up a string into a list."
(let ((list)
(regexp (or regexp " "))
(string (if (string-match "\r" string)
(substring string 0 (match-beginning 0))
string)))
(store-match-data nil)
(while string
(if (string-match regexp string)
(setq list (cons (substring string 0 (- (match-end 0) 1)) list)
string (substring string (match-end 0)))
(setq list (cons string list)
string nil)))
(nreverse list)))
(defvar pop3-read-passwd nil) (defvar pop3-read-passwd nil)
(defun pop3-read-passwd (prompt) (defun pop3-read-passwd (prompt)
(if (not pop3-read-passwd) (if (not pop3-read-passwd)
@ -227,8 +206,9 @@ Return the response string if optional second argument is non-nil."
(looking-at "BABYL OPTIONS:") ; Babyl (looking-at "BABYL OPTIONS:") ; Babyl
)) ))
(let ((from (mail-strip-quoted-names (mail-fetch-field "From"))) (let ((from (mail-strip-quoted-names (mail-fetch-field "From")))
(date (pop3-string-to-list (or (mail-fetch-field "Date") (date (split-string (or (mail-fetch-field "Date")
(message-make-date)))) (message-make-date))
" "))
(From_)) (From_))
;; sample date formats I have seen ;; sample date formats I have seen
;; Date: Tue, 9 Jul 1996 09:04:21 -0400 (EDT) ;; Date: Tue, 9 Jul 1996 09:04:21 -0400 (EDT)
@ -314,8 +294,8 @@ Return the response string if optional second argument is non-nil."
"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."
(pop3-send-command process "STAT") (pop3-send-command process "STAT")
(let ((response (pop3-read-response process t))) (let ((response (pop3-read-response process t)))
(list (string-to-int (nth 1 (pop3-string-to-list response))) (list (string-to-int (nth 1 (split-string response " ")))
(string-to-int (nth 2 (pop3-string-to-list response)))) (string-to-int (nth 2 (split-string response " "))))
)) ))
(defun pop3-list (process &optional msg) (defun pop3-list (process &optional msg)
@ -377,7 +357,7 @@ This function currently does nothing.")
"Return highest accessed message-id number for the session." "Return highest accessed message-id number for the session."
(pop3-send-command process "LAST") (pop3-send-command process "LAST")
(let ((response (pop3-read-response process t))) (let ((response (pop3-read-response process t)))
(string-to-int (nth 1 (pop3-string-to-list response))) (string-to-int (nth 1 (split-string response " ")))
)) ))
(defun pop3-rset (process) (defun pop3-rset (process)