diff options
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java | 9 | ||||
-rw-r--r-- | src/net/java/sip/communicator/util/ConfigurationUtils.java | 40 |
2 files changed, 44 insertions, 5 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java index 3947004..c3717de 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java @@ -64,8 +64,7 @@ public class ChatRoomWrapper * The prefix needed by the credential storage service to store the password * of the chat room. */ - private String passwordPrefix - = "net.java.sip.communicator.impl.gui.accounts."; + private String passwordPrefix; /** * Creates a <tt>ChatRoomWrapper</tt> by specifying the protocol provider, @@ -83,10 +82,10 @@ public class ChatRoomWrapper this.parentProvider = parentProvider; this.chatRoomID = chatRoomID; this.chatRoomName = chatRoomName; + passwordPrefix = ConfigurationUtils.getChatRoomPrefix( + getParentProvider().getProtocolProvider().getAccountID() + .getAccountUniqueID(), chatRoomID) + ".password"; - passwordPrefix += getParentProvider().getProtocolProvider() - .getAccountID().getAccountUniqueID() + ".chatrooms." + - getChatRoomID() + ".password"; } /** diff --git a/src/net/java/sip/communicator/util/ConfigurationUtils.java b/src/net/java/sip/communicator/util/ConfigurationUtils.java index bb1a582..10531c4 100644 --- a/src/net/java/sip/communicator/util/ConfigurationUtils.java +++ b/src/net/java/sip/communicator/util/ConfigurationUtils.java @@ -2296,6 +2296,46 @@ public class ConfigurationUtils } /** + * Returns the chat room prefix saved in <tt>ConfigurationService</tt> + * associated with the <tt>accountID</tt> and <tt>chatRoomID</tt>. + * + * @param accountID the account id + * @param chatRoomId the chat room id + * @return the chat room prefix saved in <tt>ConfigurationService</tt>. + */ + public static String getChatRoomPrefix(String accountID, String chatRoomId) + { + String prefix = "net.java.sip.communicator.impl.gui.accounts"; + List<String> accounts = configService + .getPropertyNamesByPrefix(prefix, true); + for (String accountRootPropName : accounts) + { + + String tmpAccountID + = configService.getString(accountRootPropName); + + if(tmpAccountID.equals(accountID)) + { + List<String> chatRooms = configService + .getPropertyNamesByPrefix( + accountRootPropName + ".chatRooms", true); + + for (String chatRoomPropName : chatRooms) + { + String tmpChatRoomID + = configService.getString(chatRoomPropName); + + if(tmpChatRoomID.equals(chatRoomId)) + { + return chatRoomPropName; + } + } + } + } + return null; + } + + /** * Returns the last chat room status, saved through the * <tt>ConfigurationService</tt>. * |