From b265136f00fb4233476fa11678a66c2dc19cfd9b Mon Sep 17 00:00:00 2001 From: Aaron Swartz Date: Fri, 30 Jan 2004 12:02:00 +0000 Subject: [PATCH] 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 --- rss2email.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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: -- 2.26.2