From: Colin Patrick Mccabe Date: Sun, 27 Oct 2013 04:06:25 +0000 (-0700) Subject: some fixups to snarf_mail scripts X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1819fb0f4ce3620cbac7b399e925ed8abe66b09;p=cmccabe-bin some fixups to snarf_mail scripts * rename snarf_mail.rb to snarf_mail_imap.rb * rename snarf_gmail.rb to snarf_mail_pop.rb imap script: make --username argument more consistent with other arguments. Fix syntax error with opts.delete. pop script: we don't actually need the 'password' gem for this, so don't include. Signed-off-by: Colin McCabe --- diff --git a/snarf_mail.rb b/snarf_mail_imap.rb similarity index 95% rename from snarf_mail.rb rename to snarf_mail_imap.rb index 76c831c..d4d6e93 100755 --- a/snarf_mail.rb +++ b/snarf_mail_imap.rb @@ -28,9 +28,9 @@ class MyOptions "Set delete policy to 'none' or 'old'. Default is 'none'.") do |d| opts.delete = d end - myparser.on("--username USERNAME", "-u", + myparser.on("--username [USERNAME]", "-u", "Email account to fetch. (example: \ -RareCactus@gmail.com)") do |u| +RareCactus@gmail.com or cmccabe@company.com)") do |u| opts.username = u end myparser.on("--list-folders", "-l", @@ -49,7 +49,7 @@ multiple mailboxes.") do |a| opts.mailboxes << a end myparser.on("--server [SERVER]", "-s", - "Email server to use") do |u| + "Email server to use. Example: imap.gmail.com") do |u| opts.server = u end end @@ -156,7 +156,7 @@ def snarf_mailbox(imap, mailbox) printf(".") STDOUT.flush() - if ($opts.delete != "none"): + if $opts.delete != "none" then # Delete messages imap.store(msg_seqnos, "+FLAGS", [:Deleted]) imap.expunge diff --git a/snarf_gmail.rb b/snarf_mail_pop.rb similarity index 97% rename from snarf_gmail.rb rename to snarf_mail_pop.rb index 52aed0e..3f6f115 100755 --- a/snarf_gmail.rb +++ b/snarf_mail_pop.rb @@ -5,7 +5,6 @@ # # Copies mail from a gmail account # You need ruby 1.9 for this -# You need the password gem for this # # Problem: this appears to only download some mails (usually around 383 or # so). One workaround is to run this multiple times. Still not sure if there @@ -17,7 +16,6 @@ require 'net/pop' require 'optparse' require 'ostruct' -require 'password' class MyOptions def self.parse(args)