From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.240.136 with SMTP id la8cs356633icb; Tue, 15 Feb 2011 08:03:08 -0800 (PST) Received: by 10.220.94.149 with SMTP id z21mr1103033vcm.153.1297785787375; Tue, 15 Feb 2011 08:03:07 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id ff8si4167812vbb.78.2011.02.15.08.03.07; Tue, 15 Feb 2011 08:03:07 -0800 (PST) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id D469F3C8042; Tue, 15 Feb 2011 11:03:06 -0500 (EST) Received: from plecavalier.com (thelittlecloset.ca [64.40.149.83]) by rubyforge.org (Postfix) with ESMTP id D3E921858367 for ; Tue, 15 Feb 2011 09:55:08 -0500 (EST) Received: (qmail 20166 invoked from network); 15 Feb 2011 08:55:06 -0600 Received: from ottawa-hs-64-26-175-141.s-ip.magma.ca (HELO localhost) (64.26.175.141) by thelittlecloset.ca with (DHE-RSA-AES128-SHA encrypted) SMTP; 15 Feb 2011 08:55:06 -0600 From: Philippe LeCavalier To: sup-talk Date: Tue, 15 Feb 2011 09:55:05 -0500 Message-Id: <1297780499-sup-4885@plc.intranet.plecavalier.com> User-Agent: Sup/0.12.1 Subject: [sup-talk] More before-add hook issues X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org 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