&method(:on_finished))
]
+ s = File.expand_path("~/.e/apps/embrace/config.yaml")
+ @config = YAML.load(File.read(s))
+
@server = nil
@timer = Ecore::Timer.new(30, &method(:on_timer))
on_timer
def on_timer
return unless @server.nil?
- mboxes = %w{
- INBOX
- Lists.ba-2005
- Lists.blackbox-devel
- Lists.clc-devel
- Lists.crux
- Lists.cruxcon
- Lists.dri-devel
- Lists.dri-users
- Lists.enlightenment-cvs
- Lists.enlightenment-devel
- Lists.hobix
- Lists.mesa3d-dev
- Lists.ruby-core
- Lists.rubygems-devel
- Lists.vim-ruby-devel
- Lists.xmms2-devel
- Lists.xorg
- }
-
- s = File.expand_path("~/.e/apps/embrace/config.yaml")
-
- File.open(s) do |f|
- @server = IMAP::Session.new(YAML.load(f), mboxes)
- end
+ @server = IMAP::Session.new(@config)
true
end
class Session
attr_reader :connection
- def initialize(server_info, mboxes)
- @server_info = server_info
+ def initialize(config)
+ @login = config[:server][:login]
+ @password = config[:server][:password]
flags = 2
- flags |= 16 if @server_info.use_ssl
+ flags |= 16 if config[:server][:use_ssl]
@connection = Ecore::Con::Server.new(flags,
- @server_info[:host],
- @server_info[:port])
+ config[:server][:host],
+ config[:server][:port])
@buffer = ""
@tag_id = 0
@requests = []
- @mboxes = mboxes.dup
+ @mboxes = config[:mailboxes].dup
@state = :disconnected
@handlers = [
handle_response(Response.deserialize(line))
if @state == :connected
- login(@server_info[:login], @server_info[:password])
+ login(@login, @password)
end
end