commit bbc03774beeedeb7e6c3ceb1ecdc2643a35956eb
parent dc85cbeb707539c272c553b3675ab7c7c8177a72
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 8 May 2018 14:00:54 -0400
Mark all new AOS emails as read in NOAA inbox
Diffstat:
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/links/.imapfilter/noaa.lua b/links/.imapfilter/noaa.lua
@@ -0,0 +1,18 @@
+-- see `man imapfilter_config` for info on options
+
+-- function to strip trailing newlines piped from ~/.mutt/offlineimap.py
+function trim(s)
+ return (s:gsub("^%s*(.-)%s*$", "%1"))
+end
+
+status, pass = pipe_from("python ~/.mutt/offlineimap-password-store.py anders.damsgaard@noaa.gov")
+account = IMAP {
+ server = 'imap.gmail.com',
+ username = 'anders.damsgaard@noaa.gov',
+ password = trim(pass),
+ ssl = 'tls1'
+}
+
+-- Mark AOS emails as seen in NOAA account
+results = account.INBOX:is_unseen():match_to("oar.gfdl.forrestal@noaa.gov")
+results:mark_seen()
diff --git a/links/.offlineimaprc b/links/.offlineimaprc
@@ -314,6 +314,7 @@ localrepository = noaa-local
remoterepository = noaa-remote
# Status cache. Default is plain, which eventually becomes huge and slow.
#status_backend = sqlite
+presynchook = imapfilter -t ~/.mutt/cert.pem -c ~/.imapfilter/noaa.lua
postsynchook = notmuch new
# Minutes between syncs