From: William Morgan Date: Fri, 29 Feb 2008 00:52:38 +0000 (-0800) Subject: messages in sources with lower ids override those in sources with higher X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=886bbffed93f02336f5d20ab9d8c5481e3c06a98;p=sup messages in sources with lower ids override those in sources with higher --- diff --git a/lib/sup/index.rb b/lib/sup/index.rb index 62cfe4b..47b2bb5 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -190,6 +190,11 @@ EOS ## flags. this allows messages sent to mailing lists to have their header ## updated and to have flags set properly. ## + ## minor hack: messages in sources with lower ids have priority over + ## messages in sources with higher ids. so messages in the inbox will + ## override everyone, and messages in the sent box will be overridden + ## by everyone else. + ## ## written in this manner to support previous versions of the index which ## did not keep around the entry body. upgrading is thus seamless. entry ||= {} @@ -198,7 +203,7 @@ EOS ## if we are a later version of a message, ignore what's in the index, ## but merge in the labels. if entry[:source_id] && entry[:source_info] && entry[:label] && - ((entry[:source_id].to_i != source_id) || (entry[:source_info].to_i < m.source_info)) + ((entry[:source_id].to_i > source_id) || (entry[:source_info].to_i < m.source_info)) labels = (entry[:label].split(/\s+/).map { |l| l.intern } + m.labels).uniq Redwood::log "found updated version of message #{m.id}: #{m.subj}" Redwood::log "previous version was at #{entry[:source_id].inspect}:#{entry[:source_info].inspect}, this version at #{source_id.inspect}:#{m.source_info.inspect}"