diff options
author | francis <francis> | 2009-05-21 01:18:45 +0000 |
---|---|---|
committer | francis <francis> | 2009-05-21 01:18:45 +0000 |
commit | b45669edf781a7cd59609a25d4f9b33e664af26e (patch) | |
tree | 01bf20f0ce25e5c7b85a69c2f214c352fc9b3bb9 /lib | |
parent | 03b6c1f0ff9072878d730d5a5da75db066db1dc9 (diff) |
Apply censor rules to names from incoming emails.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tmail_extensions.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/tmail_extensions.rb b/lib/tmail_extensions.rb index 711463050..66bf8bab1 100644 --- a/lib/tmail_extensions.rb +++ b/lib/tmail_extensions.rb @@ -4,7 +4,7 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: tmail_extensions.rb,v 1.3 2009-04-08 07:31:08 francis Exp $ +# $Id: tmail_extensions.rb,v 1.4 2009-05-21 01:18:45 francis Exp $ # Monkeypatch! @@ -35,9 +35,12 @@ module TMail # Monkeypatch! Constructor which makes a TMail::Address given # a name and an email def Address.address_from_name_and_email(name, email) + if name.nil? + return TMail::Address.parse(email) + end # Botch an always quoted RFC address, then parse it name = name.gsub(/(["\\])/, "\\\\\\1") - TMail::Address.parse('"' + name + '" <' + email + '>') + return TMail::Address.parse('"' + name + '" <' + email + '>') end end |