From: Colin Patrick McCabe Date: Mon, 3 May 2010 19:55:31 +0000 (-0700) Subject: snarf_mail: Fix total count of all messages X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aea0716c7b07a5f06f096c7b42ae909786512dc3;p=cmccabe-bin snarf_mail: Fix total count of all messages --- 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