Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Philippe LeCavalier <support@plecavalier.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: [sup-talk] More before-add hook issues
Date: Tue, 15 Feb 2011 09:55:05 -0500	[thread overview]
Message-ID: <1297780499-sup-4885@plc.intranet.plecavalier.com> (raw)

Not certain what I did but the following used to work and now it doesn't. I have this:

1 #bit of spam control
2 if message.raw_header =~ /X-Spam-Flag: YES/
3  message.add_label :spam
4  log "Marking message #{message.id} as spam, subject is '#{message.subj}'"
5 end
6
7 addressfile = File.open("/home/plecavalier/.sup/hooks/label.lists","r")
8 if ! addressfile.grep(/#{message.list_address.email}/).empty?
9   message.add_label :lists
10 end

in before-add-message.rb. At the moment that is all I have in there.

And this:

cups@easysw.com
samba@lists.samba.org
rsync@lists.samba.org
offlineimap-project@lists.alioth.debian.org
bind-users@lists.isc.org

in ~/.sup/hooks/label.lists.

If I state this: {message.list_address.email}

I get this:
[Tue Feb 15 09:32:21 -0500 2011] hook: error running /home/plecavalier/.sup/hooks/before-add-message.rb: undefined method `email' for nil:NilClass
[Tue Feb 15 09:32:21 -0500 2011] hook: /home/plecavalier/.sup/hooks/before-add-message.rb:8:in `__run'

As you can see above line 8 is {message.list_address.email} in this case. Unless, of course, '8' has nothing to do with the line number!?

If I state this: {message.list_address} all mail -not just the from the addresses stated in the file- are labeled 'lists'.

I looked at the post[1] where Hamish helped me by suggesting I state message.list_address.email to reference the list-post in the header and it worked fine at that time. I continued to play aroudn with things to try and get the hook to not only add 'lists' but add the relevant list name as well as remove the 'inbox' label. That didn't work so I tried going back to basics and just have the hook label the relevant mails as 'lists' and now I can't even do that.

What Have I done to make this not work anymore?

ref
[1]http://rubyforge.org/pipermail/sup-talk/2011-February/004495.html
-- 
Thanks,
Phil
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


             reply	other threads:[~2011-02-15 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15 14:55 Philippe LeCavalier [this message]
2011-02-16  9:31 ` Tero Tilus
2011-02-16 14:35   ` Philippe LeCavalier

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=1297780499-sup-4885@plc.intranet.plecavalier.com \
    --to=support@plecavalier.com \
    --cc=sup-talk@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