]> git.cworth.org Git - sup/commitdiff
giving a block to PollManager#each_message_in_source is now optional
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 24 Feb 2008 22:31:52 +0000 (14:31 -0800)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 24 Feb 2008 22:31:52 +0000 (14:31 -0800)
The block is only there to allow tweaks to the message before insertion.
It's perfectly useful to call this method without the block.

lib/sup/poll.rb

index 2dd915011c26c8310a0290f5499c0f18b80e9d94..d32c893e76771873832595ec95c67fac0780a208 100644 (file)
@@ -156,7 +156,7 @@ EOS
 
           docid, entry = Index.load_entry_for_id m.id
           HookManager.run "before-add-message", :message => m
-          m = yield(m, offset, entry) or next
+          m = yield(m, offset, entry) or next if block_given?
           Index.sync_message m, docid, entry
           UpdateManager.relay self, :added, m unless entry
         rescue MessageFormatError => e