Fixes searching for cusax capable provider.

sipgateway 5292
Damian Minkov 11 years ago
parent e0887ceb8e
commit c0c8d8d1ab

@ -1461,24 +1461,32 @@ public static String getPeerDisplayName(CallPeer peer,
= AccountUtils.getRegisteredProviders( = AccountUtils.getRegisteredProviders(
OperationSetCusaxUtils.class); OperationSetCusaxUtils.class);
if (cusaxProviders != null && cusaxProviders.size() > 0) if (cusaxProviders != null && cusaxProviders.size() > 0)
{
Iterator<ProtocolProviderService> iter
= cusaxProviders.iterator();
while(iter.hasNext())
{ {
Contact contact = getPeerContact( Contact contact = getPeerContact(
peer, peer,
cusaxProviders.iterator().next(), iter.next(),
imppAddress); imppAddress);
displayName = (contact != null) displayName = (contact != null)
? contact.getDisplayName() : null; ? contact.getDisplayName() : null;
}
else
{
MetaContact metaContact
= getPeerMetaContact(peer, imppAddress);
displayName = (metaContact != null) if(!StringUtils.isNullOrEmpty(displayName, true))
? metaContact.getDisplayName() : null; break;
} }
}
else
{
MetaContact metaContact
= getPeerMetaContact(peer, imppAddress);
displayName = (metaContact != null)
? metaContact.getDisplayName() : null;
}
} }
} }
@ -1561,12 +1569,21 @@ public static byte[] getPeerImage(CallPeer peer)
if (cusaxProviders != null && cusaxProviders.size() > 0) if (cusaxProviders != null && cusaxProviders.size() > 0)
{ {
Contact contact = getPeerContact( Iterator<ProtocolProviderService> iter
peer, = cusaxProviders.iterator();
cusaxProviders.iterator().next(), while(iter.hasNext())
imppAddress); {
Contact contact = getPeerContact(
peer,
iter.next(),
imppAddress);
image = (contact != null) ? getContactImage(contact) : null; image = (contact != null) ?
getContactImage(contact) : null;
if(image != null)
break;
}
} }
else else
{ {
@ -1648,19 +1665,23 @@ else if(uiContact.getDescriptor() instanceof SourceContact)
if (cusaxProviders != null && cusaxProviders.size() > 0) if (cusaxProviders != null && cusaxProviders.size() > 0)
{ {
ProtocolProviderService cusaxProvider Iterator<ProtocolProviderService> iter
= cusaxProviders.iterator().next(); = cusaxProviders.iterator();
while(iter.hasNext())
{
ProtocolProviderService cusaxProvider = iter.next();
Contact contact = getPeerContact( Contact contact = getPeerContact(
peer, peer,
cusaxProvider, cusaxProvider,
imppAddress); imppAddress);
if(contact != null if(contact != null
&& cusaxProvider.getOperationSet( && cusaxProvider.getOperationSet(
OperationSetBasicInstantMessaging.class) != null) OperationSetBasicInstantMessaging.class) != null)
{ {
return contact; return contact;
}
} }
} }
} }
@ -1809,7 +1830,7 @@ private static byte[] getContactImage(Contact contact)
} }
/** /**
* Returns the image for the given <tt>alternativePeerAddress</tt> by * Returns the peer contact for the given <tt>alternativePeerAddress</tt> by
* checking the if the <tt>callPeer</tt> exists as a detail in the given * checking the if the <tt>callPeer</tt> exists as a detail in the given
* <tt>cusaxProvider</tt>. * <tt>cusaxProvider</tt>.
* *
@ -1897,24 +1918,32 @@ else if(uiContact.getDescriptor() instanceof SourceContact)
? imppAddress.substring(protocolPartIndex + 1) ? imppAddress.substring(protocolPartIndex + 1)
: imppAddress; : imppAddress;
Collection<ProtocolProviderService> cusaxProviders Collection<ProtocolProviderService> cusaxProviders
= AccountUtils.getRegisteredProviders( = AccountUtils.getRegisteredProviders(
OperationSetCusaxUtils.class); OperationSetCusaxUtils.class);
if (cusaxProviders != null && cusaxProviders.size() > 0) if (cusaxProviders != null && cusaxProviders.size() > 0)
{
Iterator<ProtocolProviderService> iter
= cusaxProviders.iterator();
while(iter.hasNext())
{ {
Contact contact = getPeerContact( Contact contact = getPeerContact(
peer, peer,
cusaxProviders.iterator().next(), iter.next(),
imppAddress); imppAddress);
return GuiActivator.getContactListService() MetaContact res = GuiActivator.getContactListService()
.findMetaContactByContact(contact); .findMetaContactByContact(contact);
if(res != null)
return res;
} }
else }
{ else
return getPeerMetaContact(peer, imppAddress); {
} return getPeerMetaContact(peer, imppAddress);
}
} }
return null; return null;

Loading…
Cancel
Save