+2000-11-22 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * elmo-version.el (elmo-version): Up to 2.5.3.
+
+ * elmo-net.el (elmo-network-get-session): Changed logic for
+ checking process status.
+
+ * elmo-pop3.el (elmo-network-close-session): Do nothing if session
+ process is nil;
+ Changed logic for checking process status.
+
+2000-11-20 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * elmo-pop3.el (elmo-network-initialize-session): Skip garbage output
+ before greeting.
+ (elmo-network-setup-session): Set UIDL hash size according to
+ the length of list response.
+ (elmo-pop3-parse-list-response): Setup elmo-pop3-size-hash
+ according to the length of list response;
+ Return the length of list response.
+ (Adviced by OKAZAKI Tetsurou <okazaki@be.to>)
+
2000-11-21 Kenichi OKADA <okada@opaopa.org>
* elmo-imap4.el (toplevel): Require 'ssl.
elmo-pop3-list-done))
(luna-define-method elmo-network-close-session ((session elmo-pop3-session))
- (unless (memq (process-status
+ (when (elmo-network-session-process-internal session)
+ (when (memq (process-status
(elmo-network-session-process-internal session))
- '(closed exit))
- (elmo-pop3-send-command (elmo-network-session-process-internal session)
- "quit")
- (or (elmo-pop3-read-response
- (elmo-network-session-process-internal session) t)
- (error "POP error: QUIT failed")))
- (kill-buffer (process-buffer
- (elmo-network-session-process-internal session)))
- (delete-process (elmo-network-session-process-internal session)))
+ '(open run))
+ (elmo-pop3-send-command (elmo-network-session-process-internal session)
+ "quit")
+ (or (elmo-pop3-read-response
+ (elmo-network-session-process-internal session) t)
+ (error "POP error: QUIT failed")))
+ (kill-buffer (process-buffer
+ (elmo-network-session-process-internal session)))
+ (delete-process (elmo-network-session-process-internal session))))
(defun elmo-pop3-get-session (spec &optional if-exists)
(elmo-network-get-session
(setq return-value nil))
(setq elmo-pop3-read-point match-end)
(if not-command
- (setq response-continue nil))
+ (setq response-continue nil))
(setq return-value
(if return-value
(concat return-value "\n" response-string)
(with-current-buffer (process-buffer process)
(set-process-filter process 'elmo-pop3-process-filter)
(setq elmo-pop3-read-point (point-min))
+ ;; Skip garbage output from process before greeting.
+ (while (and (memq (process-status process) '(open run))
+ (goto-char (point-max))
+ (forward-line -1)
+ (not (looking-at "+OK")))
+ (accept-process-output process 1))
+ (setq elmo-pop3-read-point (point))
(or (elmo-network-session-set-greeting-internal
session
(elmo-pop3-read-response process t))
(luna-define-method elmo-network-setup-session ((session
elmo-pop3-session))
(let ((process (elmo-network-session-process-internal session))
- response)
+ count response)
(with-current-buffer (process-buffer process)
- (setq elmo-pop3-size-hash (make-vector 31 0))
+ (setq elmo-pop3-size-hash (elmo-make-hash 31))
;; To get obarray of uidl and size
(elmo-pop3-send-command process "list")
(if (null (elmo-pop3-read-response process))
- (error "POP List folder failed"))
+ (error "POP LIST command failed"))
(if (null (setq response
(elmo-pop3-read-contents
(current-buffer) process)))
- (error "POP List folder failed"))
+ (error "POP LIST command failed"))
;; POP server always returns a sequence of serial numbers.
- (elmo-pop3-parse-list-response response)
+ (setq count (elmo-pop3-parse-list-response response))
;; UIDL
(when elmo-pop3-use-uidl
- (setq elmo-pop3-uidl-number-hash (make-vector 31 0))
- (setq elmo-pop3-number-uidl-hash (make-vector 31 0))
+ (setq elmo-pop3-uidl-number-hash (elmo-make-hash (* count 2)))
+ (setq elmo-pop3-number-uidl-hash (elmo-make-hash (* count 2)))
;; UIDL
(elmo-pop3-send-command process "uidl")
(unless (elmo-pop3-read-response process)
- (error "UIDL failed"))
+ (error "POP UIDL failed"))
(unless (setq response (elmo-pop3-read-contents
(current-buffer) process))
- (error "UIDL failed"))
+ (error "POP UIDL failed"))
(elmo-pop3-parse-uidl-response response)))))
(defun elmo-pop3-read-contents (buffer process)
(defun elmo-pop3-parse-list-response (string)
(let ((buffer (current-buffer))
- number list size)
+ (count 0)
+ alist)
(with-temp-buffer
(insert string)
(goto-char (point-min))
(while (re-search-forward "^\\([0-9]+\\)[\t ]\\([0-9]+\\)$" nil t)
- (setq list
+ (setq alist
(cons
- (string-to-int (setq number (elmo-match-buffer 1)))
- list))
- (setq size (elmo-match-buffer 2))
- (with-current-buffer buffer
- (elmo-set-hash-val (concat "#" number)
- size
- elmo-pop3-size-hash)))
- (with-current-buffer buffer (setq elmo-pop3-list-done t))
- (nreverse list))))
+ (cons (elmo-match-buffer 1)
+ (elmo-match-buffer 2))
+ alist))
+ (setq count (1+ count)))
+ (with-current-buffer buffer
+ (setq elmo-pop3-size-hash (elmo-make-hash (* (length alist) 2)))
+ (while alist
+ (elmo-set-hash-val (concat "#" (car (car alist)))
+ (cdr (car alist))
+ elmo-pop3-size-hash)
+ (setq alist (cdr alist)))
+ (setq elmo-pop3-list-done t))
+ count)))
(defun elmo-pop3-list-location (spec)
(with-current-buffer (process-buffer