From 976cd12eefc5ab1feecd8ee825d24e86f19622d9 Mon Sep 17 00:00:00 2001 From: Tomasz Melcer Date: Wed, 27 Jun 2007 23:26:07 +0000 Subject: [PATCH] contacts.py: get_contact_from_full_jid not to raise exceptions on bare jids --- src/common/contacts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/contacts.py b/src/common/contacts.py index deed88d9f..f9fc4d020 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -236,8 +236,12 @@ class Contacts: def get_contact_from_full_jid(self, account, jid): '''we will split the jid into bare jid and resource part, then get proper contact.''' - barejid, resource=jid.split('/',1) - return self.get_contact(account, barejid, resource) + try: + barejid, resource=jid.split('/',1) + 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): if not contacts: return None