diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-17 17:35:53 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-17 17:35:53 +0000 |
commit | 73e0d386b81191c2d838b05c8d095dff0945797e (patch) | |
tree | ebde0916791cbff11fb8f6ca920c396d67d8b99f /lib | |
parent | b9db231cbda6bfb90a20f55c9c70b38db24c8268 (diff) | |
download | ruby-73e0d386b81191c2d838b05c8d095dff0945797e.tar.gz |
* 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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/imap.rb | 15 |
1 files changed, 13 insertions, 2 deletions
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 |