From 3c569cdabc17804bf00b8a738e12f0664ca520e7 Mon Sep 17 00:00:00 2001 From: okada Date: Mon, 7 Jan 2002 05:51:33 +0000 Subject: [PATCH] * elmo-nntp.el (elmo-nntp-read-response): Added `error-msg' argument. Change to looking-at `[23][0-9]+'. (elmo-network-initialize-session): Use 'error-msg' * elmo-net.el (elmo-network-open-session): Set unplugged if elmo-network-initialize-session returns 'elmo-open-err. --- elmo/ChangeLog | 8 ++++++++ elmo/elmo-net.el | 6 ++++++ elmo/elmo-nntp.el | 18 +++++++++++------- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 85d3651..f413e31 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,13 @@ 2002-01-07 Kenichi OKADA + * elmo-nntp.el (elmo-nntp-read-response): Added `error-msg' argument. + Change to looking-at `[23][0-9]+'. + (elmo-network-initialize-session): Use 'error-msg' + * elmo-net.el (elmo-network-open-session): Set unplugged + if elmo-network-initialize-session returns 'elmo-open-err. + +2002-01-07 Kenichi OKADA + * elmo-version.el (elmo-version): Up to 2.9.4. 2002-01-07 Yuuichi Teranishi diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el index 6f2d6c3..0fe45a3 100644 --- a/elmo/elmo-net.el +++ b/elmo/elmo-net.el @@ -235,6 +235,12 @@ Returns a process object. if making session failed, returns nil." (elmo-network-authenticate-session session) (elmo-network-setup-session session))) (error + (when (eq (car error) 'elmo-open-error) + (elmo-set-plugged nil server port + (elmo-network-stream-type-symbol stream-type) + (current-time)) + (message "Auto plugged off at %s:%d :%s" server port (cadr error)) + (sit-for 1)) (when (eq (car error) 'elmo-authenticate-error) (elmo-remove-passwd (elmo-network-session-password-key session))) (elmo-network-close-session session) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index d8a742a..2976e2f 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -254,7 +254,8 @@ Don't cache if nil.") (luna-define-method elmo-network-initialize-session ((session elmo-nntp-session)) - (let ((process (elmo-network-session-process-internal session))) + (let ((process (elmo-network-session-process-internal session)) + response) (set-process-filter (elmo-network-session-process-internal session) 'elmo-nntp-process-filter) (with-current-buffer (elmo-network-session-buffer session) @@ -266,8 +267,9 @@ Don't cache if nil.") (not (looking-at "^[2-5][0-9][0-9]"))) (accept-process-output process 1)) (setq elmo-nntp-read-point (point)) - (or (elmo-nntp-read-response session t) - (error "Cannot open network")) + (setq response (elmo-nntp-read-response session t t)) + (unless (car response) + (signal 'elmo-open-error (list (cdr response)))) (if elmo-nntp-send-mode-reader (elmo-nntp-send-mode-reader session)) (when (eq (elmo-network-stream-type-symbol @@ -321,7 +323,7 @@ Don't cache if nil.") (process-send-string (elmo-network-session-process-internal session) "\r\n"))) -(defun elmo-nntp-read-response (session &optional not-command) +(defun elmo-nntp-read-response (session &optional not-command error-msg) (with-current-buffer (elmo-network-session-buffer session) (let ((process (elmo-network-session-process-internal session)) (case-fold-search nil) @@ -337,14 +339,14 @@ Don't cache if nil.") (setq response-string (buffer-substring elmo-nntp-read-point (- match-end 2))) (goto-char elmo-nntp-read-point) - (if (looking-at "[234][0-9]+ .*$") + (if (looking-at "[23][0-9]+ .*$") (progn (setq response-continue nil) (setq elmo-nntp-read-point match-end) (setq response (if response (concat response "\n" response-string) response-string))) - (if (looking-at "[^234][0-9]+ .*$") + (if (looking-at "[^23][0-9]+ .*$") (progn (setq response-continue nil) (setq elmo-nntp-read-point match-end) (setq response nil)) @@ -356,7 +358,9 @@ Don't cache if nil.") (concat response "\n" response-string) response-string))) (setq elmo-nntp-read-point match-end))) - response))) + (if error-msg + (cons response response-string) + response)))) (defun elmo-nntp-read-raw-response (session) (with-current-buffer (elmo-network-session-buffer session) -- 1.7.10.4