diff options
author | Damian Minkov <damencho@jitsi.org> | 2010-09-27 12:08:46 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2010-09-27 12:08:46 +0000 |
commit | aad068098463aa87250b26fd34fc0033c6a4ad43 (patch) | |
tree | 4403a84c13a73d90cf57959a655ebc55f8235d43 /src/net/java/sip/communicator/plugin/sipaccregwizz | |
parent | 15a6931b94247b66f909971901947b2d0202ede1 (diff) | |
download | jitsi-aad068098463aa87250b26fd34fc0033c6a4ad43.zip jitsi-aad068098463aa87250b26fd34fc0033c6a4ad43.tar.gz jitsi-aad068098463aa87250b26fd34fc0033c6a4ad43.tar.bz2 |
Add NAPTR support for sip accounts.
Fix SipAccountID.equals to take in account protocol and service, which fixes several gui problems with account config form, such as creating new account with username already existing not shown, deleting account makes all existing accounts with same username disappear, updating status of disabled accounts.
Disable accounts now can be deleted.
Use word picture for "My Recent Avatars".
Fix not to send sip PUBLISH messages when we are in connection failed.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/sipaccregwizz')
4 files changed, 158 insertions, 44 deletions
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java index affd76c..a1524d6 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java @@ -31,9 +31,11 @@ public class ConnectionPanel private final JTextField authNameField = new JTextField(); - private final JTextField serverPortField = new JTextField(); + private final JTextField serverPortField = new JTextField(4); - private final JTextField proxyPortField = new JTextField(); + private final JTextField proxyPortField = new JTextField(4); + + private final JCheckBox proxyAutoCheckBox; private JComboBox transportCombo = new JComboBox(new Object[] { "UDP", "TCP", "TLS" }); @@ -58,7 +60,7 @@ public class ConnectionPanel */ public ConnectionPanel(SIPAccountRegistrationForm regform) { - super(new BorderLayout()); + super(new BorderLayout(10, 10)); this.regform = regform; @@ -69,57 +71,104 @@ public class ConnectionPanel .getString("plugin.sipaccregwizz.ENABLE_SIPZRTP_ATTRIBUTE"), regform.getRegistration().isSipZrtpAttribute()); + proxyAutoCheckBox = new SIPCommCheckBox( + Resources.getString("plugin.sipaccregwizz.PROXY_AUTO"), + regform.getRegistration().isProxyAutoConfigure()); + proxyAutoCheckBox.addActionListener(new ActionListener() + { + /** + * Invoked when an action occurs. + */ + public void actionPerformed(ActionEvent e) + { + enablesProxyAutoConfigure(proxyAutoCheckBox.isSelected()); + } + }); + this.transportCombo.addItemListener(this); transportCombo.setSelectedItem( regform.getRegistration().getDefaultTransport()); - JPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10)); + JPanel mainPanel = new TransparentPanel(); + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); + + JPanel registrarMainPanel = new TransparentPanel(new BorderLayout(10, 10)); JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10)); - JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10)); JLabel serverLabel = new JLabel(Resources.getString("plugin.sipaccregwizz.REGISTRAR")); - JLabel proxyLabel - = new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY")); - JLabel authNameLabel = new JLabel(Resources.getString( "plugin.sipaccregwizz.AUTH_NAME")); JLabel serverPortLabel - = new JLabel(Resources.getString( - "plugin.sipaccregwizz.SERVER_PORT")); + = new JLabel(Resources.getString("service.gui.PORT")); + + labelsPanel.add(serverLabel); + labelsPanel.add(authNameLabel); + + JPanel serverPanel = new TransparentPanel(new BorderLayout(5, 5)); + serverPanel.add(serverField, BorderLayout.CENTER); + JPanel serverPortPanel = new TransparentPanel( + new BorderLayout(5, 5)); + serverPortPanel.add(serverPortLabel, BorderLayout.WEST); + serverPortPanel.add(serverPortField, BorderLayout.EAST); + serverPanel.add(serverPortPanel, BorderLayout.EAST); + + valuesPanel.add(serverPanel); + valuesPanel.add(authNameField); + + registrarMainPanel.add(labelsPanel, BorderLayout.WEST); + registrarMainPanel.add(valuesPanel, BorderLayout.CENTER); + registrarMainPanel.setBorder( + BorderFactory.createEmptyBorder(10, 5, 10, 5)); + + mainPanel.add(registrarMainPanel); + + JLabel proxyLabel + = new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY")); JLabel proxyPortLabel - = new JLabel(Resources.getString( - "plugin.sipaccregwizz.PROXY_PORT")); + = new JLabel(Resources.getString("service.gui.PORT")); JLabel transportLabel = new JLabel(Resources.getString( "plugin.sipaccregwizz.PREFERRED_TRANSPORT")); - labelsPanel.add(serverLabel); - labelsPanel.add(serverPortLabel); - labelsPanel.add(authNameLabel); + JPanel proxyMainPanel + = new TransparentPanel(new BorderLayout(10, 10)); + + JPanel proxyPanel = new TransparentPanel(new BorderLayout(5, 5)); + proxyPanel.add(proxyField, BorderLayout.CENTER); + JPanel proxyPortPanel = new TransparentPanel( + new BorderLayout(5, 5)); + proxyPortPanel.add(proxyPortLabel, BorderLayout.WEST); + proxyPortPanel.add(proxyPortField, BorderLayout.EAST); + proxyPanel.add(proxyPortPanel, BorderLayout.EAST); + + labelsPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10)); + valuesPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10)); + labelsPanel.add(proxyLabel); - labelsPanel.add(proxyPortLabel); labelsPanel.add(transportLabel); - - valuesPanel.add(serverField); - valuesPanel.add(serverPortField); - valuesPanel.add(authNameField); - valuesPanel.add(proxyField); - valuesPanel.add(proxyPortField); + valuesPanel.add(proxyPanel); valuesPanel.add(transportCombo); - mainPanel.add(labelsPanel, BorderLayout.WEST); - mainPanel.add(valuesPanel, BorderLayout.CENTER); + proxyMainPanel.add(proxyAutoCheckBox, BorderLayout.NORTH); + proxyMainPanel.add(labelsPanel, BorderLayout.WEST); + proxyMainPanel.add(valuesPanel, BorderLayout.CENTER); + proxyMainPanel.setBorder(BorderFactory.createTitledBorder( + Resources.getString("plugin.sipaccregwizz.PROXY_OPTIONS"))); + + mainPanel.add(proxyMainPanel); + mainPanel.add(Box.createVerticalStrut(5)); + mainPanel.add(createKeepAlivePanel()); JPanel encryptionPanel = new TransparentPanel(new GridLayout(1, 2, 2, 2)); @@ -138,13 +187,10 @@ public class ConnectionPanel } }); - mainPanel.add(encryptionPanel, BorderLayout.SOUTH); - - mainPanel.setBorder(BorderFactory.createTitledBorder(Resources - .getString("plugin.sipaccregwizz.ADVANCED_OPTIONS"))); + mainPanel.add(Box.createVerticalStrut(5)); + mainPanel.add(encryptionPanel); this.add(mainPanel, BorderLayout.NORTH); - this.add(createKeepAlivePanel(), BorderLayout.SOUTH); } /** @@ -458,4 +504,27 @@ public class ConnectionPanel { this.isServerOverridden = isServerOverridden; } + + /** + * Indicates if the proxy auto-configure is enabled. + * @return <tt>true</tt> if the proxy auto-configuration is enabled, + * <tt>false</tt> - otherwise + */ + boolean isProxyAutoConfigureEnabled() + { + return proxyAutoCheckBox.isSelected(); + } + + /** + * Enables/disables the proxy auto-configuration. + * @param isEnable <tt>true</tt> to enable proxy auto-configuration, + * <tt>false</tt> - otherwise + */ + void enablesProxyAutoConfigure(boolean isEnable) + { + proxyAutoCheckBox.setSelected(isEnable); + proxyField.setEnabled(!isEnable); + proxyPortField.setEnabled(!isEnable); + transportCombo.setEnabled(!isEnable); + } } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java index 37a87e3..75ba532 100755 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java @@ -40,6 +40,8 @@ public class SIPAccountRegistration private String serverPort = null; + private boolean proxyAutoConfigure = false; + private String proxyPort = null; private String proxy; @@ -586,4 +588,21 @@ public class SIPAccountRegistration this.xCapPassword = xCapPassword; } + /** + * Is proxy auto configured. + * @return + */ + public boolean isProxyAutoConfigure() + { + return proxyAutoConfigure; + } + + /** + * Sets auto configuration of proxy enabled or disabled. + * @param proxyAutoConfigure + */ + public void setProxyAutoConfigure(boolean proxyAutoConfigure) + { + this.proxyAutoConfigure = proxyAutoConfigure; + } } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java index dfde0b4..fa32c7e 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java @@ -215,6 +215,9 @@ public class SIPAccountRegistrationForm registration.setPreferredTransport( connectionPanel.getSelectedTransport()); + registration.setProxyAutoConfigure( + connectionPanel.isProxyAutoConfigureEnabled()); + registration.setEnablePresence( presencePanel.isPresenceEnabled()); registration.setForceP2PMode( @@ -302,6 +305,9 @@ public class SIPAccountRegistrationForm boolean enabledSipZrtpAttribute = accountID.getAccountPropertyBoolean( ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE, true); + boolean proxyAutoConfigureEnabled = accountID.getAccountPropertyBoolean( + ProtocolProviderFactory.PROXY_AUTO_CONFIG, false);; + String pollingPeriod = accountID.getAccountPropertyString( ProtocolProviderFactory.POLLING_PERIOD); @@ -350,6 +356,8 @@ public class SIPAccountRegistrationForm if(authName != null && authName.length() > 0) connectionPanel.setAuthenticationName(authName); + connectionPanel.enablesProxyAutoConfigure(proxyAutoConfigureEnabled); + connectionPanel.setServerPort(serverPort); connectionPanel.setProxy(proxyAddress); diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java index 0b26d65..30eef7b 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java @@ -161,19 +161,29 @@ public class SIPAccountRegistrationWizard summaryTable.put( Resources.getString("plugin.sipaccregwizz.SERVER_PORT"), serverPort); - String proxy = registration.getProxy(); - if(proxy != null && proxy.length() >0) + + if(registration.isProxyAutoConfigure()) + { summaryTable.put( - Resources.getString("plugin.sipaccregwizz.PROXY"), - proxy); - String proxyPort = registration.getProxyPort(); - if(proxyPort != null && proxyPort.length() > 0) + Resources.getString("plugin.sipaccregwizz.PROXY_AUTO"), + Resources.getString("service.gui.YES")); + } + else + { + String proxy = registration.getProxy(); + if(proxy != null && proxy.length() >0) + summaryTable.put( + Resources.getString("plugin.sipaccregwizz.PROXY"), + proxy); + String proxyPort = registration.getProxyPort(); + if(proxyPort != null && proxyPort.length() > 0) + summaryTable.put( + Resources.getString("plugin.sipaccregwizz.PROXY_PORT"), + proxyPort); summaryTable.put( - Resources.getString("plugin.sipaccregwizz.PROXY_PORT"), - proxyPort); - summaryTable.put( - Resources.getString("plugin.sipaccregwizz.PREFERRED_TRANSPORT"), - registration.getPreferredTransport()); + Resources.getString("plugin.sipaccregwizz.PREFERRED_TRANSPORT"), + registration.getPreferredTransport()); + } if (registration.isEnablePresence()) { @@ -391,14 +401,22 @@ public class SIPAccountRegistrationWizard accountProperties.put(ProtocolProviderFactory.SERVER_PORT, registration.getServerPort()); - accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS, - registration.getProxy()); + if(registration.isProxyAutoConfigure()) + { + accountProperties.put(ProtocolProviderFactory.PROXY_AUTO_CONFIG, + Boolean.TRUE.toString()); + } + else + { + accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS, + registration.getProxy()); - accountProperties.put(ProtocolProviderFactory.PROXY_PORT, + accountProperties.put(ProtocolProviderFactory.PROXY_PORT, registration.getProxyPort()); - accountProperties.put(ProtocolProviderFactory.PREFERRED_TRANSPORT, + accountProperties.put(ProtocolProviderFactory.PREFERRED_TRANSPORT, registration.getPreferredTransport()); + } accountProperties.put(ProtocolProviderFactory.IS_PRESENCE_ENABLED, Boolean.toString(registration.isEnablePresence())); |