# File bin/experimental-filter.rb, line 142
def main

  # Read the .rdeliver file, which fills in the Deliver class.
  $config = '.rdeliver'

  # FIXME: make errors logged from this a lot more clear.
  eval(IO.readlines($config, nil)[0].untaint,
       Deliver.module_eval('binding()'),
       $config)

  begin
    toucher_thread = Thread.start {
      loop {
        now = Time.now
        File.utime(now, now, File.join("Maildir", ".filter.lock"))
        sleep(60)
      }
    }
    loop {
      process_queue
      sleep(15)
    }
  ensure
    Thread::kill(toucher_thread) if toucher_thread
    File::delete($lock_file_name)
  end
end