Fixes checking for video phone details.

cusax-fix
Damian Minkov 13 years ago
parent a5b2b851c5
commit 6a41b2a346

@ -42,6 +42,13 @@ public class MetaContactPhoneUtil
private Hashtable<Contact,List<String>> phones =
new Hashtable<Contact, List<String>>();
/**
* The video phones that have been discovered
* for metacontact child contacts.
*/
private Hashtable<Contact,List<String>> videoPhones =
new Hashtable<Contact, List<String>>();
/**
* True if there is any phone found for the metacontact.
*/
@ -119,6 +126,11 @@ public List<String> getVideoPhones( Contact contact,
return new ArrayList<String>();
}
if(videoPhones.containsKey(contact))
{
return videoPhones.get(contact);
}
List<String> phonesList = ContactPhoneUtil.getContactAdditionalPhones(
contact, listener, true, true);
@ -127,6 +139,8 @@ public List<String> getVideoPhones( Contact contact,
else if (phonesList.size() > 0)
hasVideoDetail = true;
videoPhones.put(contact, phonesList);
return phonesList;
}
@ -180,7 +194,7 @@ else if (phonesList.size() > 0)
public boolean isVideoCallEnabled(DetailsResponseListener listener)
{
// make sure children are checked
if(!checkMetaContactPhones(listener))
if(!checkMetaContactVideoPhones(listener))
return false;
return metaContact.getDefaultContact(
@ -242,7 +256,7 @@ && hasContactCapabilities(contact,
public boolean isDesktopSharingEnabled(DetailsResponseListener listener)
{
// make sure children are checked
if(!checkMetaContactPhones(listener))
if(!checkMetaContactVideoPhones(listener))
return false;
return metaContact.getDefaultContact(
@ -407,7 +421,35 @@ private boolean checkMetaContactPhones(DetailsResponseListener l)
if(phones.containsKey(contact))
continue;
List<String> phones = getPhones(contact, l, true);
List<String> phones = getPhones(contact, l, false);
if(phones == null)
return false;
}
return true;
}
/**
* Checking all contacts for the metacontact.
* Return <tt>false</tt> if there are listeners added for a contact
* and we need to stop executions cause listener will be used to be informed
* for result.
*
* @param l the <tt>DetailsResponseListener</tt> to listen for further
* details
* @return whether to continue or listeners present and will be informed
* for result.
*/
private boolean checkMetaContactVideoPhones(DetailsResponseListener l)
{
Iterator<Contact> contactIterator = metaContact.getContacts();
while(contactIterator.hasNext())
{
Contact contact = contactIterator.next();
if(videoPhones.containsKey(contact))
continue;
List<String> phones = getVideoPhones(contact, l);
if(phones == null)
return false;
}

Loading…
Cancel
Save