diff --git a/build.xml b/build.xml index b3d568dcf..b1c0f365d 100644 --- a/build.xml +++ b/build.xml @@ -729,6 +729,11 @@ + + @@ -885,7 +890,7 @@ bundle-contacteventhandler,bundle-plugin-contactinfo, bundle-plugin-accountinfo,bundle-plugin-chatalerter, bundle-plugin-autoaway, bundle-keybindings, - bundle-plugin-keybindingChooser, + bundle-plugin-keybindingChooser,bundle-plugin-globalproxyconfig, bundle-jfontchooserlib, bundle-updatecheckplugin, bundle-dict,bundle-plugin-dictaccregwizz, @@ -2290,6 +2295,16 @@ org.apache.http.util"/> + + + + + + + + diff --git a/lib/felix.client.run.properties b/lib/felix.client.run.properties index 0939e70e0..0c94c8f97 100644 --- a/lib/felix.client.run.properties +++ b/lib/felix.client.run.properties @@ -128,7 +128,8 @@ felix.auto.start.67= \ reference:file:sc-bundles/generalconfig.jar \ reference:file:sc-bundles/dictaccregwizz.jar \ reference:file:sc-bundles/otr.jar \ - reference:file:sc-bundles/facebookaccregwizz.jar + reference:file:sc-bundles/facebookaccregwizz.jar \ + reference:file:sc-bundles/globalproxyconfig.jar #level 68 is for profiler, don't use it or change the build.xml file accordingly diff --git a/lib/installer-exclude/smack.manifest.mf b/lib/installer-exclude/smack.manifest.mf index 5498f8803..f058d9037 100644 --- a/lib/installer-exclude/smack.manifest.mf +++ b/lib/installer-exclude/smack.manifest.mf @@ -23,6 +23,7 @@ Export-Package: org.jivesoftware.smack, org.jivesoftware.smackx, org.jivesoftware.smackx.muc, org.jivesoftware.smackx.packet, + org.jivesoftware.smack.proxy, org.jivesoftware.smackx.jingle, org.jivesoftware.smackx.jingle.nat, org.jivesoftware.smackx.jingle.media, diff --git a/resources/images/images.properties b/resources/images/images.properties index 5abbc3443..3372cc03d 100644 --- a/resources/images/images.properties +++ b/resources/images/images.properties @@ -458,3 +458,6 @@ plugin.otr.MENU_ITEM_ICON_16x16=resources/images/plugin/otr/otr_menu_icon.png plugin.otr.configform.ICON=resources/images/plugin/otr/otr_config_icon.png impl.media.DESKTOP_STREAMING_ICON=resources/images/impl/media/desktopStreaming.png + +#Global proxy config form +plugin.globalproxy.PLUGIN_ICON=resources/images/plugin/globalproxyconfig/configureIcon.png diff --git a/resources/images/plugin/globalproxyconfig/configureIcon.png b/resources/images/plugin/globalproxyconfig/configureIcon.png new file mode 100644 index 000000000..9e4ac3877 Binary files /dev/null and b/resources/images/plugin/globalproxyconfig/configureIcon.png differ diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index 14ceac1aa..962112ef9 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -421,9 +421,9 @@ service.gui.DECEMBER=Dec service.gui.ALWAYS_TRUST=Always trust this certificate service.gui.CERT_DIALOG_TITLE=Verify Certificate -service.gui.CERT_DIALOG_DESCRIPTION_TXT=\nCan''t verify identity of server when \ -connecting to {0}:{1}.\n\n\ -A certificate is not trusted, which means that the server''s \ +service.gui.CERT_DIALOG_DESCRIPTION_TXT=\n{0} can''t verify the identity of the server when \ +connecting to {1}:{2}.\n\n\ +The certificate is not trusted, which means that the server''s \ identity cannot be automatically verified. \ Do you want to continue connecting?\n\n\ For more information, click "Show Certificate". @@ -481,12 +481,6 @@ plugin.aimaccregwizz.USERNAME_AND_PASSWORD=Screen Name and Password plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT=Register new account plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT_TEXT=In case you don't have an AIM account, click on this button to create a new one. plugin.aimaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS=Override server default options -plugin.aimaccregwizz.ADVANCED_OPTIONS=Advanced Options -plugin.aimaccregwizz.PROXY=Proxy -plugin.aimaccregwizz.PROXY_PORT=Proxy port -plugin.aimaccregwizz.PROXY_TYPE=Proxy type -plugin.aimaccregwizz.PROXY_USERNAME=Proxy username -plugin.aimaccregwizz.PROXY_PASSWORD=Proxy password # branding plugin.branding.ABOUT_WINDOW_TITLE=About {0} @@ -578,11 +572,6 @@ plugin.icqaccregwizz.PROTOCOL_DESCRIPTION=The AOL ICQ service protocol plugin.icqaccregwizz.USERNAME=ICQ Number: plugin.icqaccregwizz.REGISTER_NEW_ACCOUNT_TEXT=In case you don't have an ICQ account, click on this button to create a new one. plugin.icqaccregwizz.REGISTER_NEW_ACCOUNT=Register new account -plugin.icqaccregwizz.PROXY=Proxy -plugin.icqaccregwizz.PROXY_PORT=Proxy port -plugin.icqaccregwizz.PROXY_USERNAME=Proxy username -plugin.icqaccregwizz.PROXY_PASSWORD=Proxy password -plugin.icqaccregwizz.PROXY_TYPE=Proxy type # irc accregwizz plugin.ircaccregwizz.PROTOCOL_NAME=IRC @@ -877,3 +866,15 @@ plugin.otr.activator.unverifiedsessionstared=Unverified private conversat plugin.otr.activator.sessionstared=Private conversation with {0} started. plugin.otr.activator.sessionfinished={0} has ended his/her private conversation with you; you should do the same. plugin.otr.activator.sessionlost=Private conversation with {0} lost. + +# global proxy plugin +plugin.globalproxy.GLOBAL_PROXY_CONFIG=Global Proxy Configuration +plugin.globalproxy.PROXY_TYPE=Proxy Type +plugin.globalproxy.PROXY_ADDRESS=Proxy Server +plugin.globalproxy.PROXY_PORT=Proxy port +plugin.globalproxy.PROXY_USERNAME=Proxy username +plugin.globalproxy.PROXY_PASSWORD=Proxy password +plugin.globalproxy.DESCRIPTION={0} will use the above proxy \ +settings for all networks you connect or reconnect to from now on. \n\ +Proxy support is currently experimental and only works with some protocols like \ +Jabber, AIM, and ICQ. Others will follow. diff --git a/src/net/java/sip/communicator/impl/gui/main/login/CertificateVerificationServiceImpl.java b/src/net/java/sip/communicator/impl/gui/main/login/CertificateVerificationServiceImpl.java index 68ba66053..ac00928bd 100644 --- a/src/net/java/sip/communicator/impl/gui/main/login/CertificateVerificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/main/login/CertificateVerificationServiceImpl.java @@ -143,8 +143,13 @@ private void init() this.getContentPane().add(imgLabel, BorderLayout.WEST); String descriptionTxt = GuiActivator.getResources() - .getI18NString("service.gui.CERT_DIALOG_DESCRIPTION_TXT", - new String[]{host, String.valueOf(port)}); + .getI18NString( + "service.gui.CERT_DIALOG_DESCRIPTION_TXT", + new String[]{ + GuiActivator.getResources().getSettingsString( + "service.gui.APPLICATION_NAME"), + host, + String.valueOf(port)}); JTextArea descriptionLabel = new JTextArea(); descriptionLabel.setEditable(false); diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java index 72c99c7b8..fa807537c 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java @@ -310,18 +310,23 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) aimSession = session.openAimSession( new Screenname(getAccountID().getUserID())); - String proxyAddress = - getAccountID().getAccountPropertyString( - ProtocolProviderFactory.PROXY_ADDRESS); - if(proxyAddress != null && proxyAddress.length() > 0) + String globalProxyType = + IcqActivator.getConfigurationService() + .getString(ProxyInfo.CONNECTON_PROXY_TYPE_PROPERTY_NAME); + if(globalProxyType != null && + !globalProxyType.equals(ProxyInfo.ProxyType.NONE.name())) { - String proxyPortStr = - getAccountID().getAccountPropertyString( - ProtocolProviderFactory.PROXY_PORT); + String globalProxyAddress = + IcqActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_ADDRESS_PROPERTY_NAME); + String globalProxyPortStr = + IcqActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_PORT_PROPERTY_NAME); + int proxyPort; try { - proxyPort = Integer.parseInt(proxyPortStr); + proxyPort = Integer.parseInt(globalProxyPortStr); } catch (NumberFormatException ex) { @@ -329,22 +334,21 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) OperationFailedException.INVALID_ACCOUNT_PROPERTIES, ex); } - String proxyType = - getAccountID().getAccountPropertyString( - ProtocolProviderFactory.PROXY_TYPE); - - if(proxyType == null) - throw new OperationFailedException("Missing proxy type", + String globalProxyUsername = + IcqActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_USERNAME_PROPERTY_NAME); + String globalProxyPassword = + IcqActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_PASSWORD_PROPERTY_NAME); + if(globalProxyAddress == null || + globalProxyAddress.length() <= 0) + { + throw new OperationFailedException( + "Missing Proxy Address", OperationFailedException.INVALID_ACCOUNT_PROPERTIES); + } - String proxyUsername = - getAccountID().getAccountPropertyString( - ProtocolProviderFactory.PROXY_USERNAME); - String proxyPassword = - getAccountID().getAccountPropertyString( - ProtocolProviderFactory.PROXY_PASSWORD); - - if(proxyType.equals("http")) + if(globalProxyType.equals(ProxyInfo.ProxyType.HTTP.name())) { // If we are using http proxy, sometimes // default port 5190 is forbidden, so force @@ -356,9 +360,9 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) connProps.setLoginHost("login.icq.com"); connProps.setLoginPort(443); aimConnection = aimSession.openConnection(connProps); - aimConnection.setProxy( - AimProxyInfo.forHttp(proxyAddress, proxyPort, - proxyUsername, proxyPassword)); + aimConnection.setProxy(AimProxyInfo.forHttp( + globalProxyAddress, proxyPort, + globalProxyUsername, globalProxyPassword)); } else { @@ -367,14 +371,20 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) new Screenname(getAccountID().getUserID()) , password)); - if(proxyType.equals("socks4")) - aimConnection.setProxy( - AimProxyInfo.forSocks4(proxyAddress, proxyPort, - proxyUsername)); - else if(proxyType.equals("socks5")) - aimConnection.setProxy( - AimProxyInfo.forSocks5(proxyAddress, proxyPort, - proxyUsername, proxyPassword)); + if(globalProxyType.equals( + ProxyInfo.ProxyType.SOCKS4.name())) + { + aimConnection.setProxy(AimProxyInfo.forSocks4( + globalProxyAddress, proxyPort, + globalProxyUsername)); + } + else if(globalProxyType.equals( + ProxyInfo.ProxyType.SOCKS5.name())) + { + aimConnection.setProxy(AimProxyInfo.forSocks5( + globalProxyAddress, proxyPort, + globalProxyUsername, globalProxyPassword)); + } } } else diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index bc0e1ffd1..f142601e0 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -339,11 +339,88 @@ private synchronized void connectAndLogin(SecurityAuthority authority, try { + //Getting global proxy information from configuration files + org.jivesoftware.smack.proxy.ProxyInfo proxy = null; + String globalProxyType = + JabberActivator.getConfigurationService() + .getString(ProxyInfo.CONNECTON_PROXY_TYPE_PROPERTY_NAME); + if(globalProxyType == null || + globalProxyType.equals(ProxyInfo.ProxyType.NONE.name())) + { + proxy = org.jivesoftware.smack.proxy.ProxyInfo + .forNoProxy(); + } + else + { + String globalProxyAddress = + JabberActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_ADDRESS_PROPERTY_NAME); + String globalProxyPortStr = + JabberActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_PORT_PROPERTY_NAME); + int globalProxyPort; + try + { + globalProxyPort = Integer.parseInt( + globalProxyPortStr); + } + catch(NumberFormatException ex) + { + throw new OperationFailedException("Wrong port", + OperationFailedException.INVALID_ACCOUNT_PROPERTIES, + ex); + } + String globalProxyUsername = + JabberActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_USERNAME_PROPERTY_NAME); + String globalProxyPassword = + JabberActivator.getConfigurationService().getString( + ProxyInfo.CONNECTON_PROXY_PASSWORD_PROPERTY_NAME); + if(globalProxyAddress == null || + globalProxyAddress.length() <= 0) + { + throw new OperationFailedException( + "Missing Proxy Address", + OperationFailedException.INVALID_ACCOUNT_PROPERTIES); + } + if(globalProxyType.equals( + ProxyInfo.ProxyType.HTTP.name())) + { + proxy = org.jivesoftware.smack.proxy.ProxyInfo + .forHttpProxy( + globalProxyAddress, + globalProxyPort, + globalProxyUsername, + globalProxyPassword); + } + else if(globalProxyType.equals( + ProxyInfo.ProxyType.SOCKS4.name())) + { + proxy = org.jivesoftware.smack.proxy.ProxyInfo + .forSocks4Proxy( + globalProxyAddress, + globalProxyPort, + globalProxyUsername, + globalProxyPassword); + } + else if(globalProxyType.equals( + ProxyInfo.ProxyType.SOCKS5.name())) + { + proxy = org.jivesoftware.smack.proxy.ProxyInfo + .forSocks5Proxy( + globalProxyAddress, + globalProxyPort, + globalProxyUsername, + globalProxyPassword); + } + } + ConnectionConfiguration confConn = new ConnectionConfiguration( serverAddress, Integer.parseInt(serverPort), - serviceName + serviceName, + proxy ); confConn.setReconnectionAllowed(false); connection = new XMPPConnection(confConn); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf index 06fea2882..7e32c7a02 100755 --- a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf +++ b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf @@ -14,6 +14,7 @@ Import-Package: org.osgi.framework, org.jivesoftware.smackx, org.jivesoftware.smackx.muc, org.jivesoftware.smackx.packet, + org.jivesoftware.smack.proxy, org.jivesoftware.smackx.jingle, org.jivesoftware.smackx.jingle.listeners, org.jivesoftware.smackx.jingle.media, diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistration.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistration.java index 2b4ab7bc0..c02f3d41e 100644 --- a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistration.java @@ -35,16 +35,6 @@ public class AimAccountRegistration */ private boolean rememberPassword = true; - private String proxyPort; - - private String proxy; - - private String proxyType = "http"; - - private String proxyUsername; - - private String proxyPassword; - /** * Returns the password of the aim registration account. * @return the password of the aim registration account. @@ -104,94 +94,4 @@ public void setUin(String uin) { this.uin = uin; } - - /** - * Returns the proxy that will be used for this aim account. - * @return the proxy that will be used for this aim account. - */ - public String getProxy() - { - return proxy; - } - - /** - * Sets the proxy for this aim account. - * @param proxy the proxy for this aim account. - */ - public void setProxy(String proxy) - { - this.proxy = proxy; - } - - /** - * Returns the proxy port that will be used for this aim account. - * @return the proxy port that will be used for this aim account. - */ - public String getProxyPort() - { - return proxyPort; - } - - /** - * Sets the proxy port for this aim account. - * @param proxyPort the proxy port for this aim account. - */ - public void setProxyPort(String proxyPort) - { - this.proxyPort = proxyPort; - } - - /** - * Returns the proxy type that will be used for this aim account. - * @return the proxy type that will be used for this aim account. - */ - public String getProxyType() - { - return proxyType; - } - - /** - * Sets the proxy type for this aim account. - * @param proxyType the proxy type for this aim account - */ - public void setProxyType(String proxyType) - { - this.proxyType = proxyType; - } - - /** - * Returns the proxy password of the aim registration account. - * @return the proxy password of the aim registration account. - */ - public String getProxyPassword() - { - return proxyPassword; - } - - /** - * Sets the proxy password of the aim registration account. - * @param password the proxy password of the aim registration account. - */ - public void setProxyPassword(String password) - { - this.proxyPassword = password; - } - - /** - * Returns the proxy username of the aim registration account. - * @return the proxy username of the aim registration account. - */ - public String getProxyUsername() - { - return proxyUsername; - } - - /** - * Sets the proxy username of the aim registration account. - * @param username the proxy username of the aim registration account - */ - public void setProxyUsername(String username) - { - this.proxyUsername = username; - } } diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java index a82f66e65..1b00a5165 100644 --- a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java @@ -24,6 +24,9 @@ public class AimAccountRegistrationWizard implements AccountRegistrationWizard { + /** + * The logger. + */ private final Logger logger = Logger.getLogger(AimAccountRegistrationWizard.class); @@ -116,34 +119,14 @@ public Iterator> getSummary() summaryTable.put(Resources.getString("service.gui.REMEMBER_PASSWORD"), Boolean.toString(registration.isRememberPassword())); - if (registration.getProxy() != null) - summaryTable.put(Resources.getString("plugin.aimaccregwizz.PROXY"), - registration.getProxy()); - - if (registration.getProxyPort() != null) - summaryTable.put(Resources.getString("plugin.aimaccregwizz.PROXY"), - registration.getProxyPort()); - - if (registration.getProxyType() != null) - summaryTable.put( - Resources.getString("plugin.aimaccregwizz.PROXY_TYPE"), - registration.getProxyType()); - - if (registration.getProxyPort() != null) - summaryTable.put( - Resources.getString("plugin.aimaccregwizz.PROXY_USERNAME"), - registration.getProxyPort()); - - if (registration.getProxyType() != null) - summaryTable.put( - Resources.getString("plugin.aimaccregwizz.PROXY_PASSWORD"), - registration.getProxyType()); - return summaryTable.entrySet().iterator(); } /** * Installs the account created through this wizard. + * @return the ProtocolProviderService for the newly created + * account. + * @throws OperationFailedException */ public ProtocolProviderService signin() throws OperationFailedException @@ -159,6 +142,8 @@ public ProtocolProviderService signin() * * @param userName the user name to sign in with * @param password the password to sign in with + * @return the ProtocolProviderService for the new account. + * @throws OperationFailedException */ public ProtocolProviderService signin(String userName, String password) throws OperationFailedException @@ -177,6 +162,7 @@ public ProtocolProviderService signin(String userName, String password) * @param user the user identifier * @param passwd the password * @return the ProtocolProviderService for the new account. + * @throws OperationFailedException */ public ProtocolProviderService installAccount( ProtocolProviderFactory providerFactory, String user, String passwd) @@ -190,31 +176,6 @@ public ProtocolProviderService installAccount( accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd); } - if (registration.getProxy() != null - && registration.getProxy().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS, - registration.getProxy()); - - if (registration.getProxyPort() != null - && registration.getProxyPort().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_PORT, - registration.getProxyPort()); - - if (registration.getProxyType() != null - && registration.getProxyType().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_TYPE, - registration.getProxyType()); - - if (registration.getProxyUsername() != null - && registration.getProxyUsername().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME, - registration.getProxyUsername()); - - if (registration.getProxyPassword() != null - && registration.getProxyPassword().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD, - registration.getProxyPassword()); - if (isModification) { providerFactory.modifyAccount( protocolProvider, diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java index ad4641e7e..39a0d7b7a 100644 --- a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java @@ -38,15 +38,6 @@ public class FirstWizardPage private JPanel valuesPanel = new TransparentPanel(); - private JPanel advancedOpPanel = - new TransparentPanel(new BorderLayout(10, 10)); - - private JPanel labelsAdvOpPanel = - new TransparentPanel(new GridLayout(0, 1, 10, 10)); - - private JPanel valuesAdvOpPanel = - new TransparentPanel(new GridLayout(0, 1, 10, 10)); - private JLabel uinLabel = new JLabel( Resources.getString("plugin.aimaccregwizz.USERNAME")); @@ -78,32 +69,6 @@ public class FirstWizardPage new JButton(Resources.getString( "plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT")); - private JLabel proxyLabel = new JLabel( - Resources.getString("plugin.aimaccregwizz.PROXY")); - - private JLabel proxyPortLabel = - new JLabel(Resources.getString("plugin.aimaccregwizz.PROXY")); - - private JLabel proxyUsernameLabel = - new JLabel(Resources.getString("plugin.aimaccregwizz.PROXY_USERNAME")); - - private JLabel proxyPasswordLabel = - new JLabel(Resources.getString("plugin.aimaccregwizz.PROXY_PASSWORD")); - - private JLabel proxyTypeLabel = - new JLabel(Resources.getString("plugin.aimaccregwizz.PROXY_TYPE")); - - private JTextField proxyField = new JTextField(); - - private JTextField proxyPortField = new JTextField(); - - private JTextField proxyUsernameField = new JTextField(); - - private JPasswordField proxyPassField = new JPasswordField(); - - private JComboBox proxyTypeCombo = new JComboBox(new Object[] - { "http", "socks5", "socks4" }); - private JPanel mainPanel = new TransparentPanel(); private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER; @@ -178,28 +143,6 @@ private void init() mainPanel.add(uinPassPanel); - proxyTypeCombo.setSelectedItem(wizard.getRegistration().getProxyType()); - - labelsAdvOpPanel.add(proxyLabel); - labelsAdvOpPanel.add(proxyPortLabel); - labelsAdvOpPanel.add(proxyTypeLabel); - labelsAdvOpPanel.add(proxyUsernameLabel); - labelsAdvOpPanel.add(proxyPasswordLabel); - - valuesAdvOpPanel.add(proxyField); - valuesAdvOpPanel.add(proxyPortField); - valuesAdvOpPanel.add(proxyTypeCombo); - valuesAdvOpPanel.add(proxyUsernameField); - valuesAdvOpPanel.add(proxyPassField); - - advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST); - advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER); - - advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources - .getString("plugin.aimaccregwizz.ADVANCED_OPTIONS"))); - - mainPanel.add(advancedOpPanel); - this.buttonPanel.add(registerButton); this.registerArea.setEditable(false); @@ -280,18 +223,6 @@ public void commitPage() registration.setPassword(new String(passField.getPassword())); registration.setRememberPassword(rememberPassBox.isSelected()); - registration.setProxy(proxyField.getText()); - registration.setProxyPort(proxyPortField.getText()); - registration.setProxyUsername(proxyUsernameField.getText()); - - if (proxyTypeCombo.getSelectedItem() != null) - registration.setProxyType(proxyTypeCombo.getSelectedItem() - .toString()); - - if (proxyPassField.getPassword() != null) - registration.setProxyPassword(new String(proxyPassField - .getPassword())); - nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER; isCommitted = true; @@ -373,32 +304,6 @@ public void loadAccount(ProtocolProviderService protocolProvider) this.rememberPassBox.setSelected( wizard.getRegistration().isRememberPassword()); } - - String proxyAddress = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_ADDRESS); - - String proxyPort = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_PORT); - - String proxyType = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_TYPE); - - String proxyUsername = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_USERNAME); - - String proxyPassword = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_PASSWORD); - - proxyField.setText(proxyAddress); - proxyPortField.setText(proxyPort); - proxyTypeCombo.setSelectedItem(proxyType); - proxyUsernameField.setText(proxyUsername); - proxyPassField.setText(proxyPassword); } public void actionPerformed(ActionEvent e) @@ -406,11 +311,19 @@ public void actionPerformed(ActionEvent e) wizard.webSignup(); } + /** + * The simple form for this wizard. + * @return + */ public Object getSimpleForm() { return uinPassPanel; } + /** + * Whether is committed. + * @return + */ public boolean isCommitted() { return isCommitted; diff --git a/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyConfigForm.java b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyConfigForm.java new file mode 100644 index 000000000..bb55c0326 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyConfigForm.java @@ -0,0 +1,279 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. See terms of license at gnu.org. + */ +package net.java.sip.communicator.plugin.globalproxyconfig; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; +import net.java.sip.communicator.service.configuration.*; + +import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.swing.*; + +/** + * Implementation of the configuration form. + * + * @author Damian Minkov + */ +public class GlobalProxyConfigForm + extends TransparentPanel + implements ActionListener +{ + /** + * Hold the available proxy types. + */ + private JComboBox typeCombo; + + /** + * The proxy server address. + */ + private JTextField serverAddressField = new JTextField(); + + /** + * The proxy server port. + */ + private JTextField portField = new JTextField(); + + /** + * The username if any. + */ + private JTextField usernameField = new JTextField(); + + /** + * The password for accessing proxy, if any. + */ + private JPasswordField passwordField = new JPasswordField(); + + /** + * Creates the form. + */ + public GlobalProxyConfigForm() + { + super(new BorderLayout()); + + init(); + loadValues(); + } + + /** + * Creating the configuration form + */ + private void init() + { + this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); + TransparentPanel centerPanel = new TransparentPanel(new GridBagLayout()); + + GridBagConstraints constraints = new GridBagConstraints(); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.anchor = GridBagConstraints.NORTHWEST; + constraints.insets = new Insets(5,10,0,0); + constraints.gridx = 0; + constraints.weightx = 0; + constraints.weighty = 0; + constraints.gridy = 0; + + centerPanel.add(new JLabel( + Resources.getString("plugin.globalproxy.PROXY_TYPE")), + constraints); + constraints.gridy = 1; + centerPanel.add(new JLabel( + Resources.getString("plugin.globalproxy.PROXY_ADDRESS")), + constraints); + constraints.gridy = 2; + centerPanel.add(new JLabel( + Resources.getString("plugin.globalproxy.PROXY_USERNAME")), + constraints); + constraints.gridy = 3; + centerPanel.add(new JLabel( + Resources.getString("plugin.globalproxy.PROXY_PASSWORD")), + constraints); + + constraints.weightx = 1; + constraints.gridx = 1; + constraints.gridy = 0; + constraints.gridwidth = 3; + typeCombo = new JComboBox(ProxyInfo.ProxyType.values()); + typeCombo.addActionListener(this); + typeCombo.setEditable(false); + centerPanel.add(typeCombo, constraints); + + constraints.gridy = 1; + constraints.gridwidth = 1; + centerPanel.add(serverAddressField, constraints); + constraints.gridx = 2; + constraints.weightx = 0; + centerPanel.add( + new JLabel( + Resources.getString("plugin.globalproxy.PROXY_PORT")), + constraints); + constraints.gridx = 3; + constraints.weightx = 1; + centerPanel.add(portField, constraints); + + constraints.gridx = 1; + constraints.gridwidth = 3; + constraints.gridy = 2; + centerPanel.add(usernameField, constraints); + constraints.gridy = 3; + centerPanel.add(passwordField, constraints); + + constraints.gridx = 0; + constraints.gridy = 4; + constraints.gridwidth = 4; + constraints.gridheight = 2; + constraints.insets = new Insets(20,20,20,20); + JTextPane pane = new JTextPane(); + pane.setEditable(false); + pane.setOpaque(false); + pane.setText(Resources.getResources().getI18NString( + "plugin.globalproxy.DESCRIPTION", + new String[]{Resources.getResources().getSettingsString( + "service.gui.APPLICATION_NAME")})); + centerPanel.add( + pane, + constraints); + + add(centerPanel, BorderLayout.NORTH); + + TransparentPanel p = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); + JButton saveButton = new JButton( + Resources.getString("service.gui.SAVE")); + saveButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) + { + saveValues(); + } + }); + p.add(saveButton); + + add(p, BorderLayout.SOUTH); + } + + /** + * Loading the values stored onto configuration form + */ + private void loadValues() + { + ConfigurationService configService = + GlobalProxyPluginActivator.getConfigurationService(); + + try + { + String type = configService.getString( + ProxyInfo.CONNECTON_PROXY_TYPE_PROPERTY_NAME); + if(type != null) + typeCombo.setSelectedItem(ProxyInfo.ProxyType.valueOf(type)); + } catch (IllegalArgumentException e) + { + // wrong proxy type stored in configuration + } + + String serverAddress = configService.getString( + ProxyInfo.CONNECTON_PROXY_ADDRESS_PROPERTY_NAME); + if(serverAddress != null) + serverAddressField.setText(serverAddress); + + String port = configService.getString( + ProxyInfo.CONNECTON_PROXY_PORT_PROPERTY_NAME); + if(port != null) + portField.setText(port); + + String username = configService.getString( + ProxyInfo.CONNECTON_PROXY_USERNAME_PROPERTY_NAME); + if(username != null) + usernameField.setText(username); + + String password = configService.getString( + ProxyInfo.CONNECTON_PROXY_USERNAME_PROPERTY_NAME); + if(password != null) + passwordField.setText(password); + + if(typeCombo.getSelectedItem().equals(ProxyInfo.ProxyType.NONE)) + { + serverAddressField.setEnabled(false); + portField.setEnabled(false); + usernameField.setEnabled(false); + passwordField.setEnabled(false); + } + } + + /** + * Function which save values onto configuration file after save button is + * clicked + */ + private void saveValues() + { + ConfigurationService configService = + GlobalProxyPluginActivator.getConfigurationService(); + + if(typeCombo.getSelectedItem().equals(ProxyInfo.ProxyType.NONE)) + { + configService.setProperty( + ProxyInfo.CONNECTON_PROXY_TYPE_PROPERTY_NAME, + ProxyInfo.ProxyType.NONE.name()); + + configService.removeProperty( + ProxyInfo.CONNECTON_PROXY_ADDRESS_PROPERTY_NAME); + configService.removeProperty( + ProxyInfo.CONNECTON_PROXY_PORT_PROPERTY_NAME); + configService.removeProperty( + ProxyInfo.CONNECTON_PROXY_USERNAME_PROPERTY_NAME); + configService.removeProperty( + ProxyInfo.CONNECTON_PROXY_PASSWORD_PROPERTY_NAME); + + return; + } + + configService.setProperty( + ProxyInfo.CONNECTON_PROXY_TYPE_PROPERTY_NAME, + ((ProxyInfo.ProxyType)typeCombo.getSelectedItem()).name()); + + String serverAddress = serverAddressField.getText(); + if(serverAddress != null && serverAddress.length() > 0) + configService.setProperty( + ProxyInfo.CONNECTON_PROXY_ADDRESS_PROPERTY_NAME, serverAddress); + + String port = portField.getText(); + if(port != null && port.length() > 0) + configService.setProperty( + ProxyInfo.CONNECTON_PROXY_PORT_PROPERTY_NAME, port); + + String username = usernameField.getText(); + if(username != null && username.length() > 0) + configService.setProperty( + ProxyInfo.CONNECTON_PROXY_USERNAME_PROPERTY_NAME, username); + + char[] password = passwordField.getPassword(); + if(password.length > 0) + configService.setProperty( + ProxyInfo.CONNECTON_PROXY_PASSWORD_PROPERTY_NAME, + new String(password)); + } + + /** + * A new type was selected in the type combo box. + * @param e the event + */ + public void actionPerformed(ActionEvent e) + { + if(typeCombo.getSelectedItem().equals(ProxyInfo.ProxyType.NONE)) + { + serverAddressField.setEnabled(false); + portField.setEnabled(false); + usernameField.setEnabled(false); + passwordField.setEnabled(false); + } + else + { + serverAddressField.setEnabled(true); + portField.setEnabled(true); + usernameField.setEnabled(true); + passwordField.setEnabled(true); + } + } +} diff --git a/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java new file mode 100644 index 000000000..5767a01ce --- /dev/null +++ b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java @@ -0,0 +1,90 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.plugin.globalproxyconfig; + +import net.java.sip.communicator.service.configuration.*; +import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.util.*; + +import org.osgi.framework.*; + +/** + * Register the configuration form. + * + * @author Atul Aggarwal + * @author Damian Minkov + */ +public class GlobalProxyPluginActivator implements BundleActivator +{ + /** + * Our logger. + */ + private Logger logger = Logger.getLogger(GlobalProxyPluginActivator.class); + + /** + * The Configuration service. + */ + private static ConfigurationService configService; + + /** + * The context of this bundle. + */ + protected static BundleContext bundleContext; + + /** + * Starts the bundle. + * @param bc the context + * @throws Exception + */ + public void start(BundleContext bc) throws Exception + { + bundleContext = bc; + + GlobalProxyConfigForm proxyConfigForm = new GlobalProxyConfigForm(); + + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + GlobalProxyConfigForm.class.getName(), + getClass().getClassLoader(), + "plugin.globalproxy.PLUGIN_ICON", + "plugin.globalproxy.GLOBAL_PROXY_CONFIG", + 51), + null); + + logger.info("GLOBAL PROXY CONFIGURATION PLUGIN... [REGISTERED]"); + } + + /** + * Stops it. + * @param bc the context. + * @throws Exception + */ + public void stop(BundleContext bc) throws Exception + { + } + + /** + * Returns the ConfigurationService obtained from the bundle + * context. + * @return the ConfigurationService obtained from the bundle + * context + */ + public static ConfigurationService getConfigurationService() + { + if(configService == null) + { + ServiceReference configReference = bundleContext + .getServiceReference(ConfigurationService.class.getName()); + + configService = (ConfigurationService) bundleContext + .getService(configReference); + } + + return configService; + } +} diff --git a/src/net/java/sip/communicator/plugin/globalproxyconfig/Resources.java b/src/net/java/sip/communicator/plugin/globalproxyconfig/Resources.java new file mode 100644 index 000000000..07e31ba71 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/globalproxyconfig/Resources.java @@ -0,0 +1,75 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + +package net.java.sip.communicator.plugin.globalproxyconfig; + +import net.java.sip.communicator.service.resources.*; +import net.java.sip.communicator.util.*; + +import org.osgi.framework.*; + +/** + * The Resources class manages the access to the internationalization + * properties files and the image resources used in this plugin. + * + * @author Atul Aggarwal + * @author Damian Minkov + */ +public class Resources +{ + /** + * Our logger. + */ + private static Logger log = Logger.getLogger(Resources.class); + + /** + * The resource management service. + */ + private static ResourceManagementService resourcesService; + + /** + * Returns an internationalized string corresponding to the given key. + * @param key The key of the string. + * @return An internationalized string corresponding to the given key. + */ + public static String getString(String key) + { + return getResources().getI18NString(key); + } + + /** + * Returns an application property string corresponding to the given key. + * @param key The key of the string. + * @return A string corresponding to the given key. + */ + public static String getApplicationString(String key) + { + return getResources().getSettingsString(key); + } + + /** + * Returns the resource service. + * @return + */ + public static ResourceManagementService getResources() + { + if (resourcesService == null) + { + ServiceReference serviceReference = GlobalProxyPluginActivator.bundleContext + .getServiceReference(ResourceManagementService.class.getName()); + + if(serviceReference == null) + return null; + + resourcesService = + (ResourceManagementService)GlobalProxyPluginActivator.bundleContext + .getService(serviceReference); + } + + return resourcesService; + } +} diff --git a/src/net/java/sip/communicator/plugin/globalproxyconfig/globalproxyconfig.manifest.mf b/src/net/java/sip/communicator/plugin/globalproxyconfig/globalproxyconfig.manifest.mf new file mode 100644 index 000000000..0fc6afd93 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/globalproxyconfig/globalproxyconfig.manifest.mf @@ -0,0 +1,26 @@ +Bundle-Activator: net.java.sip.communicator.plugin.globalproxyconfig.GlobalProxyPluginActivator +Bundle-Name: Global Proxy Config Plugin +Bundle-Description: A plugin to configure global proxy for sip communicator +Bundle-Vendor: sip-communicator.org +Bundle-Version: 0.0.1 +Import-Package: org.osgi.framework, + net.java.sip.communicator.util, + net.java.sip.communicator.util.swing, + net.java.sip.communicator.service.gui, + net.java.sip.communicator.service.protocol, + net.java.sip.communicator.service.resources, + net.java.sip.communicator.service.configuration, + javax.swing, + javax.swing.event, + javax.swing.table, + javax.swing.text, + javax.swing.text.html, + javax.accessibility, + javax.swing.plaf, + javax.swing.plaf.metal, + javax.swing.plaf.basic, + javax.imageio, + javax.swing.filechooser, + javax.swing.tree, + javax.swing.undo, + javax.swing.border diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java index 391fd2d4d..f4d573397 100644 --- a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java @@ -36,15 +36,6 @@ public class FirstWizardPage private JPanel valuesPanel = new TransparentPanel(); - private JPanel advancedOpPanel - = new TransparentPanel(new BorderLayout(10, 10)); - - private JPanel labelsAdvOpPanel - = new TransparentPanel(new GridLayout(0, 1, 10, 10)); - - private JPanel valuesAdvOpPanel - = new TransparentPanel(new GridLayout(0, 1, 10, 10)); - private JLabel uinLabel = new JLabel(Resources.getString("plugin.icqaccregwizz.USERNAME")); @@ -73,32 +64,6 @@ public class FirstWizardPage private JButton registerButton = new JButton( Resources.getString("plugin.icqaccregwizz.REGISTER_NEW_ACCOUNT")); - private JLabel proxyLabel = new JLabel( - Resources.getString("plugin.icqaccregwizz.PROXY")); - - private JLabel proxyPortLabel = - new JLabel(Resources.getString("plugin.icqaccregwizz.PROXY_PORT")); - - private JLabel proxyUsernameLabel = - new JLabel(Resources.getString("plugin.icqaccregwizz.PROXY_USERNAME")); - - private JLabel proxyPasswordLabel = - new JLabel(Resources.getString("plugin.icqaccregwizz.PROXY_PASSWORD")); - - private JLabel proxyTypeLabel = - new JLabel(Resources.getString("plugin.icqaccregwizz.PROXY_TYPE")); - - private JTextField proxyField = new JTextField(); - - private JTextField proxyPortField = new JTextField(); - - private JTextField proxyUsernameField = new JTextField(); - - private JPasswordField proxyPassField = new JPasswordField(); - - private JComboBox proxyTypeCombo = new JComboBox(new Object[] - { "http", "socks5", "socks4" }); - private JPanel mainPanel = new TransparentPanel(); private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER; @@ -171,28 +136,6 @@ private void init() mainPanel.add(uinPassPanel); - proxyTypeCombo.setSelectedItem(wizard.getRegistration().getProxyType()); - - labelsAdvOpPanel.add(proxyLabel); - labelsAdvOpPanel.add(proxyPortLabel); - labelsAdvOpPanel.add(proxyTypeLabel); - labelsAdvOpPanel.add(proxyUsernameLabel); - labelsAdvOpPanel.add(proxyPasswordLabel); - - valuesAdvOpPanel.add(proxyField); - valuesAdvOpPanel.add(proxyPortField); - valuesAdvOpPanel.add(proxyTypeCombo); - valuesAdvOpPanel.add(proxyUsernameField); - valuesAdvOpPanel.add(proxyPassField); - - advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST); - advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER); - - advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources - .getString("plugin.aimaccregwizz.ADVANCED_OPTIONS"))); - - mainPanel.add(advancedOpPanel); - this.buttonPanel.add(registerButton); this.registerArea.setEditable(false); @@ -275,19 +218,6 @@ public void commitPage() registration.setPassword(new String(passField.getPassword())); registration.setRememberPassword(rememberPassBox.isSelected()); - registration.setProxy(proxyField.getText()); - registration.setProxyPort(proxyPortField.getText()); - - if (proxyTypeCombo.getSelectedItem() != null) - registration.setProxyType( - proxyTypeCombo.getSelectedItem().toString()); - - registration.setProxyUsername(proxyUsernameField.getText()); - - if (proxyPassField.getPassword() != null) - registration.setProxyPassword( - new String(proxyPassField.getPassword())); - nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER; isCommitted = true; @@ -369,32 +299,6 @@ public void loadAccount(ProtocolProviderService protocolProvider) this.rememberPassBox.setSelected(true); } - - String proxyAddress = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_ADDRESS); - - String proxyPort = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_PORT); - - String proxyType = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_TYPE); - - String proxyUsername = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_USERNAME); - - String proxyPassword = - accountID - .getAccountPropertyString(ProtocolProviderFactory.PROXY_PASSWORD); - - proxyField.setText(proxyAddress); - proxyPortField.setText(proxyPort); - proxyTypeCombo.setSelectedItem(proxyType); - proxyUsernameField.setText(proxyUsername); - proxyPassField.setText(proxyPassword); } public void actionPerformed(ActionEvent e) diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java index 4727aac20..144b621ed 100644 --- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java @@ -20,16 +20,6 @@ public class IcqAccountRegistration private boolean rememberPassword = true; - private String proxyPort; - - private String proxy; - - private String proxyType = "http"; - - private String proxyUsername; - - private String proxyPassword; - /** * Returns the password of the icq registration account. * @return the password of the icq registration account. @@ -78,84 +68,4 @@ public String getUin() { public void setUin(String uin) { this.uin = uin; } - - /** - * Returns the proxy that will be used for this icq account. - * @return the proxy that will be used for this icq account. - */ - public String getProxy() { - return proxy; - } - - /** - * Sets the proxy for this icq account. - * @param proxy the proxy for this icq account. - */ - public void setProxy(String proxy) { - this.proxy = proxy; - } - - /** - * Returns the proxy port that will be used for this icq account. - * @return the proxy port that will be used for this icq account. - */ - public String getProxyPort() { - return proxyPort; - } - - /** - * Sets the proxy port for this icq account. - * @param proxyPort the proxy port for this icq account. - */ - public void setProxyPort(String proxyPort) { - this.proxyPort = proxyPort; - } - - /** - * Returns the proxy type that will be used for this icq account. - * @return the proxy type that will be used for this icq account. - */ - public String getProxyType() { - return proxyType; - } - - /** - * Sets the proxy type for this icq account. - * @param proxyType the proxy type for this icq account - */ - public void setProxyType(String proxyType) { - this.proxyType = proxyType; - } - - /** - * Returns the proxy password of the icq registration account. - * @return the proxy password of the icq registration account. - */ - public String getProxyPassword() { - return proxyPassword; - } - - /** - * Sets the proxy password of the icq registration account. - * @param password the proxy password of the icq registration account. - */ - public void setProxyPassword(String password) { - this.proxyPassword = password; - } - - /** - * Returns the proxy username of the icq registration account. - * @return the proxy username of the icq registration account. - */ - public String getProxyUsername() { - return proxyUsername; - } - - /** - * Sets the proxy username of the icq registration account. - * @param username the proxy username of the icq registration account - */ - public void setProxyUsername(String username) { - this.proxyUsername = username; - } } diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java index 8acb16b9a..8f07339d4 100644 --- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java @@ -24,6 +24,9 @@ public class IcqAccountRegistrationWizard implements AccountRegistrationWizard { + /** + * The logger. + */ private final Logger logger = Logger.getLogger(IcqAccountRegistrationWizard.class); @@ -115,26 +118,6 @@ public Iterator> getSummary() summaryTable.put(Resources.getString("service.gui.REMEMBER_PASSWORD"), Boolean.toString(registration.isRememberPassword())); - if (registration.getProxy() != null) - summaryTable.put(Resources.getString("plugin.icqaccregwizz.PROXY"), - registration.getProxy()); - - if (registration.getProxyPort() != null) - summaryTable.put(Resources.getString("proxyPort"), - registration.getProxyPort()); - - if (registration.getProxyType() != null) - summaryTable.put(Resources.getString("proxyType"), - registration.getProxyType()); - - if (registration.getProxyPort() != null) - summaryTable.put(Resources.getString("proxyUsername"), - registration.getProxyUsername()); - - if (registration.getProxyType() != null) - summaryTable.put(Resources.getString("proxyPassword"), - registration.getProxyPassword()); - return summaryTable.entrySet().iterator(); } @@ -143,6 +126,7 @@ public Iterator> getSummary() * * @return the ProtocolProviderService for the newly created * account. + * @throws OperationFailedException */ public ProtocolProviderService signin() throws OperationFailedException @@ -170,6 +154,7 @@ public ProtocolProviderService signin(String userName, String password) * @param user the user identifier * @param passwd the password * @return the ProtocolProviderService for the new account. + * @throws OperationFailedException */ public ProtocolProviderService installAccount( ProtocolProviderFactory providerFactory, @@ -185,31 +170,6 @@ public ProtocolProviderService installAccount( accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd); } - if (registration.getProxy() != null - && registration.getProxy().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS, - registration.getProxy()); - - if (registration.getProxyPort() != null - && registration.getProxyPort().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_PORT, - registration.getProxyPort()); - - if (registration.getProxyType() != null - && registration.getProxyType().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_TYPE, - registration.getProxyType()); - - if (registration.getProxyUsername() != null - && registration.getProxyUsername().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME, - registration.getProxyUsername()); - - if (registration.getProxyPassword() != null - && registration.getProxyPassword().length() != 0) - accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD, - registration.getProxyPassword()); - if (isModification) { providerFactory.modifyAccount( protocolProvider, diff --git a/src/net/java/sip/communicator/service/protocol/ProxyInfo.java b/src/net/java/sip/communicator/service/protocol/ProxyInfo.java new file mode 100644 index 000000000..b370fa8ac --- /dev/null +++ b/src/net/java/sip/communicator/service/protocol/ProxyInfo.java @@ -0,0 +1,69 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.service.protocol; + +/** + * The supported proxy types and properties used to store the values + * in the configuration service. + * + * @author Damian Minkov + */ +public class ProxyInfo +{ + /** + * Enum which stores possible proxy types + */ + public static enum ProxyType + { + /** + * Proxy is not used. + */ + NONE, + /** + * HTTP proxy type. + */ + HTTP, + /** + * Proxy type socks4. + */ + SOCKS4, + /** + * Proxy type socks5. + */ + SOCKS5 + } + + /** + * Stores in the configuration the connection proxy type. + */ + public final static String CONNECTON_PROXY_TYPE_PROPERTY_NAME = + "net.java.sip.communicator.service.connectionProxyType"; + + /** + * Stores in the configuration the connection proxy address. + */ + public final static String CONNECTON_PROXY_ADDRESS_PROPERTY_NAME = + "net.java.sip.communicator.service.connectionProxyAddress"; + + /** + * Stores in the configuration the connection proxy port. + */ + public final static String CONNECTON_PROXY_PORT_PROPERTY_NAME = + "net.java.sip.communicator.service.connectionProxyPort"; + + /** + * Stores in the configuration the connection proxy username. + */ + public final static String CONNECTON_PROXY_USERNAME_PROPERTY_NAME = + "net.java.sip.communicator.service.connectionProxyUsername"; + + /** + * Stores in the configuration the connection proxy password. + */ + public final static String CONNECTON_PROXY_PASSWORD_PROPERTY_NAME = + "net.java.sip.communicator.service.connectionProxyPassword"; +}