X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=bin%2Fsup-sync;fp=bin%2Fsup-sync;h=ddcf8c567563574be9ecd3a1b84abf1daf51e024;hb=3f08a0191a824c5d6e7731a3d25106d1a0c3931e;hp=003a72d9c320e97d80687effb750654e0bc337aa;hpb=9a3d7fa7473b5852bc65a562fa3e8d8964d16c0e;p=sup diff --git a/bin/sup-sync b/bin/sup-sync index 003a72d..ddcf8c5 100755 --- a/bin/sup-sync +++ b/bin/sup-sync @@ -173,18 +173,22 @@ begin ## decide what to do based on message labels and the operation we're performing dothis, new_labels = case - when (op == :restore) && restored_state[m.id] && old_m && (old_m.labels != restored_state[m.id]) - num_restored += 1 - [:update_message_state, restored_state[m.id]] - when (op == :restore) && restored_state[m.id] && !old_m - num_restored += 1 - m.labels = restored_state[m.id] - :add_message + when (op == :restore) && restored_state[m.id] + if old_m && (old_m.labels != restored_state[m.id]) + num_restored += 1 + [:update_message_state, restored_state[m.id]] + elsif old_m.nil? + num_restored += 1 + m.labels = restored_state[m.id] + :add_message + else + # labels are the same; don't do anything + end when op == :discard if old_m && (old_m.labels != m.labels) [:update_message_state, m.labels] else - # don't do anything + # labels are the same; don't do anything end else ## duplicate behavior of poll mode: if index_state is non-nil, this is a newer