X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fpop3.el;h=a5470d7d818bac524abcd5b4480e53df360d3dc1;hb=0f63151c0cfcb3498678c203edb84e6a1d2b57e0;hp=51c2f1ae987b4d18f94e438684a90dc794488b8c;hpb=be55eaa8348212550b263f85223e62737f917d3c;p=gnus diff --git a/lisp/pop3.el b/lisp/pop3.el index 51c2f1ae9..a5470d7d8 100644 --- a/lisp/pop3.el +++ b/lisp/pop3.el @@ -33,6 +33,7 @@ ;;; Code: +(eval-when-compile (require 'cl)) (require 'mail-utils) (defvar parse-time-months) @@ -145,12 +146,13 @@ Use streaming commands." (unless pop3-leave-mail-on-server (pop3-send-streaming-command process "DELE" message-count nil)))) - (pop3-quit process))) + (pop3-quit process) + t)) (defun pop3-send-streaming-command (process command count total-size) (erase-buffer) (let ((i 1)) - (while (>= (1+ count) i) + (while (>= count i) (process-send-string process (format "%s %d\r\n" command i)) ;; Only do 100 messages at a time to avoid pipe stalls. (when (zerop (% i 100)) @@ -197,13 +199,13 @@ Use streaming commands." ;; delete it. (when (eolp) (delete-char 1)) - (write-region (point-min) (point-max) file))))) + (write-region (point-min) (point-max) file nil 'nomesg))))) (defun pop3-number-of-responses (endp) (let ((responses 0)) (save-excursion (goto-char (point-min)) - (while (or (and (re-search-forward "^\\+OK " nil t) + (while (or (and (re-search-forward "^\\+OK" nil t) (or (not endp) (re-search-forward "^\\.\r?\n" nil t))) (re-search-forward "^-ERR " nil t)) @@ -301,6 +303,13 @@ this is nil, `ssl' is assumed for connexions to port (const :tag "SSL/TLS" ssl) (const starttls))) +(eval-and-compile + (if (fboundp 'set-process-query-on-exit-flag) + (defalias 'pop3-set-process-query-on-exit-flag + 'set-process-query-on-exit-flag) + (defalias 'pop3-set-process-query-on-exit-flag + 'process-kill-without-query))) + (defun pop3-open-server (mailhost port) "Open TCP connection to MAILHOST on PORT. Returns the process associated with the connection." @@ -361,7 +370,7 @@ Returns the process associated with the connection." (setq pop3-timestamp (substring response (or (string-match "<" response) 0) (+ 1 (or (string-match ">" response) -1))))) - (set-process-query-on-exit-flag process nil) + (pop3-set-process-query-on-exit-flag process nil) process))) ;; Support functions