diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index 249255c4a..d23ab6ed7 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -401,6 +401,10 @@ service.gui.OPEN_FILE_FROM_IMAGE=Double click to open file. service.gui.OPEN_FOLDER=Open folder service.gui.OPEN_IN_BROWSER=Open in &browser service.gui.OPTIONS=Options +service.gui.OPEN_AUTOMATICALLY=Open this room automatically when +service.gui.OPEN_ON_ACTIVITY=Open on activity +service.gui.OPEN_ON_MESSAGE=Open on message only +service.gui.OPEN_ON_IMPORTANT_MESSAGE=Open on important messages only service.gui.OR=or service.gui.OR_ENTER_PHONE_NUMBER=Or enter phone number here... service.gui.ORGANIZATION=Organization diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index 297c95a77..0cb1a40e9 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -1607,4 +1607,16 @@ public void showAddChatRoomDialog() { ChatRoomTableDialog.showChatRoomTableDialog(); } + + /** + * Shows chat room open automatically configuration dialog. + * @param chatRoomId the chat room id of the chat room associated with the + * dialog + * @param pps the protocol provider service of the chat room + */ + public void showChatRoomAutoOpenConfigDialog( + ProtocolProviderService pps, String chatRoomId) + { + new ChatRoomAutoOpenConfigDialog(pps, chatRoomId); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomAutoOpenConfigDialog.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomAutoOpenConfigDialog.java new file mode 100644 index 000000000..f4006d2dc --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomAutoOpenConfigDialog.java @@ -0,0 +1,256 @@ +/* + * Jitsi, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main.chat.conference; + +import java.awt.*; +import java.awt.event.*; +import java.beans.*; + +import javax.swing.*; + +import net.java.sip.communicator.impl.gui.*; +import net.java.sip.communicator.plugin.desktoputil.*; +import net.java.sip.communicator.service.msghistory.*; +import net.java.sip.communicator.service.muc.*; +import net.java.sip.communicator.service.protocol.*; + +/** + * A dialog for the chat room automatically open configuration. + * + * @author Hristo Terezov + */ +public class ChatRoomAutoOpenConfigDialog + extends SIPCommDialog + implements ActionListener +{ + + /** + * The serial version ID. + */ + private static final long serialVersionUID = -7741709128413173168L; + + /** + * The current value. + */ + private String value = null; + + /** + * The protocol provider service associated with the chat room. + */ + private ProtocolProviderService pps; + + /** + * The chat room id of the chat room. + */ + private String chatRoomId; + + /** + * Open on activity radio button. + */ + private final JRadioButton openOnActivity + = new JRadioButton( + GuiActivator.getResources() + .getI18NString("service.gui.OPEN_ON_ACTIVITY")); + + /** + * Open on message radio button. + */ + private final JRadioButton openOnMessage + = new JRadioButton( + GuiActivator.getResources() + .getI18NString("service.gui.OPEN_ON_MESSAGE")); + + /** + * Open on important message radio button. + */ + private final JRadioButton openOnImportantMessage + = new JRadioButton( + GuiActivator.getResources() + .getI18NString("service.gui.OPEN_ON_IMPORTANT_MESSAGE")); + + /** + * OK button. + */ + private JButton okButton = new JButton( + GuiActivator.getResources().getI18NString("service.gui.OK")); + + /** + * Cancel button. + */ + private JButton cancelButton = new JButton( + GuiActivator.getResources().getI18NString("service.gui.CANCEL")); + + /** + * The property change listener for the message service. + */ + private PropertyChangeListener propertyListener = new PropertyChangeListener() + { + + @Override + public void propertyChange(PropertyChangeEvent e) + { + updateView(); + } + }; + + /** + * Constructs new ChatRoomAutoOpenConfigDialog instance. + * @param chatRoomId the chat room id of the chat room associated with the + * dialog + * @param pps the protocol provider service of the chat room + */ + public ChatRoomAutoOpenConfigDialog(ProtocolProviderService pps, + final String chatRoomId) + { + + this.pps = pps; + this.chatRoomId = chatRoomId; + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + value = MUCService.getChatRoomAutoOpenOption(pps, chatRoomId); + + GuiActivator.getConfigurationService().addPropertyChangeListener( + MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED, + propertyListener); + + GuiActivator.getConfigurationService().addPropertyChangeListener( + MessageHistoryService + .PNAME_IS_MESSAGE_HISTORY_PER_CONTACT_ENABLED_PREFIX + "." + + chatRoomId, + propertyListener); + + if(value == null) + value = MUCService.OPEN_ON_MESSAGE; + + if(value.equals(MUCService.OPEN_ON_ACTIVITY)) + { + openOnActivity.setSelected(true); + } + else if(value.equals(MUCService.OPEN_ON_IMPORTANT_MESSAGE)) + { + openOnImportantMessage.setSelected(true); + } + else + { + openOnMessage.setSelected(true); + } + + JPanel choicePanel = new TransparentPanel(); + choicePanel.setLayout(new BoxLayout(choicePanel, BoxLayout.Y_AXIS)); + openOnActivity.addActionListener( this ); + openOnMessage.addActionListener( this ); + openOnImportantMessage.addActionListener(this); + + setTitle(GuiActivator.getResources() + .getI18NString("service.gui.OPEN_AUTOMATICALLY")); + + openOnActivity.setOpaque(false); + openOnMessage.setOpaque(false); + openOnImportantMessage.setOpaque(false); + + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(openOnActivity); + buttonGroup.add(openOnMessage); + buttonGroup.add(openOnImportantMessage); + choicePanel.add(openOnActivity); + choicePanel.add(openOnMessage); + choicePanel.add(openOnImportantMessage); + + JPanel buttonPanel + = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); + + updateView(); + + okButton.addActionListener(this); + cancelButton.addActionListener(this); + + buttonPanel.add(okButton); + buttonPanel.add(cancelButton); + + add(choicePanel, BorderLayout.CENTER); + add(buttonPanel, BorderLayout.SOUTH); + + setPreferredSize(new Dimension(300, 140)); + setVisible(true); + } + + /** + * Sets enable/disable state of the buttons. + */ + private void updateView() + { + MessageHistoryService mhs + = GuiActivator.getMessageHistoryService(); + if(!mhs.isHistoryLoggingEnabled() + || !mhs.isHistoryLoggingEnabled(chatRoomId)) + { + openOnImportantMessage.setEnabled(false); + openOnMessage.setEnabled(false); + openOnActivity.setSelected(true); + } + else + { + openOnImportantMessage.setEnabled(true); + openOnMessage.setEnabled(true); + } + } + + @Override + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + + + if (source instanceof JButton) + { + if(source.equals(okButton)) + { + MUCService.setChatRoomAutoOpenOption( + pps, + chatRoomId, value); + } + this.dispose(); + + } + else if(source instanceof JRadioButton) + { + if(source.equals(openOnActivity)) + { + value = MUCService.OPEN_ON_ACTIVITY; + } + else if(source.equals(openOnImportantMessage)) + { + value = MUCService.OPEN_ON_IMPORTANT_MESSAGE; + } + else + { + value = MUCService.OPEN_ON_MESSAGE; + } + } + + } + + @Override + public void dispose() + { + GuiActivator.getConfigurationService().removePropertyChangeListener( + MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED, + propertyListener); + GuiActivator.getConfigurationService().removePropertyChangeListener( + MessageHistoryService + .PNAME_IS_MESSAGE_HISTORY_PER_CONTACT_ENABLED_PREFIX + "." + + chatRoomId, + propertyListener); + super.dispose(); + } + + @Override + protected void close(boolean escaped) + { + super.close(escaped); + dispose(); + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java index f17fe426f..e526e7e7d 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java @@ -207,11 +207,17 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt) = GuiActivator.getUIService().getChatWindowManager(); boolean createWindow = false; - - MessageHistoryService mhs = GuiActivator.getMessageHistoryService(); - - if(!mhs.isHistoryLoggingEnabled() || - !mhs.isHistoryLoggingEnabled(sourceChatRoom.getIdentifier())) + String autoOpenConfig + = MUCService.getChatRoomAutoOpenOption( + sourceChatRoom.getParentProvider(), + sourceChatRoom.getIdentifier()); + if(autoOpenConfig == null) + autoOpenConfig = MUCService.OPEN_ON_MESSAGE; + + if(autoOpenConfig.equals(MUCService.OPEN_ON_ACTIVITY) + || (autoOpenConfig.equals(MUCService.OPEN_ON_MESSAGE) + && !evt.isHistoryMessage()) + || evt.isImportantMessage()) createWindow = true; if(sourceChatRoom.isSystem()) @@ -288,8 +294,8 @@ else if(o instanceof ChatRoomMessageReceivedEvent) message.getContentType(), message.getMessageUID(), null); - - if(evt.isImportantMessage() || createWindow) + + if(createWindow) chatWindowManager.openChat(chatPanel, true); } @@ -487,14 +493,15 @@ public void run() chatRoomWrapper, ChatRoomListChangeEvent.CHAT_ROOM_CHANGED); - MessageHistoryService mhs - = GuiActivator.getMessageHistoryService(); - boolean createWindow = false; - if(!mhs.isHistoryLoggingEnabled() - || !mhs.isHistoryLoggingEnabled( - sourceChatRoom.getIdentifier())) + String autoOpenConfig + = MUCService.getChatRoomAutoOpenOption( + sourceChatRoom.getParentProvider(), + sourceChatRoom.getIdentifier()); + + if(autoOpenConfig != null + && autoOpenConfig.equals(MUCService.OPEN_ON_ACTIVITY)) createWindow = true; ChatWindowManager chatWindowManager diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java index 36e9ea946..d0ca47828 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java @@ -557,7 +557,7 @@ private void initActionMenuItem( actionMenuItem = new JMenuItem(); } - actionMenuItem.setText(ca.getText()); + actionMenuItem.setText(ca.getText(customActionContact)); actionMenuItem.setMnemonic(ca.getMnemonics()); @@ -614,7 +614,7 @@ private void initGroupActionMenuItem( actionMenuItem = new JMenuItem(); } - actionMenuItem.setText(ca.getText()); + actionMenuItem.setText(ca.getText(contactSource)); actionMenuItem.setMnemonic(ca.getMnemonics()); diff --git a/src/net/java/sip/communicator/impl/muc/ChatRoomListImpl.java b/src/net/java/sip/communicator/impl/muc/ChatRoomListImpl.java index 996a8aac4..e8055d3c8 100644 --- a/src/net/java/sip/communicator/impl/muc/ChatRoomListImpl.java +++ b/src/net/java/sip/communicator/impl/muc/ChatRoomListImpl.java @@ -339,6 +339,7 @@ public void removeChatRoom(ChatRoomWrapper chatRoomWrapper) null, // The new identifier. null); // The name of the chat room. + chatRoomWrapper.removeListeners(); fireChatRoomListChangedEvent( chatRoomWrapper, ChatRoomListChangeEvent.CHAT_ROOM_REMOVED); diff --git a/src/net/java/sip/communicator/impl/muc/ChatRoomWrapperImpl.java b/src/net/java/sip/communicator/impl/muc/ChatRoomWrapperImpl.java index a22a1ed15..e34140af3 100644 --- a/src/net/java/sip/communicator/impl/muc/ChatRoomWrapperImpl.java +++ b/src/net/java/sip/communicator/impl/muc/ChatRoomWrapperImpl.java @@ -7,6 +7,9 @@ package net.java.sip.communicator.impl.muc; +import java.beans.*; + +import net.java.sip.communicator.service.msghistory.*; import net.java.sip.communicator.service.muc.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.*; @@ -65,6 +68,29 @@ public class ChatRoomWrapperImpl * of the chat room. */ private String passwordPrefix; + + /** + * The property change listener for the message service. + */ + private PropertyChangeListener propertyListener + = new PropertyChangeListener() + { + + @Override + public void propertyChange(PropertyChangeEvent e) + { + MessageHistoryService mhs = MUCActivator.getMessageHistoryService(); + if(!mhs.isHistoryLoggingEnabled() + || !mhs.isHistoryLoggingEnabled(getChatRoomID())) + { + MUCService.setChatRoomAutoOpenOption( + getParentProvider().getProtocolProvider(), + getChatRoomID(), + MUCService.OPEN_ON_ACTIVITY); + } + } + + }; /** * Creates a ChatRoomWrapper by specifying the protocol provider, @@ -86,6 +112,15 @@ public ChatRoomWrapperImpl( ChatRoomProviderWrapper parentProvider, getParentProvider().getProtocolProvider().getAccountID() .getAccountUniqueID(), chatRoomID) + ".password"; + MUCActivator.getConfigurationService().addPropertyChangeListener( + MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED, + propertyListener); + + MUCActivator.getConfigurationService().addPropertyChangeListener( + MessageHistoryService + .PNAME_IS_MESSAGE_HISTORY_PER_CONTACT_ENABLED_PREFIX + "." + + getChatRoomID(), + propertyListener); } /** @@ -275,5 +310,18 @@ public void setAutoJoin(boolean value) ChatRoomListChangeEvent.CHAT_ROOM_CHANGED); } - + /** + * Removes the listeners. + */ + public void removeListeners() + { + MUCActivator.getConfigurationService().removePropertyChangeListener( + MessageHistoryService.PNAME_IS_MESSAGE_HISTORY_ENABLED, + propertyListener); + MUCActivator.getConfigurationService().removePropertyChangeListener( + MessageHistoryService + .PNAME_IS_MESSAGE_HISTORY_PER_CONTACT_ENABLED_PREFIX + "." + + getChatRoomID(), + propertyListener); + } } diff --git a/src/net/java/sip/communicator/impl/muc/MUCActivator.java b/src/net/java/sip/communicator/impl/muc/MUCActivator.java index 1d2dc1461..b15c46885 100644 --- a/src/net/java/sip/communicator/impl/muc/MUCActivator.java +++ b/src/net/java/sip/communicator/impl/muc/MUCActivator.java @@ -13,6 +13,7 @@ import net.java.sip.communicator.service.customcontactactions.*; import net.java.sip.communicator.service.globaldisplaydetails.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.service.msghistory.*; import net.java.sip.communicator.service.muc.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.*; @@ -97,6 +98,11 @@ public class MUCActivator */ private static ProtocolProviderRegListener protocolProviderRegListener = null; + + /** + * The message history service. + */ + private static MessageHistoryService messageHistoryService; /** * The global display details service instance. @@ -414,4 +420,17 @@ public static GlobalDisplayDetailsService getGlobalDisplayDetailsService() } return globalDisplayDetailsService; } + + /** + * Gets the service giving access to message history. + * + * @return the service giving access to message history. + */ + public static MessageHistoryService getMessageHistoryService() + { + if (messageHistoryService == null) + messageHistoryService = ServiceUtils.getService(bundleContext, + MessageHistoryService.class); + return messageHistoryService; + } } diff --git a/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java b/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java index 3ce919025..3cbe3ee9e 100644 --- a/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java +++ b/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java @@ -85,7 +85,7 @@ public class MUCCustomContactActionService */ private String[] menuActionsNames = { "open", "join", "join_as", "leave", "remove", "change_nick", "autojoin", - "autojoin_pressed" + "autojoin_pressed", "open_automatically" }; /** @@ -96,7 +96,8 @@ public class MUCCustomContactActionService "service.gui.JOIN_AS", "service.gui.LEAVE", "service.gui.REMOVE", "service.gui.CHANGE_NICK", "service.gui.JOIN_AUTOMATICALLY", - "service.gui.DONT_JOIN_AUTOMATICALLY" + "service.gui.DONT_JOIN_AUTOMATICALLY", + "service.gui.OPEN_AUTOMATICALLY" }; /** @@ -107,7 +108,7 @@ public class MUCCustomContactActionService "service.gui.icons.JOIN_AS_ICON", "service.gui.icons.LEAVE_ICON", "service.gui.icons.REMOVE_CHAT_ICON", "service.gui.icons.RENAME_16x16_ICON", - "service.gui.icons.AUTOJOIN", "service.gui.icons.AUTOJOIN" + "service.gui.icons.AUTOJOIN", "service.gui.icons.AUTOJOIN", null }; /** @@ -257,7 +258,18 @@ public void run() } }, autoJoinRunnable, - autoJoinRunnable + autoJoinRunnable, + new MUCCustomActionRunnable() + { + + @Override + public void run() + { + MUCActivator.getUIService().showChatRoomAutoOpenConfigDialog( + chatRoomWrapper.getParentProvider().getProtocolProvider(), + chatRoomWrapper.getChatRoomID()); + } + } }; /** @@ -272,6 +284,7 @@ public void run() null, null, null, + null, null }; @@ -526,9 +539,21 @@ public byte[] getIcon() @Override - public String getText() + public String getText(SourceContact actionSource) { - return text; + if(!name.equals("open_automatically")) + return text; + + String openAutomaticallyValue + = MUCService.getChatRoomAutoOpenOption( + ((ChatRoomSourceContact)actionSource).getProvider(), + ((ChatRoomSourceContact)actionSource).getChatRoomID()); + if(openAutomaticallyValue == null) + openAutomaticallyValue = MUCService.OPEN_ON_MESSAGE; + String openAutomaticallyKey = MUCService.autoOpenConfigValuesTexts + .get(openAutomaticallyValue); + return text + " (" + resources.getI18NString(openAutomaticallyKey) + + ")"; } @Override diff --git a/src/net/java/sip/communicator/impl/muc/MUCGroupCustomContactActionService.java b/src/net/java/sip/communicator/impl/muc/MUCGroupCustomContactActionService.java index 9398c51e7..f135218cd 100644 --- a/src/net/java/sip/communicator/impl/muc/MUCGroupCustomContactActionService.java +++ b/src/net/java/sip/communicator/impl/muc/MUCGroupCustomContactActionService.java @@ -82,7 +82,7 @@ public byte[] getIcon() } @Override - public String getText() + public String getText(ContactSourceService contactSource) { return resources.getI18NString("service.gui.MY_CHAT_ROOMS"); } diff --git a/src/net/java/sip/communicator/impl/muc/muc.manifest.mf b/src/net/java/sip/communicator/impl/muc/muc.manifest.mf index 853ab6bf2..683196047 100644 --- a/src/net/java/sip/communicator/impl/muc/muc.manifest.mf +++ b/src/net/java/sip/communicator/impl/muc/muc.manifest.mf @@ -17,5 +17,6 @@ Import-Package: org.osgi.framework, net.java.sip.communicator.service.customcontactactions, net.java.sip.communicator.plugin.desktoputil, net.java.sip.communicator.plugin.desktoputil.chat, - net.java.sip.communicator.service.globaldisplaydetails + net.java.sip.communicator.service.globaldisplaydetails, + net.java.sip.communicator.service.msghistory Export-Package: net.java.sip.communicator.service.muc diff --git a/src/net/java/sip/communicator/service/customcontactactions/ContactActionMenuItem.java b/src/net/java/sip/communicator/service/customcontactactions/ContactActionMenuItem.java index a59bcfc15..2214968de 100644 --- a/src/net/java/sip/communicator/service/customcontactactions/ContactActionMenuItem.java +++ b/src/net/java/sip/communicator/service/customcontactactions/ContactActionMenuItem.java @@ -33,11 +33,13 @@ public void actionPerformed(T actionSource) /** * Returns the text of the component to create for this contact * action. - * + * + * @param actionSource the action source for associated with the + * action. * @return the tool tip text of the component to create for this contact * action */ - public String getText(); + public String getText(T actionSource); /** * Indicates if this action is visible for the given actionSource. diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java index f60554203..549941df6 100644 --- a/src/net/java/sip/communicator/service/gui/UIService.java +++ b/src/net/java/sip/communicator/service/gui/UIService.java @@ -495,4 +495,13 @@ public ContactList createContactListComponent( * Shows Add chat room dialog. */ public void showAddChatRoomDialog(); + + /** + * Shows chat room open automatically configuration dialog. + * @param chatRoomId the chat room id of the chat room associated with the + * dialog + * @param pps the protocol provider service of the chat room + */ + public void showChatRoomAutoOpenConfigDialog( + ProtocolProviderService pps, String chatRoomId); } diff --git a/src/net/java/sip/communicator/service/muc/ChatRoomWrapper.java b/src/net/java/sip/communicator/service/muc/ChatRoomWrapper.java index a6270e019..d533e3c0a 100644 --- a/src/net/java/sip/communicator/service/muc/ChatRoomWrapper.java +++ b/src/net/java/sip/communicator/service/muc/ChatRoomWrapper.java @@ -100,4 +100,9 @@ public interface ChatRoomWrapper * @param value change of auto join property. */ public void setAutoJoin(boolean value); + + /** + * Removes the listeners. + */ + public void removeListeners(); } diff --git a/src/net/java/sip/communicator/service/muc/MUCService.java b/src/net/java/sip/communicator/service/muc/MUCService.java index fc4675fb1..7728370ea 100644 --- a/src/net/java/sip/communicator/service/muc/MUCService.java +++ b/src/net/java/sip/communicator/service/muc/MUCService.java @@ -10,6 +10,7 @@ import net.java.sip.communicator.service.contactsource.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.*; /** * The MUC service provides interface for the chat rooms. It connects the GUI @@ -19,6 +20,71 @@ */ public abstract class MUCService { + /** + * The value for chat room configuration property to open automatically on + * activity + */ + public static String OPEN_ON_ACTIVITY = "on_activity"; + + /** + * The value for chat room configuration property to open automatically on + * message + */ + public static String OPEN_ON_MESSAGE = "on_message"; + + /** + * The value for chat room configuration property to open automatically on + * important messages. + */ + public static String OPEN_ON_IMPORTANT_MESSAGE = "on_important_message"; + + /** + * Map for the auto open configuration values and their text representation + */ + public static Map autoOpenConfigValuesTexts + = new HashMap(); + + static + { + autoOpenConfigValuesTexts.put(OPEN_ON_ACTIVITY, + "service.gui.OPEN_ON_ACTIVITY"); + autoOpenConfigValuesTexts.put(OPEN_ON_MESSAGE, + "service.gui.OPEN_ON_MESSAGE"); + autoOpenConfigValuesTexts.put(OPEN_ON_IMPORTANT_MESSAGE, + "service.gui.OPEN_ON_IMPORTANT_MESSAGE"); + } + + /** + * Sets chat room open automatically property + * @param pps the provider + * @param chatRoomId the chat room id + * @param value the new value for the property + */ + public static void setChatRoomAutoOpenOption( + ProtocolProviderService pps, + String chatRoomId, + String value) + { + ConfigurationUtils.updateChatRoomProperty( + pps, + chatRoomId, "openAutomatically", value); + } + + /** + * Returns the value of the chat room open automatically property + * @param pps the provider + * @param chatRoomId the chat room id + * @return the value of the chat room open automatically property + */ + public static String getChatRoomAutoOpenOption( + ProtocolProviderService pps, + String chatRoomId) + { + return ConfigurationUtils.getChatRoomProperty( + pps, + chatRoomId, "openAutomatically"); + } + /** * Fires a ChatRoomListChangedEvent event. *