def fetch_envelopes(id_set, are_uids, is_update)
results = reconnect_if_necessary do
if are_uids
@imap.uid_fetch(id_set, ["FLAGS", "ENVELOPE", "RFC822.SIZE", "UID" ])
else
@imap.fetch(id_set, ["FLAGS", "ENVELOPE", "RFC822.SIZE", "UID" ])
end
end
if results.nil?
error = "Expected fetch results but got nil"
log(error) && raise(error)
end
log "- extracting headers"
new_message_rows = results.map {|x| extract_row_data(x) }
log "- returning #{new_message_rows.size} new rows and caching result"
new_message_rows
end