Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: David J. Hamilton <groups@hjdivad.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: Re: [sup-talk] 0/0...I made it
Date: Mon, 14 Feb 2011 10:11:40 -0800	[thread overview]
Message-ID: <1297706861-sup-7672@nyx.local> (raw)
In-Reply-To: <1297630080-sup-3488@plc.intranet.plecavalier.com>

Philippe,

Excerpts from Philippe LeCavalier's message of Sun Feb 13 12:57:30 -0800 2011:
> Well, despite not finding a truly efficient method for autolabeling my mail
> -I'm not worried I won't, I just haven't found it yet- after 30 some days of
> due deligence my inbox is for now back to 0.

Have you tried writing a before-add-message hook?  If so, what problems have you
run in to with your attempts at autolabeling?

Here's a snippet of mine:

  # before-add-message.rb

  def autolabel message, label 
    log "Adding label [#{label}] to #{message.id}"
    message.add_label label
  end

  def autolabel_email message, regexes, label
    regexes = [ regexes ] unless regexes.is_a? Enumerable
    if message.recipients.any? do |recipient|
          AccountManager.is_account_email? recipient.email and
            regexes.any?{ |r| recipient.email =~ r }
        end
      autolabel message, label
    end

    if    AccountManager.is_account_email? message.from.email and
          regexes.any?{ |r| message.from.email =~ r }
        
      autolabel message, label
    end
  end


  unless message.nil?
    autolabel_email   message,    /ucdavis.edu$/i,     'ucdavis'
    # … lines similar to above, giving regexes or arrays of regexes and the
    # desired label.
  end

-- 
med vänlig hälsning
David J. Hamilton
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

  reply	other threads:[~2011-02-14 18:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13 20:57 Philippe LeCavalier
2011-02-14 18:11 ` David J. Hamilton [this message]
2011-02-14 19:18   ` 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=1297706861-sup-7672@nyx.local \
    --to=groups@hjdivad.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