From aea0716c7b07a5f06f096c7b42ae909786512dc3 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Mon, 3 May 2010 12:55:31 -0700 Subject: [PATCH] snarf_mail: Fix total count of all messages --- snarf_mail.rb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/snarf_mail.rb b/snarf_mail.rb index bfc0873..ca871f8 100755 --- a/snarf_mail.rb +++ b/snarf_mail.rb @@ -87,6 +87,7 @@ end def snarf_mailbox(imap, mailbox) imap.select(mailbox) count = 0 + total_count = 0 imap.search(["NOT", "DELETED"]).each do |message_id| data = imap.fetch(message_id, [ "UID", "RFC822.HEADER", "RFC822.TEXT" ]) a = data[0].attr @@ -96,13 +97,14 @@ def snarf_mailbox(imap, mailbox) fp.write(a["RFC822.TEXT"]) fp.close count = count + 1 + total_count = total_count + 1 if (count > 10) then count = 0 printf(".") STDOUT.flush() end end - puts "fetched #{count} messages from #{mailbox}" + puts "fetched #{total_count} messages from #{mailbox}" end # MAIN -- 1.6.6.rc1.39.g9a42