X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;ds=sidebyside;f=lib%2Fsup%2Fpoll.rb;h=3a8b57fcda94dd78edb864e3ba7c7d0a2024ffe9;hb=01316aff4da1e7ff74dc3fac4578251b80807528;hp=87cf9963796286f73a92f87478c207e23300cfa0;hpb=ff6e6801ea7c2804dc061db00632ac7c0d370d32;p=sup diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 87cf996..3a8b57f 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -40,7 +40,7 @@ EOS end def buffer - b, new = BufferManager.spawn_unless_exists("", :hidden => true) { PollMode.new } + b, new = BufferManager.spawn_unless_exists("poll for new messages", :hidden => true, :system => true) { PollMode.new } b end @@ -97,13 +97,13 @@ EOS numi = 0 add_messages_from source do |m, offset, entry| ## always preserve the labels on disk. - m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry + m.labels = ((m.labels - [:unread, :inbox]) + entry[:label].symbolistize).uniq if entry yield "Found message at #{offset} with labels {#{m.labels * ', '}}" unless entry num += 1 - from_and_subj << [m.from.longname, m.subj] + from_and_subj << [m.from && m.from.longname, m.subj] if m.has_label?(:inbox) && ([:spam, :deleted, :killed] & m.labels).empty? - from_and_subj_inbox << [m.from.longname, m.subj] + from_and_subj_inbox << [m.from && m.from.longname, m.subj] numi += 1 end end