[sup-talk] a few sup newbie questions
wmorgan-sup at masanjin.net
Fri Jan 2 07:53:24 EST 2009
Reformatted excerpts from marianne.promberger+sup-talk's message of 2008-12-30:
> Thanks. Any chance you could give me a pointer on how I can get it to
> "return a person"?
> I've tried stuff like ... (in ~/.sup/hook/reply-from.rb)
> if message.to =~ /rubyforge/
> hook_reply_from = "My Name <email at domain.com>"
> if message.recipient_email =~ /rubyforge/
> return "My name <email at domain.com>"
> ... with different variations of patterns I'm testing for and with
> different returned strings.
You can create a person from a string by using this method:
PersonManager.person_for "My name <email at domain.com>"
You can give it any valid email address, and it takes care of returning
the same Person object for duplicate addresses.
Brief Ruby aside: If you're going to be doing a lot of such comparisons,
you can structure the hook like:
when message.to =~ /rubyforge/
"My name <email at email1.org>"
when message.recipient_email =~ /rubyforge/
"My name <email at email2.org>"
"My name <default at default.org>"
Note that the return statement isn't required (the final value of the
hook is used), and multiple if-then's can be collapsed into a case
> Any pointers appreciated! (Including general information where I could
> RTFM .. I looked at "sup -l" but that's pretty brief.
Sadly, there's no good documentation for this right now beyond asking on
the mailing list. (Well besides learning Ruby and looking at the code.)
I'm sorry about that.
William <wmorgan-sup at masanjin.net>
More information about the sup-talk