From: wmorgan Date: Sun, 19 Aug 2007 00:50:59 +0000 (+0000) Subject: better after-poll hook X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=773333d3718b045eac76fa637168f81885bd2523;p=sup better after-poll hook git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@529 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 4d6c5c0..45e6210 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -13,10 +13,12 @@ EOS HookManager.register "after-poll", < 0 BufferManager.flash "Loaded #{num} new messages, #{numi} to inbox." else BufferManager.flash "No new messages." end - HookManager.run "after-poll", :num => num, :num_inbox => numi, :from_and_subj => from_and_subj + HookManager.run "after-poll", :num => num, :num_inbox => numi, :from_and_subj => from_and_subj, :from_and_subj_inbox => from_and_subj_inbox [num, numi] end @@ -66,6 +68,7 @@ EOS def do_poll total_num = total_numi = 0 from_and_subj = [] + from_and_subj_inbox = [] @mutex.synchronize do Index.usual_sources.each do |source| @@ -86,8 +89,11 @@ EOS yield "Found message at #{offset} with labels {#{m.labels * ', '}}" unless entry num += 1 - numi += 1 if m.labels.include? :inbox from_and_subj << [m.from.longname, m.subj] + if m.labels.include? :inbox + from_and_subj_inbox << [m.from.longname, m.subj] + numi += 1 + end end m end @@ -100,7 +106,7 @@ EOS @last_poll = Time.now @polling = false end - [total_num, total_numi, from_and_subj] + [total_num, total_numi, from_and_subj, from_and_subj_inbox] end ## this is the main mechanism for adding new messages to the