Mercurial > emacs
comparison lisp/gnus/pop3.el @ 91204:53108e6cea98
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 06 Dec 2007 09:51:45 +0000 |
parents | 880960b70474 166a6141ae98 |
children | 2fcaae6177a5 |
comparison
equal
deleted
inserted
replaced
91203:db40129142b2 | 91204:53108e6cea98 |
---|---|
34 ;; This program was inspired by Kyle E. Jones's vm-pop program. | 34 ;; This program was inspired by Kyle E. Jones's vm-pop program. |
35 | 35 |
36 ;;; Code: | 36 ;;; Code: |
37 | 37 |
38 (require 'mail-utils) | 38 (require 'mail-utils) |
39 (defvar parse-time-months) | |
39 | 40 |
40 (defgroup pop3 nil | 41 (defgroup pop3 nil |
41 "Post Office Protocol." | 42 "Post Office Protocol." |
42 :group 'mail | 43 :group 'mail |
43 :group 'mail-source) | 44 :group 'mail-source) |
239 (setq port 995)) | 240 (setq port 995)) |
240 (let ((process (open-tls-stream "POP" (current-buffer) | 241 (let ((process (open-tls-stream "POP" (current-buffer) |
241 mailhost port))) | 242 mailhost port))) |
242 (when process | 243 (when process |
243 ;; There's a load of info printed that needs deleting. | 244 ;; There's a load of info printed that needs deleting. |
244 (while (when (memq (process-status process) '(open run)) | 245 (let ((again 't)) |
245 (pop3-accept-process-output process) | 246 ;; repeat until |
246 (goto-char (point-max)) | 247 ;; - either we received the +OK line |
247 (forward-line -1) | 248 ;; - or accept-process-output timed out without getting |
248 (if (looking-at "\\+OK") | 249 ;; anything |
249 (progn | 250 (while (and again |
250 (delete-region (point-min) (point)) | 251 (setq again (memq (process-status process) |
251 nil) | 252 '(open run)))) |
253 (setq again (pop3-accept-process-output process)) | |
254 (goto-char (point-max)) | |
255 (forward-line -1) | |
256 (cond ((looking-at "\\+OK") | |
257 (setq again nil) | |
258 (delete-region (point-min) (point))) | |
259 ((not again) | |
252 (pop3-quit process) | 260 (pop3-quit process) |
253 (error "POP SSL connexion failed")))) | 261 (error "POP SSL connexion failed"))))) |
254 process))) | 262 process))) |
255 ((eq pop3-stream-type 'starttls) | 263 ((eq pop3-stream-type 'starttls) |
256 ;; gnutls-cli, openssl don't accept service names | 264 ;; gnutls-cli, openssl don't accept service names |
257 (if (equal port "pop3") | 265 (if (equal port "pop3") |
258 (setq port 110)) | 266 (setq port 110)) |
324 (goto-char start) | 332 (goto-char start) |
325 (while (and (< (point) end) (re-search-forward "^\\." end t)) | 333 (while (and (< (point) end) (re-search-forward "^\\." end t)) |
326 (replace-match "" t t) | 334 (replace-match "" t t) |
327 (forward-char))) | 335 (forward-char))) |
328 (set-marker end nil)) | 336 (set-marker end nil)) |
329 | |
330 (eval-when-compile (defvar parse-time-months)) | |
331 | 337 |
332 ;; Copied from message-make-date. | 338 ;; Copied from message-make-date. |
333 (defun pop3-make-date (&optional now) | 339 (defun pop3-make-date (&optional now) |
334 "Make a valid date header. | 340 "Make a valid date header. |
335 If NOW, use that time instead." | 341 If NOW, use that time instead." |