From: Aaron Swartz Date: Fri, 30 Jan 2004 12:02:00 +0000 (+0000) Subject: Add rss2email v2.25 X-Git-Tag: v2.25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b265136f00fb4233476fa11678a66c2dc19cfd9b;p=rss2email.git Add rss2email v2.25 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 --- diff --git a/rss2email.py b/rss2email.py index 9717177..0556199 100644 --- a/rss2email.py +++ b/rss2email.py @@ -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: