From 063ec996a24b13b5dc9a59e21aa42ba629ab510a Mon Sep 17 00:00:00 2001 From: William Morgan Date: Mon, 23 Mar 2009 08:55:09 -0700 Subject: [PATCH] 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.) --- bin/sup-sync | 2 +- lib/sup/poll.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 -- 2.45.2