Commit b00728a0 authored by Saul Ibarra's avatar Saul Ibarra

Fixed setting display name in history entry when URI is a phone number

parent 994b6fce
......@@ -101,15 +101,15 @@ class HistoryEntry(object):
duration = None
remote_identity = session.remote_identity
remote_uri = '%s@%s' % (remote_identity.uri.user, remote_identity.uri.host)
match = cls.phone_number_re.match(remote_uri)
if match:
remote_uri = match.group('number')
try:
contact = next(contact for contact in AddressbookManager().get_contacts() if remote_uri in (addr.uri for addr in contact.uris))
except StopIteration:
display_name = remote_identity.display_name
else:
display_name = contact.name
match = cls.phone_number_re.match(remote_uri)
if match:
remote_uri = match.group('number')
if display_name and display_name != remote_uri:
remote_identity = '%s <%s>' % (display_name, remote_uri)
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment