]> git.cworth.org Git - sup/commitdiff
don't add :unread and :inbox for dupes
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Mon, 23 Mar 2009 15:55:09 +0000 (08:55 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Mon, 23 Mar 2009 15:55:12 +0000 (08:55 -0700)
Allow merging in of labels from duplicate messages, EXCEPT for
:unread and :inbox labels. (These two have special semantics
and, in contrast to the other special-semantics labels, might
appear on a new message.)

bin/sup-sync
lib/sup/poll.rb

index 5437f9caa23bf41ce8989a249eabeda68f0b8b4b..91710d47495ab263a69e03ec709657d1ee8b66ae 100644 (file)
@@ -158,7 +158,7 @@ begin
       ## assign message labels based on the operation we're performing
       case op
       when :asis
-        m.labels = (m.labels + index_state).uniq if index_state
+        m.labels = ((m.labels - [:unread, :inbox]) + index_state).uniq if index_state
       when :restore
         ## if the entry exists on disk
         if restored_state[m.id]
index de25b4ceba2f176915dbcd83b55469b2b107c9d4..d766587f58815f27ec07b485c07ca6ec5204542a 100644 (file)
@@ -97,7 +97,7 @@ EOS
         numi = 0
         add_messages_from source do |m, offset, entry|
           ## always preserve the labels on disk.
-          m.labels = (m.labels + entry[:label].split(/\s+/).map { |x| x.intern }).uniq if entry
+          m.labels = ((m.labels - [:unread, :inbox]) + entry[:label].split(/\s+/).map { |x| x.intern }).uniq if entry
           yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
           unless entry
             num += 1