Add rss2email v2.25 v2.25
authorAaron Swartz <me@aaronsw.com>
Fri, 30 Jan 2004 12:02:00 +0000 (12:02 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 15 Feb 2013 16:37:52 +0000 (11:37 -0500)
Quote email address names. Tx Alan Danziger, qmail.

Downloaded from:

  http://web.archive.org/web/20040416224003/http://www.aaronsw.com/2002/rss2email/rss2email-2.25.py

rss2email.py

index 97171772a0184e847dc32e50af9c648c1f2f0035..0556199c68a5e23e975c0e0558e2e6efcd999773 100644 (file)
@@ -12,7 +12,7 @@ Usage: python rss2email.py feedfile action [options]
        list
        delete n
 """
-__version__ = "2.24"
+__version__ = "2.25"
 __author__ = "Aaron Swartz (me@aaronsw.com)"
 __copyright__ = "(C) 2004 Aaron Swartz. GNU GPL 2."
 ___contributors__ = ["Dean Jackson (dino@grorg.org)", 
@@ -69,6 +69,9 @@ def e(obj, val):
        if type(x) is unicode: x = x.encode('utf-8')
        return x.strip()
 
+def quoteEmailName(s):
+       return '"' + s.replace("\\", "\\\\").replace('"', '\\"') + '"'
+
 def getContent(item, url):
        if item.has_key('content') and item['content']:
                for c in item['content']:
@@ -134,7 +137,7 @@ def run():
                c, ert = result['channel'], 'errorreportsto'
                
                headers = "From: "
-               if c.has_key('title'): headers += e(c, 'title') + ' '
+               if c.has_key('title'): headers += quoteEmailName(e(c, 'title')) + ' '
                if c.has_key(ert) and c[ert].startswith('mailto:'):
                        fr = c[ert][8:]
                else: