Commit 9889da8a authored by Luci Stanescu's avatar Luci Stanescu

Fixed normalization of phone numbers to only apply to phone numbers

parent 11b4749b
...@@ -1674,6 +1674,7 @@ class SessionManager(object): ...@@ -1674,6 +1674,7 @@ class SessionManager(object):
implements(IObserver) implements(IObserver)
number_strip_re = re.compile(r'\(\s?0\s?\)|[-() ]') number_strip_re = re.compile(r'\(\s?0\s?\)|[-() ]')
number_re = re.compile(r'^\+?[-\d\s()]+$')
def __init__(self): def __init__(self):
self.main_window = None self.main_window = None
...@@ -1782,9 +1783,10 @@ class SessionManager(object): ...@@ -1782,9 +1783,10 @@ class SessionManager(object):
@classmethod @classmethod
def normalize_number(cls, account, address): def normalize_number(cls, account, address):
address = cls.number_strip_re.sub('', address) if cls.number_re.match(address):
if isinstance(account, Account) and account.pstn.idd_prefix is not None: address = cls.number_strip_re.sub('', address)
address = re.sub(r'^\+', account.pstn.idd_prefix, address) if isinstance(account, Account) and account.pstn.idd_prefix is not None:
address = re.sub(r'^\+', account.pstn.idd_prefix, address)
return address return address
def _remove_session(self, session): def _remove_session(self, session):
......
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