aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java
diff options
context:
space:
mode:
authorhristoterezov <hristo@jitsi.org>2013-08-12 18:31:47 +0300
committerhristoterezov <hristo@jitsi.org>2013-08-12 18:31:47 +0300
commit58444fe1e56647115ca73e06e1e1c916eb16f6a6 (patch)
tree6f5b0ce6292a7c8316c38869d0732efed6447bcc /src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java
parent10750b3efd7e2608192077ff85b9f1ceb0010ebc (diff)
downloadjitsi-58444fe1e56647115ca73e06e1e1c916eb16f6a6.zip
jitsi-58444fe1e56647115ca73e06e1e1c916eb16f6a6.tar.gz
jitsi-58444fe1e56647115ca73e06e1e1c916eb16f6a6.tar.bz2
Adds chat room password to saved passwords form.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java')
-rw-r--r--src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java
index bd6aed2..e85dced 100644
--- a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java
+++ b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java
@@ -303,6 +303,62 @@ public class SecurityConfigActivator
}
/**
+ * Finds all chat rooms with saved encrypted passwords.
+ *
+ * @return a {@link List} with the saved encrypted
+ * password.
+ */
+ public static Map<String, String> getChatRoomsWithSavedPasswords()
+ {
+ Map<?, ProtocolProviderFactory> providerFactoriesMap
+ = getProtocolProviderFactories();
+
+ if (providerFactoriesMap == null)
+ return null;
+
+ CredentialsStorageService credentialsStorageService
+ = getCredentialsStorageService();
+
+ Map<String, String> chatRoomIDs = new HashMap<String, String>();
+ String prefix = "net.java.sip.communicator.impl.gui.accounts";
+ List<String> accounts = getConfigurationService()
+ .getPropertyNamesByPrefix(prefix, true);
+
+ for (ProtocolProviderFactory providerFactory
+ : providerFactoriesMap.values())
+ {
+ for (AccountID accountID : providerFactory.getRegisteredAccounts())
+ {
+ for (String accountRootPropName : accounts)
+ {
+ String accountName
+ = getConfigurationService().getString(accountRootPropName);
+
+ if(!accountID.getAccountUniqueID().equals(accountName))
+ continue;
+
+ List<String> chatRooms = getConfigurationService()
+ .getPropertyNamesByPrefix(
+ accountRootPropName + ".chatRooms", true);
+
+ for (String chatRoomPropName : chatRooms)
+ {
+ String chatRoomName = getConfigurationService()
+ .getString(chatRoomPropName);
+ if (credentialsStorageService.isStoredEncrypted(
+ chatRoomPropName + ".password"))
+ chatRoomIDs.put(chatRoomName + " " + resources
+ .getI18NString("service.gui.VIA") + " "
+ + accountID.getUserID(), chatRoomPropName
+ + ".password");
+ }
+ }
+ }
+ }
+ return chatRoomIDs;
+ }
+
+ /**
* @return a String containing the package name of the concrete factory
* class that extends the abstract factory.
*/