class MailDaemon::Imap::Watcher
Public Class Methods
new(options)
click to toggle source
# File lib/mail_daemon/imap/watcher.rb, line 6 def initialize(options) @options = options end
Public Instance Methods
mailbox()
click to toggle source
# File lib/mail_daemon/imap/watcher.rb, line 36 def mailbox @options[:mailbox] end
restart()
click to toggle source
# File lib/mail_daemon/imap/watcher.rb, line 27 def restart stop start end
running?()
click to toggle source
# File lib/mail_daemon/imap/watcher.rb, line 32 def running? @connection.running? end
start() { |:type => "incoming_email", :mailbox => options, :inbound_message => message| ... }
click to toggle source
# File lib/mail_daemon/imap/watcher.rb, line 10 def start(&block) @connection = Imap::Connection.new(@options, &block) @connection.login # @thread = Thread.new do @connection.wait_for_messages do |message| yield :type => "incoming_email", :mailbox => @options, :inbound_message => message end # end # @thread.join end
stop()
click to toggle source
# File lib/mail_daemon/imap/watcher.rb, line 22 def stop @connection.disconnect # @thread.terminate end
to_s()
click to toggle source
# File lib/mail_daemon/imap/watcher.rb, line 40 def to_s "#{@options[:account_code]}/#{@options[:username]}" end