|
|
|
@ -11,7 +11,7 @@
|
|
|
|
import net.java.sip.communicator.service.credentialsstorage.*;
|
|
|
|
import net.java.sip.communicator.service.credentialsstorage.*;
|
|
|
|
import net.java.sip.communicator.service.protocol.event.*;
|
|
|
|
import net.java.sip.communicator.service.protocol.event.*;
|
|
|
|
import net.java.sip.communicator.util.*;
|
|
|
|
import net.java.sip.communicator.util.*;
|
|
|
|
import net.java.sip.communicator.util.Base64; // disambiguation
|
|
|
|
import net.java.sip.communicator.util.Base64;
|
|
|
|
|
|
|
|
|
|
|
|
import org.jitsi.service.configuration.*;
|
|
|
|
import org.jitsi.service.configuration.*;
|
|
|
|
import org.osgi.framework.*;
|
|
|
|
import org.osgi.framework.*;
|
|
|
|
@ -20,7 +20,7 @@
|
|
|
|
* Represents an implementation of <tt>AccountManager</tt> which loads the
|
|
|
|
* Represents an implementation of <tt>AccountManager</tt> which loads the
|
|
|
|
* accounts in a separate thread.
|
|
|
|
* accounts in a separate thread.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Lubomir Marinov
|
|
|
|
* @author Lyubomir Marinov
|
|
|
|
* @author Yana Stamcheva
|
|
|
|
* @author Yana Stamcheva
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class AccountManager
|
|
|
|
public class AccountManager
|
|
|
|
@ -286,35 +286,37 @@ public boolean hasStoredAccount(String protocolName,
|
|
|
|
boolean includeHidden,
|
|
|
|
boolean includeHidden,
|
|
|
|
String userID)
|
|
|
|
String userID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ServiceReference[] factoryRefs = null;
|
|
|
|
Collection<ServiceReference<ProtocolProviderFactory>> factoryRefs;
|
|
|
|
boolean hasStoredAccounts = false;
|
|
|
|
boolean hasStoredAccounts = false;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
factoryRefs
|
|
|
|
factoryRefs
|
|
|
|
= bundleContext.getServiceReferences(
|
|
|
|
= bundleContext.getServiceReferences(
|
|
|
|
ProtocolProviderFactory.class.getName(), null);
|
|
|
|
ProtocolProviderFactory.class,
|
|
|
|
|
|
|
|
null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (InvalidSyntaxException ex)
|
|
|
|
catch (InvalidSyntaxException ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
factoryRefs = null;
|
|
|
|
logger.error(
|
|
|
|
logger.error(
|
|
|
|
"Failed to retrieve the registered ProtocolProviderFactories",
|
|
|
|
"Failed to retrieve the registered ProtocolProviderFactories",
|
|
|
|
ex);
|
|
|
|
ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((factoryRefs != null) && (factoryRefs.length > 0))
|
|
|
|
if ((factoryRefs != null) && !factoryRefs.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ConfigurationService configService
|
|
|
|
ConfigurationService configService
|
|
|
|
= ProtocolProviderActivator.getConfigurationService();
|
|
|
|
= ProtocolProviderActivator.getConfigurationService();
|
|
|
|
|
|
|
|
|
|
|
|
for (ServiceReference factoryRef : factoryRefs)
|
|
|
|
for (ServiceReference<ProtocolProviderFactory> factoryRef
|
|
|
|
|
|
|
|
: factoryRefs)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ProtocolProviderFactory factory
|
|
|
|
ProtocolProviderFactory factory
|
|
|
|
= (ProtocolProviderFactory)
|
|
|
|
= bundleContext.getService(factoryRef);
|
|
|
|
bundleContext.getService(factoryRef);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((protocolName != null)
|
|
|
|
if ((protocolName != null)
|
|
|
|
&& !protocolName.equals(factory.getProtocolName()))
|
|
|
|
&& !protocolName.equals(factory.getProtocolName()))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -397,31 +399,33 @@ else if(userID == null)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public AccountID findAccountID(String uid)
|
|
|
|
public AccountID findAccountID(String uid)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ServiceReference[] factoryRefs = null;
|
|
|
|
Collection<ServiceReference<ProtocolProviderFactory>> factoryRefs;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
factoryRefs
|
|
|
|
factoryRefs
|
|
|
|
= bundleContext.getServiceReferences(
|
|
|
|
= bundleContext.getServiceReferences(
|
|
|
|
ProtocolProviderFactory.class.getName(), null);
|
|
|
|
ProtocolProviderFactory.class,
|
|
|
|
|
|
|
|
null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (InvalidSyntaxException ex)
|
|
|
|
catch (InvalidSyntaxException ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
factoryRefs = null;
|
|
|
|
logger.error(
|
|
|
|
logger.error(
|
|
|
|
"Failed to retrieve the registered ProtocolProviderFactories",
|
|
|
|
"Failed to retrieve the registered ProtocolProviderFactories",
|
|
|
|
ex);
|
|
|
|
ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((factoryRefs != null) && (factoryRefs.length > 0))
|
|
|
|
if ((factoryRefs != null) && !factoryRefs.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ConfigurationService configService
|
|
|
|
ConfigurationService configService
|
|
|
|
= ProtocolProviderActivator.getConfigurationService();
|
|
|
|
= ProtocolProviderActivator.getConfigurationService();
|
|
|
|
|
|
|
|
|
|
|
|
for (ServiceReference factoryRef : factoryRefs)
|
|
|
|
for (ServiceReference<ProtocolProviderFactory> factoryRef
|
|
|
|
|
|
|
|
: factoryRefs)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ProtocolProviderFactory factory
|
|
|
|
ProtocolProviderFactory factory
|
|
|
|
= (ProtocolProviderFactory)
|
|
|
|
= bundleContext.getService(factoryRef);
|
|
|
|
bundleContext.getService(factoryRef);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String factoryPackage = getFactoryImplPackageName(factory);
|
|
|
|
String factoryPackage = getFactoryImplPackageName(factory);
|
|
|
|
List<String> storedAccountsProps
|
|
|
|
List<String> storedAccountsProps
|
|
|
|
@ -508,8 +512,8 @@ public void run()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
loadStoredAccountsThread.setDaemon(true);
|
|
|
|
loadStoredAccountsThread.setDaemon(true);
|
|
|
|
loadStoredAccountsThread
|
|
|
|
loadStoredAccountsThread.setName(
|
|
|
|
.setName("AccountManager.loadStoredAccounts");
|
|
|
|
"AccountManager.loadStoredAccounts");
|
|
|
|
loadStoredAccountsThread.start();
|
|
|
|
loadStoredAccountsThread.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1022,15 +1026,15 @@ public void unloadAccount(AccountID accountID)
|
|
|
|
accountID.getProtocolName());
|
|
|
|
accountID.getProtocolName());
|
|
|
|
|
|
|
|
|
|
|
|
// Obtain the protocol provider.
|
|
|
|
// Obtain the protocol provider.
|
|
|
|
ServiceReference serRef
|
|
|
|
ServiceReference<ProtocolProviderService> serRef
|
|
|
|
= providerFactory.getProviderForAccount(accountID);
|
|
|
|
= providerFactory.getProviderForAccount(accountID);
|
|
|
|
|
|
|
|
|
|
|
|
// If there's no such provider we have nothing to do here.
|
|
|
|
// If there's no such provider we have nothing to do here.
|
|
|
|
if (serRef == null)
|
|
|
|
if (serRef == null)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
ProtocolProviderService protocolProvider =
|
|
|
|
ProtocolProviderService protocolProvider
|
|
|
|
(ProtocolProviderService) bundleContext.getService(serRef);
|
|
|
|
= bundleContext.getService(serRef);
|
|
|
|
|
|
|
|
|
|
|
|
// Set the account icon path for unloaded accounts.
|
|
|
|
// Set the account icon path for unloaded accounts.
|
|
|
|
String iconPathProperty = accountID.getAccountPropertyString(
|
|
|
|
String iconPathProperty = accountID.getAccountPropertyString(
|
|
|
|
|