Skip to content

Commit

Permalink
Merge pull request #1 from jrmey/master
Browse files Browse the repository at this point in the history
If there was a connection error, it was failing with Ruby 1.9.  See https://github.com/ruby/ruby/blob/v1_9_2_290/lib/net/imap.rb#L3429-3440
  • Loading branch information
ConradIrwin committed Sep 12, 2011
2 parents 8c0f454 + 6fcb728 commit 26df825
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/em-imap/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def listen_for_greeting
if response.is_a?(Net::IMAP::UntaggedResponse) && response.name != "BYE"
hello_listener.succeed response
else
hello_listener.fail Net::IMAP::ResponseParseError.new(response.raw_data)
hello_listener.fail Net::IMAP::ResponseParseError.new((RUBY_VERSION[0,3] == "1.8" ? response.raw_data : response))
end
end.errback do |e|
hello_listener.fail e
Expand Down Expand Up @@ -121,9 +121,9 @@ def listen_for_tagged_response(command)
if response.is_a?(Net::IMAP::TaggedResponse) && response.tag == command.tag
case response.name
when "NO"
command.fail Net::IMAP::NoResponseError.new(response.data.text)
command.fail Net::IMAP::NoResponseError.new((RUBY_VERSION[0,3] == "1.8" ? response.data.text : response))
when "BAD"
command.fail Net::IMAP::BadResponseError.new(response.data.text)
command.fail Net::IMAP::BadResponseError.new((RUBY_VERSION[0,3] == "1.8" ? response.data.text : response))
else
command.succeed response
end
Expand Down Expand Up @@ -155,7 +155,7 @@ def listen_for_failure
# to hear any more, so we fail all our listeners.
add_response_handler do |response|
if response.is_a?(Net::IMAP::UntaggedResponse) && response.name == "BYE"
fail Net::IMAP::ByeResponseError.new(response.raw_data)
fail Net::IMAP::ByeResponseError.new((RUBY_VERSION[0,3] == "1.8" ? response.raw_data : response))
end
end
end
Expand Down

0 comments on commit 26df825

Please sign in to comment.