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 protected]>" > end > > if message.recipient_email =~ /rubyforge/ > return "My name <[email protected]>" > end > > ... 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 protected]>" 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: PersonManager.person_for case when message.to =~ /rubyforge/ "My name <[email protected]>" when message.recipient_email =~ /rubyforge/ "My name <[email protected]>" else "My name <[email protected]>" end 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 statement. > 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 <[email protected]> _______________________________________________ sup-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/sup-talk
