sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 63106e9e7b396a5dd3a0adaedff9f337ee027a4a
parent 1f37e972fd6ac03241bca1d21dc545d6613da67c
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sun, 29 Mar 2009 12:25:40 -0400

Merge branch 'labels-rework' into next

Diffstat:
M bin/sup | 2 +-
M lib/sup/buffer.rb | 4 +++-
M lib/sup/label.rb | 13 +++++--------
M lib/sup/modes/label-list-mode.rb | 4 ++--
M www/index.html | 5 +++--
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -243,7 +243,7 @@ begin
     when :search_unread
       SearchResultsMode.spawn_from_query "is:unread"
     when :list_labels
-      labels = LabelManager.listable_labels.map { |l| LabelManager.string_for l }
+      labels = LabelManager.all_labels.map { |l| LabelManager.string_for l }
       user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
       unless user_label.nil?
         if user_label.empty?
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -478,7 +478,9 @@ EOS
     default = default_labels.join(" ")
     default += " " unless default.empty?
 
-    applyable_labels = (LabelManager.applyable_labels - forbidden_labels).map { |l| LabelManager.string_for l }.sort_by { |s| s.downcase }
+    # here I would prefer to give more control and allow all_labels instead of
+    # user_defined_labels only
+    applyable_labels = (LabelManager.user_defined_labels - forbidden_labels).map { |l| LabelManager.string_for l }.sort_by { |s| s.downcase }
 
     answer = ask_many_with_completions domain, question, applyable_labels, default
 
diff --git a/lib/sup/label.rb b/lib/sup/label.rb
@@ -7,9 +7,6 @@ class LabelManager
   ## add/remove these via normal label mechanisms.
   RESERVED_LABELS = [ :starred, :spam, :draft, :unread, :killed, :sent, :deleted, :inbox, :attachment ]
 
-  ## labels which it nonetheless makes sense to search for by
-  LISTABLE_RESERVED_LABELS = [ :starred, :spam, :draft, :sent, :killed, :deleted, :inbox, :attachment ]
-
   ## labels that will typically be hidden from the user
   HIDDEN_RESERVED_LABELS = [ :starred, :unread, :attachment ]
 
@@ -28,18 +25,18 @@ class LabelManager
     self.class.i_am_the_instance self
   end
 
-  ## all listable (just user-defined at the moment) labels, ordered
+  ## all labels user-defined and system, ordered
   ## nicely and converted to pretty strings. use #label_for to recover
   ## the original label.
-  def listable_labels
+  def all_labels
     ## uniq's only necessary here because of certain upgrade issues
-    (LISTABLE_RESERVED_LABELS + @labels.keys).uniq
+    (RESERVED_LABELS + @labels.keys).uniq
   end
 
-  ## all apply-able (user-defined and system listable) labels, ordered
+  ## all user-defined labels, ordered
   ## nicely and converted to pretty strings. use #label_for to recover
   ## the original label.
-  def applyable_labels
+  def user_defined_labels
     @labels.keys
   end
 
diff --git a/lib/sup/modes/label-list-mode.rb b/lib/sup/modes/label-list-mode.rb
@@ -48,12 +48,12 @@ protected
 
   def regen_text
     @text = []
-    labels = LabelManager.listable_labels
+    labels = LabelManager.all_labels
 
     counts = labels.map do |label|
       string = LabelManager.string_for label
       total = Index.num_results_for :label => label
-      unread = Index.num_results_for :labels => [label, :unread]
+      unread = (label == :unread)? total : Index.num_results_for(:labels => [label, :unread])
       [label, string, total, unread]
     end.sort_by { |l, s, t, u| s.downcase }
 
diff --git a/www/index.html b/www/index.html
@@ -109,11 +109,12 @@
 		<h2>Status</h2>
 
 		<p>
-		The current version of Sup is 0.7, released 2009-03-16. This is a
+		The current version of Sup is 0.7, released 2009-03-25. This is a
 		beta release. It supports mbox, mbox over ssh, IMAP, IMAPS, and Maildir mailstores.
 		</p>
 
-        <p>Issue and release status is available on the <a href="ditz/">Sup ditz page</a>.</p>
+        <!-- <p>Issue and release status is available on the <a href="ditz/">Sup ditz page</a>.</p> -->
+        <p>Sup news can often be see on <a href="http://all-thing.net/label/sup/">William's blog</a>.</p>
 
 		<h2>Getting it</h2>