Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: "Edward Z. Yang" <ezyang@MIT.EDU>
To: "damien.leone" <damien.leone@fensalir.fr>,
	sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] [PATCH] Sync and update other threads when Maildir sync-back changes location.
Date: Tue, 21 Aug 2012 15:43:47 -0400	[thread overview]
Message-ID: <1345578187-sup-5921@javelin> (raw)
In-Reply-To: <1345577064-sup-4877@javelin>

Aaand here's an even prettier version.

commit f7d30410d946418a885929f20a498c10e4058243
Author: Edward Z. Yang <ezyang@mit.edu>
Date:   Tue Aug 21 15:19:11 2012 -0400

    Sync and update other threads when Maildir sync-back changes location.
    
    Signed-off-by: Edward Z. Yang <ezyang@mit.edu>

diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
index 0c8c563..050cfaf 100644
--- a/lib/sup/maildir.rb
+++ b/lib/sup/maildir.rb
@@ -226,7 +226,7 @@ private
       new_base = (flags.include?("S")) ? "cur" : "new"
       md_base, md_ver, md_flags = maildir_data orig_path
 
-      return orig_path if md_flags == flags
+      return if md_flags == flags
 
       new_loc = File.join new_base, "#{md_base}:#{md_ver},#{flags}"
       orig_path = File.join @dir, orig_path
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 0616f75..3eeea66 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -286,10 +286,11 @@ EOS
   end
 
   def sync_back
-    @locations.each do |l|
-      if l.valid?
-        l.sync_back @labels if $config[:sync_back_to_maildir] and l.source.is_a? Maildir
-      end
+    if @locations.map { |l|
+      l.sync_back @labels if l.valid? and $config[:sync_back_to_maildir] and l.source.is_a? Maildir
+    }.any?
+      Index.sync_message self, true
+      UpdateManager.relay self, :updated, self
     end
   end
 
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


      reply	other threads:[~2012-08-21 19:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21 19:19 Edward Z. Yang
2012-08-21 19:25 ` Edward Z. Yang
2012-08-21 19:43   ` Edward Z. Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345578187-sup-5921@javelin \
    --to=ezyang@mit.edu \
    --cc=damien.leone@fensalir.fr \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox