diff lisp/gnus/pop3.el @ 38:1a767b41a199 r19-15b102

Import from CVS: tag r19-15b102
author cvs
date Mon, 13 Aug 2007 08:54:01 +0200
parents 0293115a14e9
children cca96a509cfe
line wrap: on
line diff
--- a/lisp/gnus/pop3.el	Mon Aug 13 08:53:41 2007 +0200
+++ b/lisp/gnus/pop3.el	Mon Aug 13 08:54:01 2007 +0200
@@ -4,7 +4,7 @@
 
 ;; Author: Richard L. Pieri <ratinox@peorth.gweep.net>
 ;; Keywords: mail, pop3
-;; Version: 1.3
+;; Version: 1.3c
 
 ;; This file is part of GNU Emacs.
 
@@ -37,8 +37,7 @@
 (require 'mail-utils)
 (provide 'pop3)
 
-(eval-and-compile
-  (if (not (fboundp 'md5)) (autoload 'md5 "md5")))
+(defconst pop3-version "1.3c")
 
 (defvar pop3-maildrop (or user-login-name (getenv "LOGNAME") (getenv "USER") nil)
   "*POP3 maildrop.")
@@ -53,8 +52,9 @@
   "*Password to use when connecting to POP server.")
 
 (defvar pop3-authentication-scheme 'pass
-  "*POP3 authentication scheme.  Defaults to 'pass, for the standard
-USER/PASS authentication.  Other valid values are 'apop.")
+  "*POP3 authentication scheme.
+Defaults to 'pass, for the standard USER/PASS authentication.  Other valid
+values are 'apop.")
 
 (defvar pop3-timestamp nil
   "Timestamp returned when initially connected to the POP server.
@@ -85,9 +85,16 @@
       (pop3-retr process n crashbuf)
       (save-excursion
 	(set-buffer crashbuf)
-	(append-to-file (point-min) (point-max) crashbox))
+	(append-to-file (point-min) (point-max) crashbox)
+	(set-buffer (process-buffer process))
+	(while (> (buffer-size) 5000)
+	  (goto-char (point-min))
+	  (forward-line 50)
+	  (delete-region (point-min) (point))))
       (pop3-dele process n)
-      (setq n (+ 1 n)))
+      (setq n (+ 1 n))
+      (if pop3-debug (sit-for 1) (sit-for 0.1))
+      )
     (pop3-quit process)
     (kill-buffer crashbuf)
     )
@@ -272,8 +279,7 @@
 ;; TRANSACTION STATE
 
 (defun pop3-stat (process)
-  "Return a list of the number of messages in the maildrop and the size
-of the maildrop."
+  "Return the number of messages in the maildrop and the maildrop's size."
   (pop3-send-command process "STAT")
   (let ((response (pop3-read-response process t)))
     (list (string-to-int (nth 1 (pop3-string-to-list response)))
@@ -285,8 +291,7 @@
 This function currently does nothing.")
 
 (defun pop3-retr (process msg crashbuf)
-  "Retrieve message-id MSG from the server and place the contents in
-buffer CRASHBUF."
+  "Retrieve message-id MSG to buffer CRASHBUF."
   (pop3-send-command process (format "RETR %s" msg))
   (pop3-read-response process)
   (let ((start pop3-read-point) end)
@@ -304,6 +309,11 @@
 	(goto-char start))
       (setq pop3-read-point (point-marker))
       (goto-char (match-beginning 0))
+      (backward-char 2)
+      (if (not (looking-at "\r\n"))
+	  (insert "\r\n"))
+      (re-search-forward "\\.\r\n")
+      (goto-char (match-beginning 0))
       (setq end (point-marker))
       (pop3-clean-region start end)
       (pop3-munge-message-separator start end)
@@ -339,8 +349,9 @@
 ;; UPDATE
 
 (defun pop3-quit (process)
-  "Tell server to remove all messages marked as deleted, unlock the
-maildrop, and close the connection."
+  "Close connection to POP3 server.
+Tell server to remove all messages marked as deleted, unlock the maildrop,
+and close the connection."
   (pop3-send-command process "QUIT")
   (pop3-read-response process t)
   (if process