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

Re: [sup-talk] More before-add hook issues



Hi Tero.
Excerpts from Tero Tilus's message of Wed Feb 16 04:31:17 -0500 2011:
> Philippe LeCavalier, 2011-02-15 16:55:
> > 8 if ! addressfile.grep(/#{message.list_address.email}/).empty?
> 
> Try
> 
> if message.list_address && !addressfile.grep(/#{message.list_address.email}/).empty?
> 
It worked! Thanks Tero. Just for everyone's benefit this is what the complete rule looks like:

  7   if message.list_address &&
  8   addressfile = File.open("/home/plecavalier/.sup/hooks/label.list","r")
  9   !addressfile.grep(/#{message.list_address.email}/).empty?
 10  message.add_label :list
 11 end

Tero, I'm assuming this is what you expected me to do!? Would I be able to add more functions:

i) read a list of addresses in a second file ie label.list.sup against list-post header from each list and label accordingly ie if it's sup-talk@rubyforge assign label: sup if it's cups->cups...and so on?
ii) lastly, remove :inbox

I'm asking in that fashion because in my experience thus far if I go and build rules for each list to:
a) label :list
b) label :<list_name>
c) -label :inbox
d) wash, rinse and repeat for each list

the hook dies. So it's apparent to me that all functions need to occur in the same invocation. ie multiple, separate functions on the same msg fails. I found a post somewhere(which I can't seem to find anymore) where someone stated multiple invocations on the same msg isn't possible but there must be a workaround...Someone must be applying more than one label to a msg at the same time. Isn't there someone out there succeeding at this?


-- 
Thanks,
Phil
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk