commit 063ec996a24b13b5dc9a59e21aa42ba629ab510a
parent cf8bbb9e48622c7685364a5f9d4d1da05709afca
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Mon, 23 Mar 2009 08:55:09 -0700
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.)
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git 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
@@ -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