contacts.py: get_contact_from_full_jid not to raise exceptions on bare jids
This commit is contained in:
parent
6995730808
commit
976cd12eef
1 changed files with 6 additions and 2 deletions
|
@ -236,8 +236,12 @@ class Contacts:
|
||||||
def get_contact_from_full_jid(self, account, jid):
|
def get_contact_from_full_jid(self, account, jid):
|
||||||
'''we will split the jid into bare jid and resource part,
|
'''we will split the jid into bare jid and resource part,
|
||||||
then get proper contact.'''
|
then get proper contact.'''
|
||||||
|
try:
|
||||||
barejid, resource=jid.split('/',1)
|
barejid, resource=jid.split('/',1)
|
||||||
return self.get_contact(account, barejid, resource)
|
return self.get_contact(account, barejid, resource)
|
||||||
|
except ValueError: # no resource causes split to fail
|
||||||
|
return None # how to handle that case?
|
||||||
|
|
||||||
def get_highest_prio_contact_from_contacts(self, contacts):
|
def get_highest_prio_contact_from_contacts(self, contacts):
|
||||||
if not contacts:
|
if not contacts:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Reference in a new issue