Adds chat room password to saved passwords form.

cusax-fix 4791
hristoterezov 12 years ago
parent 10750b3efd
commit 58444fe1e5

@ -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

@ -302,6 +302,62 @@ public static Map<AccountID, String> getAccountIDsWithSavedPasswords()
return accountIDs;
}
/**
* 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.

@ -485,7 +485,20 @@ private void initContent()
protocol,
accID.getUserID()));
}
for(Map.Entry<String, String> 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";

Loading…
Cancel
Save