HookManager.register "after-poll", <<EOS
Executes immediately before a poll for new messages commences.
Variables:
HookManager.register "after-poll", <<EOS
Executes immediately before a poll for new messages commences.
Variables:
- num: the total number of new messages
- num_inbox: the number of new messages appearing in the inbox (i.e. not
- auto-archived).
- from_and_subj: an array of (from email address, subject) pairs
+ num: the total number of new messages
+ num_inbox: the number of new messages appearing in the inbox (i.e.
+ not auto-archived).
+ from_and_subj: an array of (from email address, subject) pairs
+ from_and_subj_inbox: an array of (from email address, subject) pairs for
+ messages appearing in the inbox
HookManager.run "before-poll"
BufferManager.flash "Polling for new messages..."
HookManager.run "before-poll"
BufferManager.flash "Polling for new messages..."
- num, numi, from_and_subj = buffer.mode.poll
+ num, numi, from_and_subj, from_and_subj_inbox = buffer.mode.poll
if num > 0
BufferManager.flash "Loaded #{num} new messages, #{numi} to inbox."
else
BufferManager.flash "No new messages."
end
if num > 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
def do_poll
total_num = total_numi = 0
from_and_subj = []
def do_poll
total_num = total_numi = 0
from_and_subj = []
+ from_and_subj_inbox = []
@mutex.synchronize do
Index.usual_sources.each do |source|
@mutex.synchronize do
Index.usual_sources.each do |source|
yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
unless entry
num += 1
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]
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
@last_poll = Time.now
@polling = false
end
@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
end
## this is the main mechanism for adding new messages to the