From: "Edward Z. Yang" <ezyang@MIT.EDU>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Sup developer discussion <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] [PATCH] Implement moving message between Maildir sources based on label.
Date: Thu, 23 Aug 2012 14:20:18 -0400 [thread overview]
Message-ID: <1345745979-sup-7676@javelin> (raw)
In-Reply-To: <1345733453-sup-9957@alvh.no-ip.org>
With pleasure, I report that Sup is actually doing this! So solving
the "hooks run too many times" is as easy as this:
commit ec3afe7ac01741bc67f68009193d2d2e73f05529
Author: Edward Z. Yang <ezyang@mit.edu>
Date: Thu Aug 23 14:19:24 2012 -0400
Don't run before-add-message hook for messages already in index.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
index 1b64098..7d5aaa2 100644
--- a/lib/sup/poll.rb
+++ b/lib/sup/poll.rb
@@ -184,7 +184,7 @@ EOS
m.labels.each { |l| LabelManager << l }
m.labels = old_m.labels + (m.labels - [:unread, :inbox]) if old_m
m.locations = old_m.locations + m.locations if old_m
- HookManager.run "before-add-message", :message => m
+ HookManager.run "before-add-message", :message => m if not old_m
yield :add, m, old_m, args[:progress] if block_given?
Index.sync_message m, true
Excerpts from Alvaro Herrera's message of Thu Aug 23 10:52:21 -0400 2012:
> Excerpts from Edward Z. Yang's message of jue ago 23 10:40:22 -0400 2012:
> > It looks like the current patchset will *destroy* all labels you have
> > on messages, so be careful! (This was masked for me since most of my
> > labels are from before-add-message.rb, and that hook gets reapplied)
>
> Thanks for the notice. Most of my labels come from that hook too, but a
> few do not, so I could easily lose some! I was planning on trying out
> your patch, but with this caveat I'm likely to refrain. Are you
> planning on submitting a fixed version?
>
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
prev parent reply other threads:[~2012-08-23 18:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 14:35 [sup-devel] Maildir synchronizing other labels Edward Z. Yang
2012-08-22 5:45 ` [sup-devel] [PATCH] Implement moving message between Maildir sources based on label Edward Z. Yang
2012-08-22 5:54 ` Edward Z. Yang
2012-08-22 20:09 ` Edward Z. Yang
2012-08-23 14:40 ` Edward Z. Yang
2012-08-23 14:52 ` Alvaro Herrera
2012-08-23 15:28 ` Edward Z. Yang
2012-08-23 18:20 ` 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=1345745979-sup-7676@javelin \
--to=ezyang@mit.edu \
--cc=alvherre@alvh.no-ip.org \
--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