## remind me never to use inheritance again.
yaml_properties :uri, :cur_offset, :usual, :archived, :id, :labels
def initialize uri, last_date=nil, usual=true, archived=false, id=nil, labels=[]
- uri = Source.expand_filesystem_uri uri
super uri, last_date, usual, archived, id
- uri = URI(uri)
+ uri = URI(Source.expand_filesystem_uri(uri))
raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host
case uri_or_fp
when String
- uri_or_fp = Source.expand_filesystem_uri uri_or_fp
- uri = URI(uri_or_fp)
+ uri = URI(Source.expand_filesystem_uri(uri_or_fp))
raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox"
raise ArgumentError, "mbox uri ('#{uri}') cannot have a host: #{uri.host}" if uri.host
@f = File.open uri.path
+ @path = uri.path
else
@f = uri_or_fp
+ @path = uri_or_fp.path
end
super uri_or_fp, start_offset, usual, archived, id
end
- def file_path; URI(uri).path end
- def is_source_for? uri; super || (URI(Source.expand_filesystem_uri(uri)) == URI(self.uri)); end
+ def file_path; @path end
+ def is_source_for? uri; super || (URI(Source.expand_filesystem_uri(uri)).path == @path); end
def self.suggest_labels_for path
## heuristic: use the filename as a label, unless the file
def reset!; seek_to! start_offset; end
def == o; o.uri == uri; end
def done?; start_offset.nil? || (self.cur_offset ||= start_offset) >= end_offset; end
- def is_source_for? uri; uri == URI(uri); end
+ def is_source_for? uri; uri == @uri; end
## check should throw a FatalSourceError or an OutOfSyncSourcError
## if it can detect a problem. it is called when the sup starts up