From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.213.7.146 with SMTP id d18cs93573ebd; Wed, 13 Jan 2010 05:27:29 -0800 (PST) Received: by 10.224.116.212 with SMTP id n20mr2550375qaq.172.1263389248390; Wed, 13 Jan 2010 05:27:28 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 8si4932248qwj.43.2010.01.13.05.27.27; Wed, 13 Jan 2010 05:27:28 -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 B3A9015B802C; Wed, 13 Jan 2010 08:27:27 -0500 (EST) X-Greylist: delayed 612 seconds by postgrey-1.31 at rubyforge.org; Wed, 13 Jan 2010 08:23:40 EST Received: from sam.mediasupervision.de (sam.mediasupervision.de [80.152.3.104]) by rubyforge.org (Postfix) with ESMTP id A56A0185826F for ; Wed, 13 Jan 2010 08:23:38 -0500 (EST) Received: from localhost (sam.mediasupervision.de [127.0.0.1]) by sam.mediasupervision.de (Postfix) with ESMTP id E3D9B485C6E for ; Wed, 13 Jan 2010 14:13:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at sam.mediasupervision.de Received: from sam.mediasupervision.de ([127.0.0.1]) by localhost (sam.mediasupervision.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6TnhKajxzaDN for ; Wed, 13 Jan 2010 14:13:18 +0100 (CET) Received: by sam.mediasupervision.de (Postfix, from userid 1000) id BEBDB485CF1; Wed, 13 Jan 2010 14:13:18 +0100 (CET) From: Gregor Hoffleit To: sup-talk@rubyforge.org Date: Wed, 13 Jan 2010 14:13:18 +0100 Message-Id: <1263386714-sup-5331@sam.mediasupervision.de> User-Agent: Sup/git Subject: [sup-talk] Ruby question: before-add-message.rb and adding multiple labels at once 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 In order to keep before-add-message.rb readable, I was using one-line filters like: message.add_label "ad apple" if message.from.email =~ /@insideapple.apple.com/ message.add_label "ad amazon" if message.from.email =~ /promotion.*@amazon.com/ message.add_label "list sup" if message.subj =~ /\[sup-talk\]/ message.add_label "list sup-devel" if message.subj =~ /\[sup-devel\]/ That seemed to work, somehow. Only now I realized that message.add_label in fact only takes a single label as argument. Is it true that I have to change the above syntax into the much more verbose: if message.subj =~ /\[sup-devel\]/ message.add_label :list message.add_label :"sup-devel" end Removing a message from the inbox ("message.remove_label :inbox") while applying a label leads to a similar 'code bloat'. Also, it took me a while to realize that errors in before-add-message.rb won't lead to a visible error message, but that before-add-message.rb just silently quits. The examples in http://sup.rubyforge.org/wiki/wiki.pl?Hooks are a very good start. Still, perhaps somebody with robust Ruby skills could add in a section about the exact usage of message.add_label and message.remove_label, e.g.: - What's the difference between "label" and :label? - Can I use multiple labels in one invocation? - How about dashes in labels? Is :sup-devel valid, or should I use :"sup-devel"? - How about spaces in label? - How about "-inbox"? Does it work? Regards, Gregor Hoffleit _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk