Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Choose "From:" address based on message content?
@ 2009-07-23  1:10 Steve Goldman
  2009-07-23  2:51 ` Steve Goldman
  2009-07-27 16:52 ` William Morgan
  0 siblings, 2 replies; 4+ messages in thread
From: Steve Goldman @ 2009-07-23  1:10 UTC (permalink / raw)



Here's what I want:

After I compose an email (new or a reply), I want sup to grep the
entire message (recipients, subject, body, etc.) for a single word and
choose address A if that word is there and address B otherwise.

Can sup do it?

Thanks.

-- 

Steve Goldman
sgoldman at tower-research.com

T: 212.219.6014
F: 212.219.6007

Tower Research Capital, LLC
377 Broadway, 11th Fl.
New York, NY 10013


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [sup-talk] Choose "From:" address based on message content?
  2009-07-23  1:10 [sup-talk] Choose "From:" address based on message content? Steve Goldman
@ 2009-07-23  2:51 ` Steve Goldman
  2009-07-27 16:53   ` William Morgan
  2009-07-27 16:52 ` William Morgan
  1 sibling, 1 reply; 4+ messages in thread
From: Steve Goldman @ 2009-07-23  2:51 UTC (permalink / raw)


Excerpts from Steve Goldman's message of Wed Jul 22 21:10:41 -0400 2009:
> 
> Here's what I want:
> 
> After I compose an email (new or a reply), I want sup to grep the
> entire message (recipients, subject, body, etc.) for a single word and
> choose address A if that word is there and address B otherwise.
> 
> Can sup do it?
> 
> Thanks.
> 

I think I answered my own question.

I added an "after-edit" hook call in edit-message-mode.rb and wrote a
hook that looks like this:


require 'eregex'

r = Regexp.new('word', Regexp::IGNORECASE);
if header.to_s.grep(r).size > 0 or body.to_s.grep(r).size > 0
  header["From"] = "Steve Goldman <sgoldman at other-address.com>"
end
-- 

Steve Goldman
sgoldman at tower-research.com

T: 212.219.6014
F: 212.219.6007

Tower Research Capital, LLC
377 Broadway, 11th Fl.
New York, NY 10013


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [sup-talk] Choose "From:" address based on message content?
  2009-07-23  1:10 [sup-talk] Choose "From:" address based on message content? Steve Goldman
  2009-07-23  2:51 ` Steve Goldman
@ 2009-07-27 16:52 ` William Morgan
  1 sibling, 0 replies; 4+ messages in thread
From: William Morgan @ 2009-07-27 16:52 UTC (permalink / raw)


Reformatted excerpts from Steve Goldman's message of 2009-07-22:
> Can sup do it?

Shit yes. These insane requests are exactly why I am favoring hooks over
configuration.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [sup-talk] Choose "From:" address based on message content?
  2009-07-23  2:51 ` Steve Goldman
@ 2009-07-27 16:53   ` William Morgan
  0 siblings, 0 replies; 4+ messages in thread
From: William Morgan @ 2009-07-27 16:53 UTC (permalink / raw)


Reformatted excerpts from Steve Goldman's message of 2009-07-22:
> require 'eregex'
> 
> r = Regexp.new('word', Regexp::IGNORECASE);
> if header.to_s.grep(r).size > 0 or body.to_s.grep(r).size > 0

You can just use body.to_s =~ /word/i || header.join =~ /i/. No need for
all the fancy libraries and method calls.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-27 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-23  1:10 [sup-talk] Choose "From:" address based on message content? Steve Goldman
2009-07-23  2:51 ` Steve Goldman
2009-07-27 16:53   ` William Morgan
2009-07-27 16:52 ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox