Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] Publish hook
@ 2010-02-21 20:24 Tero Tilus
  2010-02-27  8:26 ` Rich Lane
  0 siblings, 1 reply; 2+ messages in thread
From: Tero Tilus @ 2010-02-21 20:24 UTC (permalink / raw)
  To: Sup developers

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

Quite a few times I've found myself wanting to send a mail text to
etherpad/pastebin/etc or attachment doc to flicr/evernote/etc.  I went
to drill an appropriately small hole to sup to enable just that.

Patch attached and online
http://github.com/terotil/sup/tree/feature-publish-attachment

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/

[-- Attachment #2: 0001-Publishing-hook.patch --]
[-- Type: application/octet-stream, Size: 1782 bytes --]

From e97f535e9394f1e82a66f263ec893743b48ed965 Mon Sep 17 00:00:00 2001
From: Tero Tilus <tero@tilus.net>
Date: Sun, 21 Feb 2010 22:09:56 +0200
Subject: [PATCH] Publishing hook

---
 lib/sup/modes/thread-view-mode.rb |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
index 0e935a4..58207e0 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -35,6 +35,14 @@ Return value:
   which will be appended by sup.
 EOS
 
+  HookManager.register "publish", <<EOS
+Executed when a message or a chunk is requested to be published.
+Variables:
+     chunk: Redwood::Message or Redwood::Chunk::* to be published.
+Return value:
+  None.
+EOS
+
   register_keymap do |k|
     k.add :toggle_detailed_header, "Toggle detailed header", 'h'
     k.add :show_header, "Show full message header", 'H'
@@ -59,6 +67,7 @@ EOS
     k.add :edit_as_new, "Edit message as new", 'D'
     k.add :save_to_disk, "Save message/attachment to disk", 's'
     k.add :save_all_to_disk, "Save all attachments to disk", 'A'
+    k.add :publish, "Publish message/attachment using publish-hook", 'P'
     k.add :search, "Search for messages from particular people", 'S'
     k.add :compose, "Compose message to person", 'm'
     k.add :subscribe_to_list, "Subscribe to/unsubscribe from mailing list", "("
@@ -388,6 +397,15 @@ EOS
     end
   end
 
+  def publish
+    chunk = @chunk_lines[curpos] or return
+    if HookManager.enabled? "publish"
+      HookManager.run "publish", :chunk => chunk
+    else
+      BufferManager.flash "Publishing hook not defined."
+    end
+  end
+
   def edit_draft
     m = @message_lines[curpos] or return
     if m.is_draft?
-- 
1.5.6.5


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

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

* Re: [sup-devel] [PATCH] Publish hook
  2010-02-21 20:24 [sup-devel] [PATCH] Publish hook Tero Tilus
@ 2010-02-27  8:26 ` Rich Lane
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-02-27  8:26 UTC (permalink / raw)
  To: Tero Tilus; +Cc: Sup developers

Branch publish-hook, merged to next.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


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

end of thread, other threads:[~2010-02-27  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-21 20:24 [sup-devel] [PATCH] Publish hook Tero Tilus
2010-02-27  8:26 ` Rich Lane

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