end
def scan_mailbox
- Redwood::log "#{SCAN_INTERVAL - (Time.now - @last_scan)} seconds to go before resizing mailbox" if @last_scan
return if @last_scan && (Time.now - @last_scan) < SCAN_INTERVAL
@imap.examine mailbox
last_id = @imap.responses["EXISTS"].last
@last_scan = Time.now
- Redwood::log "IMAP server reports last id as #{last_id}. I have a last id of #{@ids.length}"
return if last_id == @ids.length
Redwood::log "fetching IMAP headers #{(@ids.length + 1) .. last_id}"
values = @imap.fetch((@ids.length + 1) .. last_id, ['RFC822.SIZE', 'INTERNALDATE'])