summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf@aurora.xapek.org>2010-02-23 08:07:20 +0100
committeryvesf <yvesf@aurora.xapek.org>2010-02-23 08:07:20 +0100
commita2450062c993b097e9763ad312ad9292f0a33dda (patch)
tree521a77e2a8ddcceb232f1741b8f2b71baf088931
parent6e33a67a8cb5011081e4dfb78b3082dd86ce8886 (diff)
downloadfakesmtp-a2450062c993b097e9763ad312ad9292f0a33dda.tar.gz
fakesmtp-a2450062c993b097e9763ad312ad9292f0a33dda.zip
use SPAMMODE in mhonarc
-rwxr-xr-x[-rw-r--r--]maildir2rss.py47
-rw-r--r--mhonarc.mrc3
2 files changed, 27 insertions, 23 deletions
diff --git a/maildir2rss.py b/maildir2rss.py
index 563a48f..b50beef 100644..100755
--- a/maildir2rss.py
+++ b/maildir2rss.py
@@ -1,37 +1,38 @@
+#!/usr/bin/python
import datetime
import PyRSS2Gen
from mailbox import Maildir
import os,sys
-maildir=Maildir(os.path.dirname(os.path.abspath(__file__)) + "/Maildir")
+def genItems():
+ maildir=Maildir(os.path.dirname(os.path.abspath(__file__)) + "/Maildir")
-items=[]
-for key in maildir.keys():
- msg = maildir[key]
- try:
- subject = msg['subject']
- author=msg['from']
- msg.rewindbody()
- description = msg.fp.read()
- rfcdate = msg.getdate('date')
- date=datetime.datetime(*rfcdate[:-2])
- item=PyRSS2Gen.RSSItem(
- title=subject,
- author=author,
- link="http://xapek.org",
- description=description,
- pubDate=date
- )
- items.append(item)
- sys.stderr.write( "processed %s\n" % key)
- except Exception,e:
- sys.stderr.write("skip %s: %s\n" % (key,str(e)))
+ for key in maildir.keys():
+ msg = maildir[key]
+ try:
+ subject = msg['subject']
+ author=msg['from']
+ msg.rewindbody()
+ description = msg.fp.read()
+ rfcdate = msg.getdate('date')
+ date=datetime.datetime(*rfcdate[:-2])
+ item=PyRSS2Gen.RSSItem(
+ title=subject,
+ author=author,
+ link="http://xapek.org",
+ description=description,
+ pubDate=date
+ )
+ yield item
+ sys.stderr.write( "processed %s\n" % key)
+ except Exception,e:
+ sys.stderr.write("skip %s: %s\n" % (key,str(e)))
rss = PyRSS2Gen.RSS2(
title = "Spamfeed",
link = "http://www.xapek.org/~yvesf/spam",
description = "Spam spam spam",
lastBuildDate = datetime.datetime.now(),
- items=items
+ items=list(genItems())
)
rss.write_xml(sys.stdout)
diff --git a/mhonarc.mrc b/mhonarc.mrc
index a592be7..f352587 100644
--- a/mhonarc.mrc
+++ b/mhonarc.mrc
@@ -15,6 +15,9 @@ index.html
20
</IDXSIZE>
+<!-- obscure email-addresses -->
+<SPAMMODE>
+
<!-- add RSS link-->
<IdxPgBegin>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"