[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sup-talk] Moving messages between sources and generic auto labeling hook



Reformatted excerpts from Scott Henson's message of 2010-01-03:
> Is it possible to have sup move messages between sources?

No. Mutt is quite good at this, actually. If you do move them, you will
have to update the Sup index to reflect the new source.

> I've found a python script that will do this for me on the Maildir, but I'm
> not sure what this will do to the sup index.  Would I be able to do this on
> a nightly basis and then do a full rescan on the INBOX source and the
> archive sources?  Would the messages keep their labels?

The easiest thing would be to make a dump of the message state with
sup-dump, and then sup-sync -c --restore <dumpfile> on both sources.
Of course, check first to make sure this works!

That incurs a silly amout of redundant work, so you could also consider
the fancier way of just updating the source_id in the index, using the
console.

> My second question revolves around labeling.  I see the before add hook is
> what is supposed to be used for labeling.  Does everyone just write ruby in
> that hook or does someone have a simpler syntax for filtering that a generic
> before add hook that uses it?  I'm thinking the simplest would be yaml, but
> this being ruby I would think creating a DSL for filtering would be pretty
> easy and make autolabeling an easier affair than writing straight ruby.

The hooks are just ruby at the moment. I'm not convinced a DSL would be
an improvement. For example, my before-add hook looks like this:

  to_string = message.recipients.map { |t| t.email }.join(" ")
  case to_string
  when /\bgit@vger.kernel.org\b/
    message.add_label :git
    message.remove_label :inbox
  when /\bsup-(devel|talk)@rubyforge.org\b/
    message.add_label :sup
  when /\bditz-talk@rubyforge.org\b/
    message.add_label :ditz
  [...]

Apart from the first line, it seems pretty DSL-like already to me.  But
try it, if you like, and report back if you come up with something nice.
-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk