sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 84e74413f155bcf2bc4d1fb95945cd5d591c4410
parent 6af71622e11d2de08a74cc3ed81e26e72ae3fbd7
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Wed, 26 Nov 2008 15:23:35 -0800

for duplicate messages, merge labels rather than discard them

Diffstat:
M bin/sup-sync | 2 +-
M lib/sup/poll.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/sup-sync b/bin/sup-sync
@@ -163,7 +163,7 @@ begin
       ## assign message labels based on the operation we're performing
       case op
       when :asis
-        m.labels = index_state if index_state
+        m.labels = (m.labels + index_state).uniq if index_state
       when :restore
         ## if the entry exists on disk
         if restored_state[m.id]
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
@@ -97,7 +97,7 @@ EOS
         numi = 0
         add_messages_from source do |m, offset, entry|
           ## always preserve the labels on disk.
-          m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry
+          m.labels = (m.labels + entry[:label].split(/\s+/).map { |x| x.intern }).uniq if entry
           yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
           unless entry
             num += 1