The reply mode you desire, or nil to use the default behavior.
EOS
- def initialize message
+ def initialize message, type_arg=nil
@m = message
## it's important to put this early because it forces a read of
## don't check that it's an Account, though; assume they know what they're
## doing.
if hook_reply_from && !(hook_reply_from.is_a? Person)
- Redwood::log "reply-from returned non-Person, using default from."
+ info "reply-from returned non-Person, using default from."
hook_reply_from = nil
end
## if we have a value from a hook, use it.
from = if hook_reply_from
hook_reply_from
- ## otherwise, if the original email was addressed to a particular
- ## address via an envelope-to or whatever, try and use that one.
+ ## otherwise, if the original email had an envelope-to header, try and use
+ ## it, and look up the corresponding name form the list of accounts.
+ ##
+ ## this is for the case where mail is received from a mailing lists (so the
+ ## To: is the list id itself). if the user subscribes via a particular
+ ## alias, we want to use that alias in the reply.
elsif @m.recipient_email && (a = AccountManager.account_for(@m.recipient_email))
- a
+ Person.new a.name, @m.recipient_email
## otherwise, try and find an account somewhere in the list of to's
## and cc's.
elsif(b = (@m.to + @m.cc).find { |p| AccountManager.is_account? p })
"To" => [],
"Cc" => [],
"Bcc" => [],
- "In-Reply-To" => "<#{@m.id}>",
+ "In-reply-to" => "<#{@m.id}>",
"Subject" => Message.reify_subj(@m.subj),
"References" => refs,
}.merge v
hook_reply = HookManager.run "reply-to", :modes => types
@type_selector.set_to(
- if types.include? hook_reply
+ if types.include? type_arg
+ type_arg
+ elsif types.include? hook_reply
hook_reply
elsif @m.is_list_message?
:list