From: W. Trevor King Date: Fri, 7 Nov 2014 06:08:53 +0000 (-0800) Subject: ssoma-mda: Support name-less From: headers X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4c508c4ad9902e935a65abc840a43acaa91ea061;p=ssoma-mda.git ssoma-mda: Support name-less From: headers For example: >>> email.utils.parseaddr('alice@example.net') ('', 'alice@example.net') Now folks with: From: alice@example.net will be stored in the Git commit as: "alice@example.net" --- diff --git a/ssoma-mda b/ssoma-mda index c5aedf4..99d62b1 100755 --- a/ssoma-mda +++ b/ssoma-mda @@ -220,6 +220,8 @@ def get_author(message): """Create a pygit2.Signature for the message author.""" author_name, author_email = _email_utils.parseaddr( message['From']) + if not author_name: + author_name = author_email.split('@')[0] date = message['Date'] datetime = _email_utils.parsedate_to_datetime(date) time = int(datetime.timestamp())