From: William Morgan Date: Mon, 23 Mar 2009 15:55:09 +0000 (-0700) Subject: don't add :unread and :inbox for dupes X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=063ec996a24b13b5dc9a59e21aa42ba629ab510a;p=sup don't add :unread and :inbox for dupes 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.) --- diff --git a/bin/sup-sync b/bin/sup-sync index 5437f9c..91710d4 100644 --- a/bin/sup-sync +++ b/bin/sup-sync @@ -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] diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index de25b4c..d766587 100644 --- 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 = (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