sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit c49f52bd1fe7f0147e880b417ad3465a9887779e
parent 3dda74168b3d6fce628e7a8fd0c1511fb141d23a
Author: Eric Weikl <eric.weikl@tngtech.com>
Date:   Thu, 24 Oct 2013 09:27:09 -0700

Merge pull request #1 from gauteh/missing_sync_back_ok

Notify user of special handling for unsual sources and list whether source is usual
Diffstat:
M bin/sup-sync-back-maildir | 3 +++
M lib/sup.rb | 16 ++++++++++++----
M lib/sup/source.rb | 2 +-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/bin/sup-sync-back-maildir b/bin/sup-sync-back-maildir
@@ -1,4 +1,7 @@
 #!/usr/bin/env ruby
+# encoding: utf-8
+
+$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
 
 require 'rubygems'
 require 'trollop'
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -189,9 +189,9 @@ EOS
 Should I complain about this again? (Y/n)
 EOS
         File.open(Redwood::SYNC_OK_FN, 'w') {|f| f.write(Redwood::MAILDIR_SYNC_CHECK_SKIPPED) } if STDIN.gets.chomp.downcase == 'n'
-      elsif not $config[:sync_back_to_maildir] and File.exists? Redwood::SYNC_OK_FN
-        File.delete(Redwood::SYNC_OK_FN)
       end
+    elsif not $config[:sync_back_to_maildir] and File.exists? Redwood::SYNC_OK_FN
+      File.delete(Redwood::SYNC_OK_FN)
     end
   end
 
@@ -203,13 +203,18 @@ EOS
     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 }
     unless newly_synced.empty?
-      Redwood.warn_syncback <<EOS
+
+      details =<<EOS
 It appears that the option "sync_back" of the following source(s)
 has been changed from false to true since the last execution of
 sup:
 
-#{newly_synced.join("\n")}
 EOS
+      newly_synced.each do |s|
+        details += "#{s} (usual: #{s.usual})\n"
+      end
+
+      Redwood.warn_syncback details
     end
   end
 
@@ -224,6 +229,9 @@ It is *strongly* recommended that you run "sup-sync-back-maildir"
 before continuing, otherwise you might lose informations in your
 Xapian index.
 
+Please note that if you have any sources that are not marked as 'ususal'
+you need to manually specify them to the sup-sync-back-maildir script.
+
 This script should be executed each time the "sync_back_to_maildir" is
 changed from false to true.
 
diff --git a/lib/sup/source.rb b/lib/sup/source.rb
@@ -54,7 +54,7 @@ class Source
   ## Examples for you to look at: mbox.rb and maildir.rb.
 
   bool_accessor :usual, :archived
-  attr_reader :uri
+  attr_reader :uri, :usual
   attr_accessor :id
 
   def initialize uri, usual=true, archived=false, id=nil