From: Kevin Riggle <[email protected]>
I want to do some unrelated processing on each message I receive, but I
don't want to block the message being added to the index. This patch
adds a hook which runs /after/ the message is added to the index.
---
lib/sup/poll.rb | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
index 8a9d218..e4b7e02 100644
--- a/lib/sup/poll.rb
+++ b/lib/sup/poll.rb
@@ -11,6 +11,12 @@ Variables:
message: the new message
EOS
+ HookManager.register "after-add-message", <<EOS
+Executes after a message is added to the index.
+Variables:
+ message: the new message
+EOS
+
HookManager.register "before-poll", <<EOS
Executes immediately before a poll for new messages commences.
No variables.
@@ -156,6 +162,7 @@ EOS
m_ret = yield(m_old, m_new, offset) or next if block_given?
Index.sync_message m_ret, opts
UpdateManager.relay self, :added, m_ret unless m_old
+ HookManager.run "after-add-message", :message => m_new
end
rescue SourceError => e
Redwood::log "problem getting messages from #{source}: #{e.message}"
--
1.6.0.4
_______________________________________________
sup-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/sup-talk