diff options
author | Simon Parri <simonparri@ganzeria.com> | 2019-08-28 08:16:14 -0500 |
---|---|---|
committer | Simon Parri <simonparri@ganzeria.com> | 2019-08-28 08:16:14 -0500 |
commit | 7ec3c2c8bdc4db17e8d15072bae962bf488c8043 (patch) | |
tree | b8495be4ecaee2c68e874be2a9df52f7a834d9c5 | |
parent | 4da4cf9341f0f49d5eeaccee95219b4da7dbe665 (diff) | |
download | spelling-rbee-7ec3c2c8bdc4db17e8d15072bae962bf488c8043.tar.gz spelling-rbee-7ec3c2c8bdc4db17e8d15072bae962bf488c8043.zip |
rewrite spelling-rbead to check subject
-rwxr-xr-x | spelling-rbead | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/spelling-rbead b/spelling-rbead index c8671e1..02e23f8 100755 --- a/spelling-rbead +++ b/spelling-rbead @@ -1,27 +1,22 @@ #!/usr/bin/ruby require "net/imap" +require "base64" server = ARGV[0] user = ARGV[1] -password = ARGV[2] +password = Base64.decode64 ARGV[2] from = ARGV[3] -writefile = ARGV[4] #Net::IMAP.debug = true imap = Net::IMAP.new(server) imap.login(user, password) imap.select "inbox" -n = imap.search(%W/FROM #{from}/).last +n = imap.search("FROM \"#{from}\" SUBJECT \"Spelling\"").last if n msgs = imap.fetch n, "body[1.text]" c = msgs[0].attr["BODY[1.TEXT]"] - b,w = c.split("\n",2) - if b.chomp == "spelling" - words = w.split "\n" - end + words = c.split("\n") end imap.logout -file = File.open(writefile, "w") -file.puts words -file.close +puts words |