commit 530a66f16cfa28083b1384195a04a657e0f6f741
parent 283ea8351cc41d2dcdb742401a68dca75d26d8b6
Author: Damien Leone <damien.leone@fensalir.fr>
Date: Sun, 20 Feb 2011 13:49:26 +0100
poll: Properly refresh thread-index-mode when a message has changed its source location
There are two cases when a message is detected as "updated", whether
its flags has changed or its location pathname has changed, eg. when
sending a message sup generates a Maildir pathname that is then
modified by offlineimap. It would be detected as deleting a message
and adding another one although it concern the same message, in that
case locations should be updated and its thread-index-mode entry
should be refreshed.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
@@ -131,7 +131,8 @@ EOS
if old_m
new_locations = (m.locations - old_m.locations)
if not new_locations.empty?
- yield "Message at #{new_locations[0].info} is an update of an old message. Updating labels from #{old_m.labels.to_a * ','} => #{m.labels.to_a * ','}"
+ yield "Message at #{new_locations[0].info} has changed its source location. Updating labels from #{old_m.labels.to_a * ','} => #{m.labels.to_a * ','}"
+ numu += 1
else
yield "Skipping already-imported message at #{m.locations[-1].info}"
end
@@ -190,7 +191,9 @@ EOS
## We need to add or unhide the message when it either did not exist
## before at all or when it was updated. We do *not* add/unhide when
## the same message was found at a different location
- if !old_m or not old_m.locations.member? m.location
+ if old_m
+ UpdateManager.relay self, :updated, m
+ elsif !old_m or not old_m.locations.member? m.location
UpdateManager.relay self, :added, m
end
when :delete