Commit 3cb4f90b authored by Saul Ibarra's avatar Saul Ibarra

Strip URI domain in history if URI looks like a phone number

parent 5949d611
......@@ -3,6 +3,7 @@
__all__ = ['HistoryManager']
import re
import cPickle as pickle
from application.notification import IObserver, NotificationCenter
......@@ -105,6 +106,9 @@ class HistoryEntry(object):
display_name = remote_identity.display_name
else:
display_name = contact.name
m = phone_number_re.match(remote_uri_str)
if m:
remote_uri_str = m.group('number')
if display_name:
remote_identity_str = '%s <%s>' % (display_name, remote_uri_str)
else:
......@@ -128,6 +132,8 @@ class HistoryEntry(object):
return u'%s%s%s%s' % (self.remote_identity, time, duration, reason)
phone_number_re = re.compile(r'^(?P<number>(00|\+)[1-9]\d{4,14})@')
def format_date(dt):
now = datetime.now()
delta = now - dt
......
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