lib/sup/poll.rb in sup-0.4 vs lib/sup/poll.rb in sup-0.5

- old
+ new

@@ -132,11 +132,11 @@ ## ## the labels of the yielded message are the default source ## labels. it is likely that callers will want to replace these with ## the index labels, if they exist, so that state is not lost when ## e.g. a new version of a message from a mailing list comes in. - def add_messages_from source + def add_messages_from source, opts={} begin return if source.done? || source.has_errors? source.each do |offset, labels| if source.has_errors? @@ -154,11 +154,11 @@ labels.delete :unread end docid, entry = Index.load_entry_for_id m.id HookManager.run "before-add-message", :message => m - m = yield(m, offset, entry) or next - Index.sync_message m, docid, entry + m = yield(m, offset, entry) or next if block_given? + Index.sync_message m, docid, entry, opts UpdateManager.relay self, :added, m unless entry rescue MessageFormatError => e Redwood::log "ignoring erroneous message at #{source}##{offset}: #{e.message}" end end