Skip to content

Commit

Permalink
Flush read messages 1 day instead of on every run
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarmo committed Mar 14, 2015
1 parent 8fedba7 commit 991bd75
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rss2email.py
Expand Up @@ -15,19 +15,20 @@
opmlexport
opmlimport filename
"""
__version__ = "2.71-rcarmo"
__version__ = "2.72-rcarmo"
__author__ = "Lindsey Smith (lindsey@allthingsrss.com)"
__copyright__ = "(C) 2004 Aaron Swartz. GNU GPL 2 or 3."
___contributors__ = ["Dean Jackson", "Brian Lalor", "Joey Hess",
"Matej Cepl", "Martin 'Joey' Schulze",
"Marcel Ackermann (http://www.DreamFlasher.de)",
"Rui Carmo (http://the.taoofmac.com)",
"Rui Carmo (http://taoofmac.com)",
"Lindsey Smith (maintainer)", "Erik Hetzner",
"Aaron Swartz (original author)" ]

### Import Modules ###

import os, sys, re, time
from datetime import datetime, timedelta
import socket, urllib2, urlparse, imaplib, smtplib
urllib2.install_opener(urllib2.build_opener())
import string, csv, StringIO
Expand Down Expand Up @@ -823,7 +824,8 @@ def run(num=None):
if folder == IMAP_MOVE_READ_TO or '\Noselect' in row[0]:
continue
mailserver.select(folder)
res, data = mailserver.search(None, '(SEEN UNFLAGGED)')
yesterday = (datetime.now() - timedelta(days=1)).strftime("%d-%b-%Y")
res, data = mailserver.search(None, '(SEEN BEFORE %s UNFLAGGED)' % yesterday)
if res == 'OK':
items = data[0].split()
for i in items:
Expand Down

0 comments on commit 991bd75

Please sign in to comment.