Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...')
@ 2008-01-14 12:24 Marcus Williams
  2008-01-15  5:20 ` William Morgan
  0 siblings, 1 reply; 10+ messages in thread
From: Marcus Williams @ 2008-01-14 12:24 UTC (permalink / raw)


---
 lib/sup/modes/reply-mode.rb |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index 04018e3..59ffa66 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -9,6 +9,14 @@ class ReplyMode < EditMessageMode
     :list => "Mailing list",
     :user => "Customized"
   }
+  
+  HookManager.register "quoteline", <<EOS
+Generates a quote line "On 1/4/2007, Joe Bloggs wrote:".
+Variables:
+      message: A message object representing the message being replied to
+Return value:
+  A string containing the text of the quote line
+EOS
 
   def initialize message
     @m = message
@@ -115,11 +123,16 @@ protected
   end
 
   def reply_body_lines m
-    lines = ["Excerpts from #{@m.from.name}'s message of #{@m.date}:"] + m.quotable_body_lines.map { |l| "> #{l}" }
+    quoteline = HookManager.run("quoteline", :message => m) || default_quoteline(m)
+    lines = [quoteline] + m.quotable_body_lines.map { |l| "> #{l}" }
     lines.pop while lines.last =~ /^\s*$/
     lines
   end
 
+  def default_quoteline m
+    "Excerpts from #{@m.from.name}'s message of #{@m.date}:"
+  end
+
   def handle_new_text new_header, new_body
     old_header = @headers[@type_selector.val]
     if new_header.size != old_header.size || old_header.any? { |k, v| new_header[k] != v }
-- 
1.5.3.7



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

end of thread, other threads:[~2008-01-22  2:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-14 12:24 [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...') Marcus Williams
2008-01-15  5:20 ` William Morgan
2008-01-15  9:18   ` Marcus Williams
2008-01-15  9:40     ` [sup-talk] [PATCH] Added quoteline hook for reply mode Marcus Williams
2008-01-16  1:31       ` William Morgan
2008-01-16 16:32       ` Grant Hollingworth
2008-01-16 16:39         ` Marcus Williams
2008-01-16 21:09           ` William Morgan
2008-01-17 17:49             ` [sup-talk] [PATCH] renamed "quoteline" hook to "attribution" Grant Hollingworth
2008-01-22  2:49               ` William Morgan

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