From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.240.136 with SMTP id la8cs221030icb; Sat, 12 Feb 2011 18:16:14 -0800 (PST) Received: by 10.220.191.134 with SMTP id dm6mr2921613vcb.2.1297563372358; Sat, 12 Feb 2011 18:16:12 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id x13si917330vch.190.2011.02.12.18.16.10; Sat, 12 Feb 2011 18:16:11 -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 997131678324; Sat, 12 Feb 2011 21:16:10 -0500 (EST) X-Greylist: delayed 1540 seconds by postgrey-1.31 at rubyforge.org; Sat, 12 Feb 2011 21:00:11 EST Received: from barfooze.de (barfooze.de [78.46.117.212]) by rubyforge.org (Postfix) with ESMTP id 0E7121858112 for ; Sat, 12 Feb 2011 21:00:11 -0500 (EST) Received: from moritz by barfooze.de with local (Exim 4.74+ponies) (envelope-from ) id 1PoQr5-0007M6-RP for sup-talk@rubyforge.org; Sun, 13 Feb 2011 02:34:27 +0100 From: Moritz Wilhelmy To: sup-talk In-reply-to: <1297375381-sup-2823@plc.intranet.plecavalier.com> References: <1297346751-sup-70@plc.intranet.plecavalier.com> <1297355619-sup-8657@bloovis.org> <1297356327-sup-9107@plc.intranet.plecavalier.com> <1297357197-sup-5893@bloovis.org> <1297364797-sup-8388@plc.intranet.plecavalier.com> <1297375381-sup-2823@plc.intranet.plecavalier.com> Date: Sun, 13 Feb 2011 02:34:27 +0100 Message-Id: <1297560324-sup-4333@niflheimr> User-Agent: Sup/git Subject: Re: [sup-talk] best method for before-add-message.rb 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 Hi, what would be the best way to match - for instance - the List-Id-Header in case it's present? I've been wondering about this for a long time, right now, I'm matching the raw-header against some regex, but it breaks if the line I'm matching contains a newline (i.e. the header field is longer than one line). Is there any way around this? Right now I'm doing something along the lines of this: # Mailing lists lids_re = { // => "foo", // => ["something", "devel"] } def add_labels message, labels labels.each do |l| message.add_label l end end if message.raw_header =~ /^List-I[dD]: ([^\n]+)/ #log "List ID: #{$1}" message.add_label "list" lids_re.keys.each do |re| add_labels message lids_re[re] if $1 =~ re end end Can I pull arbitrary, parsed headers directly out of the message object, or do I have to do my own parsing? Best regards, Moritz _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk