sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 7640a4e99da251fb9f0284dd24c854f3795b1786
parent 0f0758ada916bd6f5f6b26247d3c3be50f409b60
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sat, 29 Dec 2007 20:40:00 -0800

bugfix: make thread-index-mode handle deletion notices correctly

Originally was calling ThreadSet#remove_mid with the first message of the
thread, which didn't really make sense, eh?

Diffstat:
M lib/sup/modes/thread-index-mode.rb | 2 +-
M lib/sup/thread.rb | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -139,7 +139,7 @@ EOS
   def handle_deleted_update sender, m
     @ts_mutex.synchronize do
       return unless @ts.contains? m
-      @ts.remove_id m.id
+      @ts.remove_thread_containing_id m.id
     end
     update
   end
diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb
@@ -320,12 +320,18 @@ class ThreadSet
   end
   private :remove_container
 
-  ## remove a single message id
+  ## remove a single message id. not used anywhere, afaik.
   def remove_id mid
     return unless(c = @messages[mid])
     remove_container c
   end
 
+  def remove_thread_containing_id mid
+    c = @messages[mid] or return
+    t = c.root.thread
+    @threads.delete_if { |key, thread| t == thread }
+  end
+
   ## load in (at most) num number of threads from the index
   def load_n_threads num, opts={}
     @index.each_id_by_date opts do |mid, builder|