aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol/AccountManager.java
diff options
context:
space:
mode:
authorpaweldomas <pawel.domas@jitsi.org>2013-06-10 18:16:48 +0200
committerpaweldomas <pawel.domas@jitsi.org>2013-06-10 18:16:48 +0200
commit03af0f5b4ecdd8817908e9bee88df686596f8706 (patch)
tree1a2836677e24de16f7f2969e1ea4a29efe197c15 /src/net/java/sip/communicator/service/protocol/AccountManager.java
parentc4a62a0f1840f279f533522152fe32691bee318d (diff)
downloadjitsi-03af0f5b4ecdd8817908e9bee88df686596f8706.zip
jitsi-03af0f5b4ecdd8817908e9bee88df686596f8706.tar.gz
jitsi-03af0f5b4ecdd8817908e9bee88df686596f8706.tar.bz2
Fixes bug with additional STUN servers and Jingle Nodes not being removed after Jabber account is edited
Diffstat (limited to 'src/net/java/sip/communicator/service/protocol/AccountManager.java')
-rw-r--r--src/net/java/sip/communicator/service/protocol/AccountManager.java70
1 files changed, 45 insertions, 25 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/AccountManager.java b/src/net/java/sip/communicator/service/protocol/AccountManager.java
index e6e76ee..02c044a 100644
--- a/src/net/java/sip/communicator/service/protocol/AccountManager.java
+++ b/src/net/java/sip/communicator/service/protocol/AccountManager.java
@@ -247,7 +247,7 @@ public class AccountManager
* @param factory the factory which package will be returned.
* @return the package name of the <tt>factory</tt>.
*/
- private String getFactoryImplPackageName(ProtocolProviderFactory factory)
+ public String getFactoryImplPackageName(ProtocolProviderFactory factory)
{
String className = factory.getClass().getName();
@@ -660,30 +660,7 @@ public class AccountManager
= ProtocolProviderActivator.getConfigurationService();
String factoryPackage = getFactoryImplPackageName(factory);
- // First check if such accountID already exists in the configuration.
- List<String> storedAccounts =
- configurationService.getPropertyNamesByPrefix(factoryPackage, true);
- String accountUID = accountID.getAccountUniqueID();
- String accountNodeName = null;
-
- for (Iterator<String> storedAccountIter = storedAccounts.iterator();
- storedAccountIter.hasNext();)
- {
- String storedAccount = storedAccountIter.next();
-
- // If the property is not related to an account we skip it.
- int dotIndex = storedAccount.lastIndexOf(".");
- if (!storedAccount.substring(dotIndex + 1)
- .startsWith(ACCOUNT_UID_PREFIX))
- continue;
-
- String storedAccountUID =
- configurationService.getString(storedAccount + "."
- + ProtocolProviderFactory.ACCOUNT_UID);
-
- if (storedAccountUID.equals(accountUID))
- accountNodeName = configurationService.getString(storedAccount);
- }
+ String accountNodeName = getAccountNodeName(factory, accountID);
Map<String, Object> configurationProperties
= new HashMap<String, Object>();
@@ -783,6 +760,49 @@ public class AccountManager
}
/**
+ * Gets account node name under which account configuration properties are
+ * stored.
+ *
+ * @param factory account's protocol provider factory
+ * @param accountID account for which the prefix will be returned
+ * @return configuration prefix for given <tt>accountID</tt> if exists or
+ * <tt>null</tt> otherwise
+ */
+ public String getAccountNodeName( ProtocolProviderFactory factory,
+ AccountID accountID )
+ {
+ ConfigurationService configurationService
+ = ProtocolProviderActivator.getConfigurationService();
+ String factoryPackage = getFactoryImplPackageName(factory);
+
+ // First check if such accountID already exists in the configuration.
+ List<String> storedAccounts =
+ configurationService.getPropertyNamesByPrefix(factoryPackage, true);
+ String accountUID = accountID.getAccountUniqueID();
+ String accountNodeName = null;
+
+ for (Iterator<String> storedAccountIter = storedAccounts.iterator();
+ storedAccountIter.hasNext();)
+ {
+ String storedAccount = storedAccountIter.next();
+
+ // If the property is not related to an account we skip it.
+ int dotIndex = storedAccount.lastIndexOf(".");
+ if (!storedAccount.substring(dotIndex + 1)
+ .startsWith(ACCOUNT_UID_PREFIX))
+ continue;
+
+ String storedAccountUID
+ = configurationService.getString(
+ storedAccount + "." + ProtocolProviderFactory.ACCOUNT_UID);
+
+ if (storedAccountUID.equals(accountUID))
+ accountNodeName = configurationService.getString(storedAccount);
+ }
+ return accountNodeName;
+ }
+
+ /**
* Removes the account with <tt>accountID</tt> from the set of accounts
* that are persistently stored inside the configuration service.
*