lib/sup/modes/forward_mode.rb in sup-0.20.0 vs lib/sup/modes/forward_mode.rb in sup-0.21.0

- old
+ new

@@ -1,8 +1,19 @@ module Redwood class ForwardMode < EditMessageMode + + HookManager.register "forward-attribution", <<EOS +Generates the attribution for the forwarded message +(["--- Begin forwarded message from John Doe ---", + "--- End forwarded message ---"]) +Variables: + message: a message object representing the message being replied to + (useful values include message.from.mediumname and message.date) +Return value: + A list containing two strings: the text of the begin line and the text of the end line +EOS ## TODO: share some of this with reply-mode def initialize opts={} header = { "From" => AccountManager.default_account.full_address, } @@ -63,12 +74,20 @@ end protected def forward_body_lines m - ["--- Begin forwarded message from #{m.from.mediumname} ---"] + - m.quotable_header_lines + [""] + m.quotable_body_lines + - ["--- End forwarded message ---"] + attribution = HookManager.run("forward-attribution", :message => m) || default_attribution(m) + attribution[0,1] + + m.quotable_header_lines + + [""] + + m.quotable_body_lines + + attribution[1,1] + end + + def default_attribution m + ["--- Begin forwarded message from #{m.from.mediumname} ---", + "--- End forwarded message ---"] end def send_message return unless super # super returns true if the mail has been sent if @m