Fixes problem with calling address book contacts. Reported by Emil Ivov on dev (01/09/2011 subject: Re: [sip-comm-dev] A few issues with Apple's Address Book support).

cusax-fix
Yana Stamcheva 15 years ago
parent 4c65f7c6ab
commit fdf5c4fc89

@ -290,6 +290,86 @@ public static ProtocolProviderService getRegisteredProviderForAccount(
return null;
}
/**
* Returns a list of all currently registered telephony providers for the
* given protocol name.
* @param protocolName the protocol name
* @param operationSetClass the operation set class for which we're looking
* for providers
* @return a list of all currently registered providers for the given
* <tt>protocolName</tt> and supporting the given <tt>operationSetClass</tt>
*/
public static List<ProtocolProviderService> getRegisteredProviders(
String protocolName, Class<? extends OperationSet> operationSetClass)
{
List<ProtocolProviderService> opSetProviders
= new LinkedList<ProtocolProviderService>();
ProtocolProviderFactory providerFactory
= GuiActivator.getProtocolProviderFactory(protocolName);
if (providerFactory != null)
{
ServiceReference serRef;
ProtocolProviderService protocolProvider;
for (AccountID accountID : providerFactory.getRegisteredAccounts())
{
serRef = providerFactory.getProviderForAccount(accountID);
protocolProvider
= (ProtocolProviderService) GuiActivator.bundleContext
.getService(serRef);
if (protocolProvider.getOperationSet(operationSetClass) != null
&& protocolProvider.isRegistered())
{
opSetProviders.add(protocolProvider);
}
}
}
return opSetProviders;
}
/**
* Returns a list of all currently registered providers, which support the
* given <tt>operationSetClass</tt>.
*
* @param opSetClass the operation set class for which we're looking
* for providers
* @return a list of all currently registered providers, which support the
* given <tt>operationSetClass</tt>
*/
public static List<ProtocolProviderService> getRegisteredProviders(
Class<? extends OperationSet> opSetClass)
{
List<ProtocolProviderService> opSetProviders
= new LinkedList<ProtocolProviderService>();
for (ProtocolProviderFactory providerFactory : GuiActivator
.getProtocolProviderFactories().values())
{
ServiceReference serRef;
ProtocolProviderService protocolProvider;
for (AccountID accountID : providerFactory.getRegisteredAccounts())
{
serRef = providerFactory.getProviderForAccount(accountID);
protocolProvider
= (ProtocolProviderService) GuiActivator.bundleContext
.getService(serRef);
if (protocolProvider.getOperationSet(opSetClass) != null
&& protocolProvider.isRegistered())
{
opSetProviders.add(protocolProvider);
}
}
}
return opSetProviders;
}
/**
* Returns the <tt>AccountManager</tt> obtained from the bundle context.
* @return the <tt>AccountManager</tt> obtained from the bundle context

@ -630,73 +630,8 @@ private static CallPanel openCallContainer(Call call)
*/
public static List<ProtocolProviderService> getTelephonyProviders()
{
List<ProtocolProviderService> telephonyProviders
= new LinkedList<ProtocolProviderService>();
for (ProtocolProviderFactory providerFactory : GuiActivator
.getProtocolProviderFactories().values())
{
ServiceReference serRef;
ProtocolProviderService protocolProvider;
for (AccountID accountID : providerFactory.getRegisteredAccounts())
{
serRef = providerFactory.getProviderForAccount(accountID);
protocolProvider
= (ProtocolProviderService) GuiActivator.bundleContext
.getService(serRef);
if (protocolProvider.getOperationSet(
OperationSetBasicTelephony.class) != null
&& protocolProvider.isRegistered())
{
telephonyProviders.add(protocolProvider);
}
}
}
return telephonyProviders;
}
/**
* Returns a list of all currently registered telephony providers for the
* given protocol name.
* @param protocolName the protocol name
* @param operationSetClass the operation set class for which we're looking
* for providers
* @return a list of all currently registered providers for the given
* <tt>protocolName</tt> and supporting the given <tt>operationSetClass</tt>
*/
public static List<ProtocolProviderService> getRegisteredProviders(
String protocolName, Class<? extends OperationSet> operationSetClass)
{
List<ProtocolProviderService> telephonyProviders
= new LinkedList<ProtocolProviderService>();
ProtocolProviderFactory providerFactory
= GuiActivator.getProtocolProviderFactory(protocolName);
if (providerFactory != null)
{
ServiceReference serRef;
ProtocolProviderService protocolProvider;
for (AccountID accountID : providerFactory.getRegisteredAccounts())
{
serRef = providerFactory.getProviderForAccount(accountID);
protocolProvider
= (ProtocolProviderService) GuiActivator.bundleContext
.getService(serRef);
if (protocolProvider.getOperationSet(operationSetClass) != null
&& protocolProvider.isRegistered())
{
telephonyProviders.add(protocolProvider);
}
}
}
return telephonyProviders;
return GuiActivator
.getRegisteredProviders(OperationSetBasicTelephony.class);
}
/**

@ -853,8 +853,9 @@ private void call(TreeNode treeNode)
else
{
protocolName = preferredProvider.getProtocolName();
providers = CallManager.getRegisteredProviders(protocolName,
OperationSetBasicTelephony.class);
providers
= GuiActivator.getRegisteredProviders(protocolName,
OperationSetBasicTelephony.class);
}
}
// If we don't have a preferred provider we try to obtain a
@ -863,9 +864,16 @@ private void call(TreeNode treeNode)
{
protocolName = detail
.getPreferredProtocol(OperationSetBasicTelephony.class);
providers
= CallManager.getRegisteredProviders(protocolName,
OperationSetBasicTelephony.class);
if (protocolName != null)
providers
= GuiActivator.getRegisteredProviders(protocolName,
OperationSetBasicTelephony.class);
// If the protocol name is null we simply obtain all telephony
// providers.
else
providers
= CallManager.getTelephonyProviders();
}
// If our call didn't succeed, try to call through one of the other
@ -950,7 +958,7 @@ private void callVideo(TreeNode treeNode)
else
{
protocolName = preferredProvider.getProtocolName();
providers = CallManager.getRegisteredProviders(protocolName,
providers = GuiActivator.getRegisteredProviders(protocolName,
OperationSetVideoTelephony.class);
}
}
@ -960,9 +968,15 @@ private void callVideo(TreeNode treeNode)
{
protocolName = detail
.getPreferredProtocol(OperationSetVideoTelephony.class);
providers
= CallManager.getRegisteredProviders(protocolName,
OperationSetVideoTelephony.class);
if (protocolName != null)
providers
= GuiActivator.getRegisteredProviders(protocolName,
OperationSetVideoTelephony.class);
else
providers
= GuiActivator.getRegisteredProviders(
OperationSetVideoTelephony.class);
}
// If our call didn't succeed, try to call through one of the other
@ -1051,8 +1065,9 @@ private void shareDesktop(TreeNode treeNode)
else
{
protocolName = preferredProvider.getProtocolName();
providers = CallManager.getRegisteredProviders(protocolName,
OperationSetDesktopSharingServer.class);
providers
= GuiActivator.getRegisteredProviders(protocolName,
OperationSetDesktopSharingServer.class);
}
}
// If we don't have a preferred provider we try to obtain a
@ -1061,9 +1076,15 @@ private void shareDesktop(TreeNode treeNode)
{
protocolName = detail.getPreferredProtocol(
OperationSetDesktopSharingServer.class);
providers
= CallManager.getRegisteredProviders(protocolName,
OperationSetDesktopSharingServer.class);
if (protocolName != null)
providers
= GuiActivator.getRegisteredProviders(protocolName,
OperationSetDesktopSharingServer.class);
else
providers
= GuiActivator.getRegisteredProviders(
OperationSetDesktopSharingServer.class);
}
// If our call didn't succeed, try to call through one of the other

Loading…
Cancel
Save