From fd68c991cc6aff67d193555eca908d8e87a4ba33 Mon Sep 17 00:00:00 2001 From: okada Date: Wed, 22 Nov 2000 13:44:14 +0000 Subject: [PATCH] * elmo-nntp.el (elmo-network-initialize-session): Skip garbage output before greeting. --- elmo/ChangeLog | 5 +++++ elmo/elmo-nntp.el | 37 ++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 6b8b2fe..f1e267b 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,8 @@ +2000-11-22 Kenichi OKADA + + * elmo-nntp.el (elmo-network-initialize-session): Skip garbage output + before greeting. + 2000-11-22 Yuuichi Teranishi * elmo-net.el (elmo-network-get-session): Changed logic for diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 554f0aa..12f465e 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -184,21 +184,28 @@ Don't cache if nil.") (luna-define-method elmo-network-initialize-session ((session elmo-nntp-session)) - (set-process-filter (elmo-network-session-process-internal session) - 'elmo-nntp-process-filter) - (with-current-buffer (elmo-network-session-buffer session) - (setq elmo-nntp-read-point (point-min)) - (or (elmo-nntp-read-response session t) - (error "Cannot open network")) - (when (eq (elmo-network-stream-type-symbol - (elmo-network-session-stream-type-internal session)) - 'starttls) - (elmo-nntp-send-command session "starttls") - (or (elmo-nntp-read-response session) - (error "Cannot open starttls session")) - (starttls-negotiate - (elmo-network-session-process-internal session))))) - + (let ((process (elmo-network-session-process-internal session))) + (set-process-filter (elmo-network-session-process-internal session) + 'elmo-nntp-process-filter) + (with-current-buffer (elmo-network-session-buffer session) + (setq elmo-nntp-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 "200"))) + (accept-process-output process 1)) + (setq elmo-nntp-read-point (point)) + (or (elmo-nntp-read-response session t) + (error "Cannot open network")) + (when (eq (elmo-network-stream-type-symbol + (elmo-network-session-stream-type-internal session)) + 'starttls) + (elmo-nntp-send-command session "starttls") + (or (elmo-nntp-read-response session) + (error "Cannot open starttls session")) + (starttls-negotiate + (elmo-network-session-process-internal session)))))) (luna-define-method elmo-network-authenticate-session ((session elmo-nntp-session)) -- 1.7.10.4