raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host
+ raise ArgumentError, "mbox URI must have a path component" unless uri.path
@dir = uri.path
@labels = (labels || []).freeze
start = @ids.index(cur_offset || start_offset) or raise OutOfSyncSourceError, "Unknown message id #{cur_offset || start_offset}." # couldn't find the most recent email
end
+
+ def each_raw_message_line id
+ scan_mailbox
+ with_file_for(id) do |f|
+ until f.eof?
+ yield f.gets
+ end
+ end
+ end
def load_header id
scan_mailbox
ret
end
- def raw_full_message id
+ def raw_message id
scan_mailbox
with_file_for(id) { |f| f.readlines.join }
end
start.upto(@ids.length - 1) do |i|
id = @ids[i]
self.cur_offset = id
- yield id, @labels + (seen?(id) ? [] : [:unread]) + (trashed?(id) ? [:deleted] : [])
+ yield id, @labels + (seen?(id) ? [] : [:unread]) + (trashed?(id) ? [:deleted] : []) + (flagged?(id) ? [:starred] : [])
end
end
def make_id fn
# use 7 digits for the size. why 7? seems nice.
- sprintf("%d%07d", File.mtime(fn), File.size(fn)).to_i
+ sprintf("%d%07d", File.mtime(fn), File.size(fn) % 10000000).to_i
end
def with_file_for id