# HG changeset patch # User souliane # Date 1449046634 -3600 # Node ID 0b4c1f6ada52891ce68573d819991e4ca3823db8 # Parent 0d972af37ff543cdcd34fc795789fc5035b23aec stdui (contact_list): use jid.JID to check the JID instead of an approximative regex diff -r 0d972af37ff5 -r 0b4c1f6ada52 src/stdui/ui_contact_list.py --- a/src/stdui/ui_contact_list.py Wed Dec 02 09:10:58 2015 +0100 +++ b/src/stdui/ui_contact_list.py Wed Dec 02 09:57:14 2015 +0100 @@ -224,7 +224,9 @@ @return dict """ contact_jid_s = data[xml_tools.formEscape('contact_jid')] - if not re.match(r'^.+@.+\..+', contact_jid_s, re.IGNORECASE): + try: + contact_jid = jid.JID(contact_jid_s) + except (RuntimeError, jid.InvalidFormat, AttributeError): # TODO: replace '\t' by a constant (see tools.xmlui.XMLUI.onFormSubmitted) data['selected_groups'] = data[xml_tools.formEscape('groups_list')].split('\t') options = {'id': self.__add_id, @@ -232,7 +234,6 @@ 'contact_text': D_('Please enter a valid JID (like "contact@%s"):') % self.default_host, } return self.getDialogXMLUI(options, data, profile) - contact_jid = jid.JID(contact_jid_s) self.host.addContact(contact_jid, profile_key=profile) return self._updateContact(data, profile) # after adding, updating