sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 3dda74168b3d6fce628e7a8fd0c1511fb141d23a
parent a5e89b54499fd03162b840b3bd6afd1fe671db33
Author: Eric Weikl <eric.weikl@gmx.net>
Date:   Sat, 12 Oct 2013 17:00:57 +0200

make the source list whitespace-safe

It's possible to get some whitespace problems when manipulating the content
of sup-sync-back-maildir manually. This makes sure all whitespace is really
removed.

Diffstat:
M bin/sup-sync-back-maildir | 2 +-
M lib/sup.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/sup-sync-back-maildir b/bin/sup-sync-back-maildir
@@ -56,7 +56,7 @@ $config[:sync_back_to_maildir] = true
 
 begin
   sync_performed = []
-  sync_performed = File.readlines Redwood::SYNC_OK_FN if File.exists? Redwood::SYNC_OK_FN
+  sync_performed = File.readlines(Redwood::SYNC_OK_FN).collect { |e| e.strip }.find_all { |e| not e.empty? } if File.exists? Redwood::SYNC_OK_FN
   sources = []
 
   ## Try to find out sources given in parameters
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -198,7 +198,7 @@ EOS
   def check_syncback_settings
     # don't check if syncback was never performed
     return unless File.exists? Redwood::SYNC_OK_FN
-    active_sync_sources = File.readlines(Redwood::SYNC_OK_FN).collect { |s| s.strip }
+    active_sync_sources = File.readlines(Redwood::SYNC_OK_FN).collect { |e| e.strip }.find_all { |e| not e.empty? }
     return if active_sync_sources.length == 1 and active_sync_sources[0] == Redwood::MAILDIR_SYNC_CHECK_SKIPPED
     sources = SourceManager.sources
     newly_synced = sources.select { |s| s.is_a? Maildir and s.sync_back_enabled? and not active_sync_sources.include? s.uri }