[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sup-talk] 0/0...I made it



Hi David.
Excerpts from David J. Hamilton's message of Mon Feb 14 13:11:40 -0500 2011:
> 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?

Yeah. I've tried a bunch of options[1] -and still am-. Mostly, I don't understand what's going on during the functions and it's making things challenging to say the least.

I really like the idea of matching email addresses using an external file as in the sup-wiki. As I mention in [1] simple operations ie adding/removing a single label works like a charm. But I want a model that will allow me to search in a very granular way. I want to break down my labels.

|client
||companyA
||companyB
||companyC
|||position
|||invoice
|||issues
|||reports

|ff #friends and foe
||wife,friends, family
|||contact
||||persons name I don't like

This way I can search for all 'company' then refine by 'position' 'invoice'...etc. Or go straight to a specific group or people 'position' ie all 'exec' or 'finance'. But in order to do that I need a before-add-message hook that will add multiple labels either in one invocation or multiple ones.

It goes without saying, but I'll state it anyways, my desired model far exceeds my ability as non-programmer. However, I'm a logical and patience individual and I know that if I can find a working example I can 'take it from there'.

At the moment, it seems my biggest problem is labeling an email more than once. I found a few posts/relevant discussions[2,3] regard sup and multiple labels but nothing has lead me down the correct path.

ref:
[1] http://rubyforge.org/pipermail/sup-talk/2011-February/004504.html
[2] https://github.com/jacius/sup-filters/blob/master/filters.example.yaml
[3] http://www.mail-archive.com/sup-talk@rubyforge.org/msg03361.html
> 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
> 
-- 
Thanks,
Phil
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk