Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] adding a reply-to hook for setting the default reply-to mode
@ 2008-05-31 15:52 Jeff Balogh
  2008-06-04  3:05 ` William Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Balogh @ 2008-05-31 15:52 UTC (permalink / raw)


---
Trying again, hopefully the docs are better now.  If there's a better way to
pretty-print the array, I'd be glad to know it.

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

diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index e7b2929..de08609 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -19,6 +19,17 @@ Return value:
   A string containing the text of the quote line (can be multi-line)
 EOS
 
+  HookManager.register "reply-to", <<EOS
+Set the default reply-to mode.
+Variables:
+  modes: array of valid modes to choose from, which will be a subset of
+             [:#{REPLY_TYPES * ', :'}]
+         The default behavior is equivalent to
+             ([:list, :sender, :recipent] & modes)[0]
+Return value:
+  The reply mode you desire, or nil to use the default behavior.
+EOS
+
   def initialize message
     @m = message
 
@@ -92,8 +103,12 @@ EOS
     types = REPLY_TYPES.select { |t| @headers.member?(t) }
     @type_selector = HorizontalSelector.new "Reply to:", types, types.map { |x| TYPE_DESCRIPTIONS[x] }
 
+    hook_reply = HookManager.run "reply-to", :modes => types
+
     @type_selector.set_to(
-      if @m.is_list_message?
+      if types.include? hook_reply
+        hook_reply
+      elsif @m.is_list_message?
         :list
       elsif @headers.member? :sender
         :sender
-- 
1.5.5.3



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

* [sup-talk] [PATCH] adding a reply-to hook for setting the default reply-to mode
  2008-05-31 15:52 [sup-talk] [PATCH] adding a reply-to hook for setting the default reply-to mode Jeff Balogh
@ 2008-06-04  3:05 ` William Morgan
  0 siblings, 0 replies; 2+ messages in thread
From: William Morgan @ 2008-06-04  3:05 UTC (permalink / raw)


Merged in to next. Thanks!

Reformatted excerpts from its.jeff.balogh's message of 2008-05-31:
> Trying again, hopefully the docs are better now.  If there's a better
> way to pretty-print the array, I'd be glad to know it.

You could use REPLY_TYPES.inspect.
-- 
William <wmorgan-sup at masanjin.net>


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

end of thread, other threads:[~2008-06-04  3:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-31 15:52 [sup-talk] [PATCH] adding a reply-to hook for setting the default reply-to mode Jeff Balogh
2008-06-04  3:05 ` William Morgan

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