From 73e0d386b81191c2d838b05c8d095dff0945797e Mon Sep 17 00:00:00 2001 From: shugo Date: Sat, 17 Jul 2004 17:35:53 +0000 Subject: [PATCH] * lib/net/imap.rb (receive_responses): return if a LOGOUT response received. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/net/imap.rb | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a47637f04..3c91e11351 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 18 02:35:30 2004 Shugo Maeda + + * lib/net/imap.rb (receive_responses): return if a LOGOUT response + received. + Sat Jul 17 23:59:01 2004 Shugo Maeda * lib/net/imap.rb (send_string_data): wait command continuation diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 033e0987be..7e8d574fbe 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -898,12 +898,13 @@ module Net @response_handlers = [] @tagged_response_arrival = new_cond @continuation_request_arrival = new_cond + @logout_command_tag = nil @debug_output_bol = true @greeting = get_response - if /\ABYE\z/ni =~ @greeting.name + if @greeting.name == "BYE" @sock.close - raise ByeResponseError, resp[0] + raise ByeResponseError, @greeting.raw_data end @client_thread = Thread.current @@ -928,12 +929,19 @@ module Net when TaggedResponse @tagged_responses[resp.tag] = resp @tagged_response_arrival.broadcast + if resp.tag == @logout_command_tag + return + end when UntaggedResponse record_response(resp.name, resp.data) if resp.data.instance_of?(ResponseText) && (code = resp.data.code) record_response(code.name, code.data) end + if resp.name == "BYE" && @logout_command_tag.nil? + @sock.close + raise ByeResponseError, resp.raw_data + end when ContinuationRequest @continuation_request_arrival.signal end @@ -998,6 +1006,9 @@ module Net send_data(i) end put_string(CRLF) + if cmd == "LOGOUT" + @logout_command_tag = tag + end if block add_response_handler(block) end