Subject: [sup-talk] filter question

From: [email-masked] (Guillaume Quintard)
Date: Sat, 23 Feb 2008 13:34:30 -0800

w00t, I finally switched to sup (and this is my first mail to the list using it).
I still have a little problem about filters though. they don't seem to do anything. I have this in my before-add-message.rb :

message.add_label "sent" if message.from =~ /guillaume.quintard at gmail.com/

but, when I send mail to myself, it doesn't label the mail.
I know that it reads the hook (tried some say + sleep calls), but for a reason I don't understand it does nothing.

and yes, this time, I read the FAQ before ;-)

-- 
Guillaume

---

From: [email-masked] (William Morgan)
Date: Sun, 24 Feb 2008 14:58:00 -0800

Reformatted excerpts from Guillaume Quintard's message of 2008-02-23:
> I still have a little problem about filters though. they don't seem to
> do anything. I have this in my before-add-message.rb :
> 

Yep, there was a bug where the before-add-message hook wasn't being
called on sent messages. I've fixed this in git next. Update and try
now.

But you shouldn't have to write that hook, because the sent label is
applied to all sent messages anyways!

(Also, you'd need to use message.from.email because message.from is a
Person object).

-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Guillaume Quintard)
Date: Sun, 24 Feb 2008 16:12:03 -0800

> applied to all sent messages anyways!
actually, the idea was to label mail sent by me from gmail.

> (Also, you'd need to use message.from.email because message.from is a

message.add_label "test" if message.from.email =~ /guillaume.quintard at gmail.com/
doesn't seem to do a thing either :-(

-- 
Guillaume

---

From: [email-masked] (William Morgan)
Date: Sun, 24 Feb 2008 21:13:11 -0800

> doesn't seem to do a thing either :-(

That should work. What if you add some logging information, like:

  log "called"
  log "email is #{message.from.email.inspect}"
  match = message.from.email =~ /guillaume\.quintard at gmail\.com/
  log "match is #{match.inspect}"
  message.add_label :test if match
  log "message labels now #{message.labels.inspect}"

---

From: [email-masked] (shivan)
Date: Sun, 24 Feb 2008 22:28:30 -0800

ok, I got it, this line was causing problem :
message.add_label "server" if message.from.email =~ /@server.com/

replacing @ with \@ did the trick

thanks !

PS : in fact, I'd have another questio : is there an way to switch the "from" field, like it is done in gmail ? I entered two additionnal email addresses with sup-config but found no option to use them.
anyway, kudos to you people, sup is really great !

-- 
Guillaume

---

From: [email-masked] (William Morgan)
Date: Mon, 25 Feb 2008 09:02:19 -0800

> replacing @ with \@ did the trick

Weird. That shouldn't make a difference. @ doesn't require escaping in
regexes. E.g.:

  $ irb
  irb(main):001:0> "bob at server.com" =~ /@server.com/
  => 3
  irb(main):002:0> "bob at server.com" =~ /\@server.com/
  => 3

Well, if it works, it works.

> PS : in fact, I'd have another questio : is there an way to switch the
> "from" field, like it is done in gmail ? I entered two additionnal
> email addresses with sup-config but found no option to use them.

There's no way in the GUI, at least currently. I would like to have a
way, but I'm not sure what the interface would look like.

You have two options: you can overwrite the From: line in the editor
when you compose an email, or you can use the before-edit hook to
programmatically set the From address based on the to address, etc.

---

From: [email-masked] (Guillaume Quintard)
Date: Mon, 25 Feb 2008 09:42:30 -0800

> way, but I'm not sure what the interface would look like.

why not using the same bar as for encryption, and reply-to choices ?

-- 
Guillaume

---

From: [email-masked] (William Morgan)
Date: Thu, 28 Feb 2008 09:43:09 -0800

Reformatted excerpts from Guillaume Quintard's message of 2008-02-25:
> > There's no way in the GUI, at least currently. I would like to have
> > a way, but I'm not sure what the interface would look like.
> 

Well, the user might have 20 different accounts... horizontal scrolling
just isn't going to cut it. Now that I've thought about it, the right
interface is probably to have a keystroke in edit-message-mode that
brings up a modal buffer with a list of all your account default email
addresses and allows you to select one. Then we can leverage Sup's
existing "vertical scrolling technology".

Patches welcome. :)