def report_broken_sources opts={}
return unless BufferManager.instantiated?
broken_sources = SourceManager.sources.select { |s| s.error.is_a? FatalSourceError }
unless broken_sources.empty?
BufferManager.spawn_unless_exists("Broken source notification for #{broken_sources.join(',')}", opts) do
TextMode.new("Source error notification\n-------------------------\n\nHi there. It looks like one or more message sources is reporting\nerrors. Until this is corrected, messages from these sources cannot\nbe viewed, and new messages will not be detected.\n\n\#{broken_sources.map { |s| \"Source: \" + s.to_s + \"\\n Error: \" + s.error.message.wrap(70).join(\"\\n \")}.join(\"\\n\\n\")}\n")
end
end
desynced_sources = SourceManager.sources.select { |s| s.error.is_a? OutOfSyncSourceError }
unless desynced_sources.empty?
BufferManager.spawn_unless_exists("Out-of-sync source notification for #{broken_sources.join(',')}", opts) do
TextMode.new("Out-of-sync source notification\n-------------------------------\n\nHi there. It looks like one or more sources has fallen out of sync\nwith my index. This can happen when you modify these sources with\nother email clients. (Sorry, I don't play well with others.)\n\nUntil this is corrected, messages from these sources cannot be viewed,\nand new messages will not be detected. Luckily, this is easy to correct!\n\n\#{desynced_sources.map do |s|\n \"Source: \" + s.to_s + \n \"\\n Error: \" + s.error.message.wrap(70).join(\"\\n \") + \n \"\\n Fix: sup-sync --changed \#{s.to_s}\"\n end}\n")
end
end
end