Subject: [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...')

From: [email-masked] (Marcus Williams)
Date: Mon, 14 Jan 2008 12:24:27 +0000

---
 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 [email-masked]}'s message of [email-masked]}:"] + 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 [email-masked]}'s message of [email-masked]}:"
+  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

---

From: [email-masked] (William Morgan)
Date: Mon, 14 Jan 2008 21:20:17 -0800

Hi Marcus,

Two small comments:

First, can you please use the Official Commit Log Entry Format(tm) as
detailed on the wiki, so that all the git tools that rely on that
function nicely?

Second:

> +    lines = [quoteline] + m.quotable_body_lines.map { |l| "> #{l}" }

Can we instead do quoteline.split("\n"), so that people can return
multi-line things? Not that I endore that practice, but, de gustibus and
all that.

Other than that looks good.

-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Marcus Williams)
Date: Tue, 15 Jan 2008 09:18:28 +0000

> detailed on the wiki, so that all the git tools that rely on that

Sorry missed that - I did try to get git to do something like that but
couldnt figure out how to bend it the way I wanted. Will revert and
resend.

> multi-line things? Not that I endore that practice, but, de gustibus and

No problems (multi-line quote lines... bleurgh)

Marcus

---

From: [email-masked] (Marcus Williams)
Date: Tue, 15 Jan 2008 09:40:04 +0000

This hook allows a user to configure a quote line for replies. The
default is the standard sup quote line "Excerpts from...". Multiple
lines are allowed.
---
 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..9c4b11d 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 (can be multi-line)
+EOS
 
   def initialize message
     @m = message
 
   def reply_body_lines m
-    lines = ["Excerpts from [email-masked]}'s message of [email-masked]}:"] + m.quotable_body_lines.map { |l| "> #{l}" }
+    quoteline = HookManager.run("quoteline", :message => m) || default_quoteline(m)
+    lines = quoteline.split("\n") + m.quotable_body_lines.map { |l| "> #{l}" }
     lines.pop while lines.last =~ /^\s*$/
     lines
   end

---

From: [email-masked] (William Morgan)
Date: Tue, 15 Jan 2008 17:31:33 -0800

> default is the standard sup quote line "Excerpts from...". Multiple

Applied to next. Thanks!

---

From: [email-masked] (Grant Hollingworth)
Date: Wed, 16 Jan 2008 11:32:06 -0500

> default is the standard sup quote line "Excerpts from...". Multiple

Thanks! I can take that off my to-do list now.

I like Mutt's term "attribution" slightly more than "quoteline".

---

From: [email-masked] (Marcus Williams)
Date: Wed, 16 Jan 2008 16:39:43 +0000

> I like Mutt's term "attribution" slightly more than "quoteline".

:) I only called it quoteline because I couldnt think of a term for
it. "attribution" is much nicer.

Marcus

---

From: [email-masked] (William Morgan)
Date: Wed, 16 Jan 2008 13:09:59 -0800

> it. "attribution" is much nicer.

Patches welcome! :)

---

From: [email-masked] (Grant Hollingworth)
Date: Thu, 17 Jan 2008 12:49:21 -0500

---
 lib/sup/modes/reply-mode.rb |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index 2d05f15..3b8c920 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -10,10 +10,11 @@ class ReplyMode < EditMessageMode
     :user => "Customized"
   }
 
-  HookManager.register "quoteline", <<EOS
-Generates a quote line "On 1/4/2007, Joe Bloggs wrote:".
+  HookManager.register "attribution", <<EOS
+Generates an attribution ("Excerpts from Joe Bloggs's message of Fri Jan 11 09:54:32 -0500 2008:").
 Variables:
-      message: A message object representing the message being replied to
+  message: a message object representing the message being replied to
+    (useful values include message.from.name and message.date)
 Return value:
   A string containing the text of the quote line (can be multi-line)
 EOS
@@ -123,13 +124,13 @@ protected
   end
 
   def reply_body_lines m
-    quoteline = HookManager.run("quoteline", :message => m) || default_quoteline(m)
-    lines = quoteline.split("\n") + m.quotable_body_lines.map { |l| "> #{l}" }
+    attribution = HookManager.run("attribution", :message => m) || default_attribution(m)
+    lines = attribution.split("\n") + m.quotable_body_lines.map { |l| "> #{l}" }
     lines.pop while lines.last =~ /^\s*$/
     lines
   end
 
-  def default_quoteline m
+  def default_attribution m
     "Excerpts from [email-masked]}'s message of [email-masked]}:"
   end
 
-- 
1.5.3.7

---

From: [email-masked] (William Morgan)
Date: Mon, 21 Jan 2008 18:49:26 -0800

Applied, thanks. Anyone tracking next with a quoteline hook, you will
have to rename the file.