_ bugfix: add new message counts until keypress
_ bugfix: attachment filenames sometimes not detected (filename=)
_ bugfix: final logging messages to stdout?
-_ bugfix: mbox directory shouldn't generate an exception, just an error
+x bugfix: mbox directory shouldn't generate an exception, just an error
x bugfix: m in thread-view-mode when a person is not selected should open up a
x bugfix: stars on messages with blue backgrounds still have green bgs
x ferret upgrade script (dump & restore)
def self.source_name; "sup://drafts"; end
def self.source_id; 9999; end
- def new_source; @source = DraftLoader.new; end
+ def new_source; @source = Recoverable.new DraftLoader.new; end
def write_draft
offset = @source.gen_offset
def initialize uri, last_date=nil, usual=true, archived=false, id=nil
super
+ uri = URI(uri)
- @dir = URI(uri).path
+ raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
+ raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host
+
+ @dir = uri.path
@ids = []
@ids_to_fns = {}
@last_scan = nil
cdir = File.join(@dir, 'cur')
ndir = File.join(@dir, 'new')
+
+ raise FatalSourceError, "#{cdir} not a directory" unless File.directory? cdir
+ raise FatalSourceError, "#{ndir} not a directory" unless File.directory? ndir
begin
@ids, @ids_to_fns = @mutex.synchronize do
ids << id
ids_to_fns[id] = fn
end
+ p [ids.sort, ids_to_fns]
[ids.sort, ids_to_fns]
end
rescue SystemCallError => e
case uri_or_fp
when String
- raise ArgumentError, "not an mbox uri" unless uri_or_fp =~ %r!mbox://!
-
- fn = URI(uri_or_fp).path
+ uri = URI(uri_or_fp)
+ raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox"
+ raise ArgumentError, "mbox uri cannot have a host: #{uri.host}" if uri.host
## heuristic: use the filename as a label, unless the file
## has a path that probably represents an inbox.
- @labels << File.basename(fn).intern unless File.dirname(fn) =~ /\b(var|usr|spool)\b/
- @f = File.open fn
+ @labels << File.basename(uri.path).intern unless File.dirname(uri.path) =~ /\b(var|usr|spool)\b/
+ @f = File.open uri.path
else
@f = uri_or_fp
end
@mutex.synchronize do
Index.usual_sources.each do |source|
# yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})"
- yield "Loading from #{source}... " unless source.done? || source.has_errors?
+ begin
+ yield "Loading from #{source}... " unless source.done? || source.has_errors?
+ rescue SourceError => e
+ Redwood::log "problem getting messages from #{source}: #{e.message}"
+ Redwood::report_broken_sources
+ next
+ end
+
num = 0
numi = 0
add_messages_from source do |m, offset, entry|
## the index labels, if they exist, so that state is not lost when
## e.g. a new version of a message from a mailing list comes in.
def add_messages_from source
- return if source.done? || source.has_errors?
-
begin
+ return if source.done? || source.has_errors?
+
source.each do |offset, labels|
if source.has_errors?
Redwood::log "error loading messages from #{source}: #{source.broken_msg}"
def self.source_name; "sup://sent"; end
def self.source_id; 9998; end
- def new_source; @source = SentLoader.new; end
+ def new_source; @source = Recoverable.new SentLoader.new; end
def write_sent_message date, from_email
need_blank = File.exists?(@fn) && !File.zero?(@fn)
def initialize uri, initial_offset=nil, usual=true, archived=false, id=nil
@uri = uri
- @cur_offset = initial_offset || start_offset
+ @cur_offset = initial_offset
@usual = usual
@archived = archived
@id = id
def to_s; @uri.to_s; end
def seek_to! o; self.cur_offset = o; end
def reset!; seek_to! start_offset; end
- def == o; o.to_s == to_s; end
+ def == o; o.uri == uri; end
def done?; (self.cur_offset ||= start_offset) >= end_offset; end
def is_source_for? uri; URI(self.uri) == URI(uri); end