summaryrefslogtreecommitdiff
path: root/spelling-rbead
diff options
context:
space:
mode:
authorSimon Parri <simonparri@ganzeria.com>2019-02-01 14:29:13 -0600
committerSimon Parri <simonparri@ganzeria.com>2019-02-01 14:29:13 -0600
commitd2bd0e19cb049269d51953a17d561b0aeaab5dfb (patch)
tree4595415ad6afc8c40b9bfc6121fef234c3ce2398 /spelling-rbead
downloadspelling-rbee-d2bd0e19cb049269d51953a17d561b0aeaab5dfb.tar.gz
spelling-rbee-d2bd0e19cb049269d51953a17d561b0aeaab5dfb.zip
Initial Commit
spelling-rbee is a spelling program written in ruby and reading from .txt files. It is licenced under the Gnu General Public licence Version 3, or any later version, at your option.
Diffstat (limited to 'spelling-rbead')
-rwxr-xr-xspelling-rbead27
1 files changed, 27 insertions, 0 deletions
diff --git a/spelling-rbead b/spelling-rbead
new file mode 100755
index 0000000..c8671e1
--- /dev/null
+++ b/spelling-rbead
@@ -0,0 +1,27 @@
+#!/usr/bin/ruby
+
+require "net/imap"
+server = ARGV[0]
+user = ARGV[1]
+password = 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
+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
+end
+imap.logout
+
+file = File.open(writefile, "w")
+file.puts words
+file.close