diff options
author | Damian Minkov <damencho@jitsi.org> | 2012-03-21 08:33:44 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2012-03-21 08:33:44 +0000 |
commit | 634faeee05673f5db633b3aeaf3906f9ffc5cd53 (patch) | |
tree | 8e8563a93640aa36524661348c168fc66bbc2fc0 /src/net/java/sip/communicator/plugin/sipaccregwizz | |
parent | a44d1a62317ed7db28925669129f77f3f1e28c03 (diff) | |
download | jitsi-634faeee05673f5db633b3aeaf3906f9ffc5cd53.zip jitsi-634faeee05673f5db633b3aeaf3906f9ffc5cd53.tar.gz jitsi-634faeee05673f5db633b3aeaf3906f9ffc5cd53.tar.bz2 |
Adds option to disable/enable mwi.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/sipaccregwizz')
4 files changed, 87 insertions, 9 deletions
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java index 27219ab..72f09b9 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java @@ -72,6 +72,8 @@ public class ConnectionPanel "plugin.sipaccregwizz.DTMF_INBAND") }); + private final JCheckBox mwiCheckBox; + private boolean isServerOverridden = false; private SIPAccountRegistrationForm regform; @@ -205,13 +207,21 @@ public class ConnectionPanel JPanel voicemailPanel = new TransparentPanel(new BorderLayout(10, 10)); - voicemailPanel.add(new JLabel( + JPanel voicemailUriPanel + = new TransparentPanel(new BorderLayout(10, 10)); + mwiCheckBox = new SIPCommCheckBox( + Resources.getString("plugin.sipaccregwizz.MWI"), + regform.getRegistration().isMessageWaitingIndicationsEnabled()); + voicemailUriPanel.add(new JLabel( Resources.getString("plugin.sipaccregwizz.VOICEMAIL_URI")), BorderLayout.WEST); - voicemailPanel.add(voicemailField, BorderLayout.CENTER); + voicemailUriPanel.add(voicemailField, BorderLayout.CENTER); voicemailField.setText(regform.getRegistration().getVoicemailURI()); + voicemailPanel.add(mwiCheckBox, BorderLayout.WEST); + voicemailPanel.add(voicemailUriPanel, BorderLayout.CENTER); + mainPanel.add(Box.createVerticalStrut(5)); mainPanel.add(createDTMFPanel()); @@ -623,6 +633,24 @@ public class ConnectionPanel } /** + * Returns is message waiting indications is enabled. + * @return is message waiting indications is enabled. + */ + boolean isMessageWaitingEnabled() + { + return mwiCheckBox.isSelected(); + } + + /** + * Sets is message waiting indications is enabled. + * @param enabled is message waiting indications is enabled. + */ + void setMessageWaitingIndications(boolean enabled) + { + mwiCheckBox.setSelected(enabled); + } + + /** * Sets the keep alive interval * @param keepAliveInterval the keep alive interval */ diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java index 4a11366..6add753 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java @@ -97,6 +97,11 @@ public class SIPAccountRegistration */ private String voicemailURI; + /** + * Whether message waiting indications is enabled. + */ + private boolean messageWaitingIndications = true; + public String getPreferredTransport() { return preferredTransport; @@ -748,4 +753,24 @@ public class SIPAccountRegistration { this.voicemailURI = voicemailURI; } + + /** + * Check if messageWaitingIndications is enabled + * + * @return if messageWaitingIndications is enabled + */ + public boolean isMessageWaitingIndicationsEnabled() + { + return messageWaitingIndications; + } + + /** + * Sets message waiting indications. + * + * @param messageWaitingIndications + */ + public void setMessageWaitingIndications(boolean messageWaitingIndications) + { + this.messageWaitingIndications = messageWaitingIndications; + } } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java index c9b492e..8f6397d 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java @@ -7,6 +7,7 @@ import java.util.List; import javax.swing.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.swing.*; /** @@ -308,7 +309,9 @@ public class SIPAccountRegistrationForm presencePanel.isClistOptionUseSipCredentials()); registration.setClistOptionUser(presencePanel.getClistOptionUser()); registration.setClistOptionPassword( - new String(presencePanel.getClistOptionPassword())); + new String(presencePanel.getClistOptionPassword())); + registration.setMessageWaitingIndications( + connectionPanel.isMessageWaitingEnabled()); registration.setVoicemailURI(connectionPanel.getVoicemailURI()); return true; @@ -437,7 +440,11 @@ public class SIPAccountRegistrationForm connectionPanel.setDTMFMethod(dtmfMethod); - if (voicemailURI != null && voicemailURI.length() > 0) + boolean mwiEnabled = accountID.getAccountPropertyBoolean( + ProtocolProviderFactory.VOICEMAIL_ENABLED, true); + connectionPanel.setMessageWaitingIndications(mwiEnabled); + + if(!StringUtils.isNullOrEmpty(voicemailURI)) connectionPanel.setVoicemailURI(voicemailURI); if(xCapEnable) diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java index b019797..10991d2 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java @@ -286,8 +286,9 @@ public class SIPAccountRegistrationWizard } } - if(!StringUtils.isNullOrEmpty(registration.getVoicemailURI(), true)) - summaryTable.put( + if(registration.isMessageWaitingIndicationsEnabled()) + if(!StringUtils.isNullOrEmpty(registration.getVoicemailURI(), true)) + summaryTable.put( Resources.getString("plugin.sipaccregwizz.VOICEMAIL_URI"), registration.getVoicemailURI()); @@ -544,12 +545,29 @@ public class SIPAccountRegistrationWizard } } - if(!StringUtils.isNullOrEmpty(registration.getVoicemailURI(), true)) - accountProperties.put( + if(registration.isMessageWaitingIndicationsEnabled()) + { + if(!StringUtils.isNullOrEmpty(registration.getVoicemailURI(), true)) + accountProperties.put( ProtocolProviderFactory.VOICEMAIL_URI, registration.getVoicemailURI()); + else if(isModification()) + accountProperties.put(ProtocolProviderFactory.VOICEMAIL_URI, ""); + + if(isModification()) + { + // remove the property as true is by default, + // and null removes property + accountProperties.put(ProtocolProviderFactory.VOICEMAIL_ENABLED, + null); + } + } else if(isModification()) - accountProperties.put(ProtocolProviderFactory.VOICEMAIL_URI, ""); + { + accountProperties.put(ProtocolProviderFactory.VOICEMAIL_ENABLED, + Boolean.FALSE.toString()); + } + if(isModification()) { |