Detecting matrix addresses

main
Bob Mottram 2024-08-15 22:34:19 +01:00
parent 2235046bc4
commit a4fd7cb0de
1 changed files with 5 additions and 3 deletions

View File

@ -31,6 +31,9 @@ def get_matrix_address(actor_json: {}) -> str:
if not name_value_lower.startswith('matrix'): if not name_value_lower.startswith('matrix'):
if not name_value_lower.startswith('chat'): if not name_value_lower.startswith('chat'):
continue continue
if 'xmpp' in name_value_lower or \
'jabber' in name_value_lower:
continue
if not property_value.get('type'): if not property_value.get('type'):
continue continue
prop_value_name, _ = \ prop_value_name, _ = \
@ -48,8 +51,7 @@ def get_matrix_address(actor_json: {}) -> str:
address_text = address_text.split('matrix')[1] address_text = address_text.split('matrix')[1]
elif 'Matrix' in address_text: elif 'Matrix' in address_text:
address_text = address_text.split('Matrix')[1] address_text = address_text.split('Matrix')[1]
if '@' not in address_text: if '@' in address_text:
continue
address_text = '@' + address_text.split('@', 1)[1] address_text = '@' + address_text.split('@', 1)[1]
if ' ' in address_text: if ' ' in address_text:
address_text = address_text.split(' ')[0] address_text = address_text.split(' ')[0]