diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index b6ca141ef..eb2bdc3b2 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -125,6 +125,7 @@ service.gui.CHAT_ROOM_OPTIONS=Chat room options service.gui.CHAT_ROOM_REGISTRATION_REQUIRED=The {0} chat room requires registration to be joined. service.gui.CHAT_ROOM_REQUIRES_PASSWORD=The {0} chat room has requested a password. service.gui.CHAT_ROOMS=Chat rooms +service.gui.CHAT_ROOM=Chat room service.gui.CHAT_ROOM_SUBJECT_CHANGED={0} has changed the subject to {1} service.gui.CHAT_ROOM_REMEMBER_PASSWORD=Remember password service.gui.CHOOSE_CONTACT=Choose contact diff --git a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java index bd6aed2c6..e85dced61 100644 --- a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java @@ -302,6 +302,62 @@ public static Map getAccountIDsWithSavedPasswords() return accountIDs; } + /** + * Finds all chat rooms with saved encrypted passwords. + * + * @return a {@link List} with the saved encrypted + * password. + */ + public static Map getChatRoomsWithSavedPasswords() + { + Map providerFactoriesMap + = getProtocolProviderFactories(); + + if (providerFactoriesMap == null) + return null; + + CredentialsStorageService credentialsStorageService + = getCredentialsStorageService(); + + Map chatRoomIDs = new HashMap(); + String prefix = "net.java.sip.communicator.impl.gui.accounts"; + List 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 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. diff --git a/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/SavedPasswordsDialog.java b/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/SavedPasswordsDialog.java index 6da0f2b72..42837801f 100644 --- a/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/SavedPasswordsDialog.java +++ b/src/net/java/sip/communicator/plugin/securityconfig/masterpassword/SavedPasswordsDialog.java @@ -485,7 +485,20 @@ private void initContent() protocol, accID.getUserID())); } + + for(Map.Entry entry : + SecurityConfigActivator.getChatRoomsWithSavedPasswords() + .entrySet()) + { + String description = entry.getKey(); + model.savedPasswords.add( + new PasswordsTableRow( + entry.getValue(), + resources.getI18NString("service.gui.CHAT_ROOM"), + description)); + } + // load provisioning passwords String PROVISIONING_PROPERTIES_PREFIX = "net.java.sip.communicator.plugin.provisioning.auth";