From: Tomi Ollila <tomi.ollila@iki.fi>
Date: Fri, 24 Aug 2012 17:29:21 +0000 (+0300)
Subject: contrib/nmbug/nmbug-status: if realname empty, use part of mailaddr
X-Git-Tag: 0.15_rc1~259
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=6b47e2223d1d21cde34d2f53ede2209f932e7c09;p=notmuch-old

contrib/nmbug/nmbug-status: if realname empty, use part of mailaddr

When the From: field in patch email does not contain 'realname'
field, the patch listing does not show anything as patch sender.
In this case use the part before '@' in mail address as the sender
identification in patch listing.
---

diff --git a/contrib/nmbug/nmbug-status b/contrib/nmbug/nmbug-status
index f37ee84b..9a334ccc 100755
--- a/contrib/nmbug/nmbug-status
+++ b/contrib/nmbug/nmbug-status
@@ -90,7 +90,9 @@ def print_view(title, query, comment):
                 val = str.join(' ', val.split(None)[1:4])
                 val = str(datetime.datetime.strptime(val, '%d %b %Y').date())
             elif header == 'from':
-                val = rfc822.parseaddr(val)[0]
+                (val, addr) = rfc822.parseaddr(val)
+                if val == '':
+                    val = addr.split('@')[0]
 
             if last[header] == val:
                 out[header] = ''