X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fsup%2Fpoll.rb;h=220fee38c6acf8f1b9a8435046a4b40af50873b0;hb=55133abad76e8415a078fa0b0749094406f4d08a;hp=d32c893e76771873832595ec95c67fac0780a208;hpb=b5c1bcbd4c25618574f94e683773647906f023e0;p=sup diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index d32c893..220fee3 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -86,7 +86,7 @@ EOS Index.usual_sources.each do |source| # yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})" begin - yield "Loading from #{source}... " unless source.done? || source.has_errors? + yield "Loading from #{source}... " unless source.done? || (source.respond_to?(:has_errors?) && source.has_errors?) rescue SourceError => e Redwood::log "problem getting messages from #{source}: #{e.message}" Redwood::report_broken_sources :force_to_top => true @@ -97,7 +97,7 @@ EOS numi = 0 add_messages_from source do |m, offset, entry| ## always preserve the labels on disk. - m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry + m.labels = ((m.labels - [:unread, :inbox]) + entry[:label].split(/\s+/).map { |x| x.intern }).uniq if entry yield "Found message at #{offset} with labels {#{m.labels * ', '}}" unless entry num += 1 @@ -134,7 +134,7 @@ EOS ## labels. it is likely that callers will want to replace these with ## 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 + def add_messages_from source, opts={} begin return if source.done? || source.has_errors? @@ -157,7 +157,7 @@ EOS docid, entry = Index.load_entry_for_id m.id HookManager.run "before-add-message", :message => m m = yield(m, offset, entry) or next if block_given? - Index.sync_message m, docid, entry + Index.sync_message m, docid, entry, opts UpdateManager.relay self, :added, m unless entry rescue MessageFormatError => e Redwood::log "ignoring erroneous message at #{source}##{offset}: #{e.message}"