rapportive-oss/em-imap — Issue #3: uid_* functions don't seem to work
Author: kerinin
Created: 2012-02-09 14:12:42+00:00
State: open

Given

require 'em-imap'

EM::run do
client = EM::IMAP.new('imap.gmail.com', 993, true)

client.connect.bind! do
client.login(ENV['USERNAME'], ENV['PASSWORD'])
end.bind! do |i|
client.examine('[Gmail]/All Mail')
end.bind! do |i|
t = Time.now
client.uid_search("ALL")
end.bind! do |result|
puts result
end.bothback do
EM::stop
end
end

I get the following error:

/Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/client.rb:508:in `block in search_internal': undefined method `data' for nil:NilClass (NoMethodError)
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:133:in `call'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:133:in `block (2 levels) in transform'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `call'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `set_deferred_status'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:173:in `succeed'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:133:in `block (2 levels) in transform'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `call'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `set_deferred_status'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:173:in `succeed'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:133:in `block (2 levels) in transform'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `call'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:134:in `set_deferred_status'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/em/deferrable.rb:173:in `succeed'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/connection.rb:128:in `block in listen_for_tagged_response'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:102:in `call'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:102:in `block in receive_event'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:102:in `each'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/listener.rb:102:in `receive_event'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/connection.rb:114:in `block in receive_response'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/connection.rb:114:in `each'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/connection.rb:114:in `receive_response'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-imap-612502a8bf99/lib/em-imap/response_parser.rb:35:in `receive_data'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /Users/rmichael/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from simple.rb:56:in `

'

My gemfile is pulling from github, but I get the same issues from rubygems. The other uid_* functions produce similar results - for instance even if I parse out the UID's from a non-uid fetch, uid_fetch throws errors.