diff --git a/lib/installer-exclude/irc-api-1.0.jar b/lib/installer-exclude/irc-api-1.0.jar
index 5e33cc86b..e9d39c8b5 100644
Binary files a/lib/installer-exclude/irc-api-1.0.jar and b/lib/installer-exclude/irc-api-1.0.jar differ
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index 8ba6d1bda..3d42dcf37 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -1073,6 +1073,7 @@ plugin.ircaccregwizz.USE_DEFAULT_PORT=Use default port
plugin.ircaccregwizz.PASSWORD_NOT_REQUIRED=My nickname doesn't require identification
plugin.ircaccregwizz.HOST=Hostname:
plugin.ircaccregwizz.IRC_SERVER=Server
+plugin.ircaccregwizz.USE_SECURE_CONNECTION=Use secure connection
# jabber accregwizz
plugin.jabberaccregwizz.PROTOCOL_NAME=XMPP
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java b/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java
index 202e79e2f..5a812e9d0 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/IrcStack.java
@@ -111,7 +111,7 @@ public boolean isSecureConnection()
* @throws Exception
*/
public void connect(String host, int port, String password,
- boolean autoNickChange) throws Exception
+ boolean secureConnection, boolean autoNickChange) throws Exception
{
if (this.irc != null && this.connectionState != null
&& this.connectionState.isConnected())
@@ -124,7 +124,7 @@ public void connect(String host, int port, String password,
final Exception[] exceptionContainer = new Exception[1];
this.irc = new IRCApiImpl(true);
- this.params.setServer(new IRCServer(host, port, password, false));
+ this.params.setServer(new IRCServer(host, port, password, secureConnection));
synchronized (this.irc)
{
// register a server listener in order to catch server and cross-/multi-channel messages
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java
index 9bacba82b..f92a3ab49 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java
@@ -170,7 +170,7 @@ public void register(SecurityAuthority authority)
= accountID
.getAccountPropertyInt(
ProtocolProviderFactory.SERVER_PORT,
- 6667);
+ 6697);
//Verify whether a password has already been stored for this account
String serverPassword = IrcActivator.
getProtocolProviderFactory().loadPassword(getAccountID());
@@ -180,6 +180,9 @@ public void register(SecurityAuthority authority)
boolean passwordRequired =
accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.NO_PASSWORD_REQUIRED, true);
+ boolean secureConnection =
+ accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.DEFAULT_ENCRYPTION, true);
//if we don't - retrieve it from the user through the security authority
if (serverPassword == null && passwordRequired)
@@ -195,8 +198,12 @@ public void register(SecurityAuthority authority)
credentials,
SecurityAuthority.AUTHENTICATION_REQUIRED);
- //extract the password the user passed us.
- char[] pass = credentials.getPassword();
+ char[] pass = null;
+ if (credentials != null)
+ {
+ // extract the password the user passed us.
+ pass = credentials.getPassword();
+ }
// the user didn't provide us a password (canceled the operation)
if (pass == null)
@@ -221,7 +228,7 @@ public void register(SecurityAuthority authority)
try
{
this.ircStack.connect(serverAddress, serverPort, serverPassword,
- autoNickChange);
+ secureConnection, autoNickChange);
}
catch (Exception e)
{
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf
index f50530db3..fad5e5d61 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf
+++ b/src/net/java/sip/communicator/impl/protocol/irc/irc.provider.manifest.mf
@@ -10,4 +10,5 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.service.protocol,
- net.java.sip.communicator.service.protocol.event
+ net.java.sip.communicator.service.protocol.event,
+ javax.net.ssl
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
index b26b3e20f..7eee1ca92 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
@@ -42,6 +42,10 @@ public class FirstWizardPage
public static final String USER_NAME_EXAMPLE = "Ex: ircuser";
public static final String SERVER_EXAMPLE = "Ex: irc.quakenet.org";
+
+ private static final String DEFAULT_PLAINTEXT_PORT = "6667";
+
+ private static final String DEFAULT_SECURE_PORT = "6697";
private JPanel userPassPanel = new TransparentPanel(new BorderLayout(10, 10));
@@ -104,6 +108,9 @@ public class FirstWizardPage
private JCheckBox passwordNotRequired = new SIPCommCheckBox(
Resources.getString("plugin.ircaccregwizz.PASSWORD_NOT_REQUIRED"));
+
+ private JCheckBox useSecureConnection = new SIPCommCheckBox(
+ Resources.getString("plugin.ircaccregwizz.USE_SECURE_CONNECTION"));
private JPanel mainPanel = new TransparentPanel();
@@ -118,7 +125,7 @@ public class FirstWizardPage
*
* @param wizard the parent wizard
*/
- public FirstWizardPage(IrcAccountRegistrationWizard wizard)
+ public FirstWizardPage(IrcAccountRegistrationWizard wizard, String userId, String server)
{
super(new BorderLayout());
@@ -126,7 +133,7 @@ public FirstWizardPage(IrcAccountRegistrationWizard wizard)
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
- this.init();
+ this.init(userId, server);
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@@ -150,12 +157,13 @@ public FirstWizardPage(IrcAccountRegistrationWizard wizard)
this.portField.setEnabled(false);
this.rememberPassBox.setEnabled(false);
+ this.useSecureConnection.setEnabled(true);
}
/**
* Initializes all panels, buttons, etc.
*/
- private void init()
+ private void init(String userId, String server)
{
this.mainPanel.setOpaque(false);
this.labelsPanel.setOpaque(false);
@@ -164,13 +172,20 @@ private void init()
this.userIDField.getDocument().addDocumentListener(this);
this.serverField.getDocument().addDocumentListener(this);
+ this.passField.getDocument().addDocumentListener(this);
this.defaultPort.addActionListener(this);
this.passwordNotRequired.addActionListener(this);
+ this.useSecureConnection.addActionListener(this);
+ this.userIDField.setText(userId);
+ this.serverField.setText(server);
+ this.passField.setEnabled(false);
this.rememberPassBox.setSelected(true);
this.autoNickChange.setSelected(true);
this.defaultPort.setSelected(true);
- this.passwordNotRequired.setSelected(false);
+ this.passwordNotRequired.setSelected(true);
+ this.useSecureConnection.setSelected(true);
+ this.portField.setText(this.useSecureConnection.isSelected() ? DEFAULT_SECURE_PORT : DEFAULT_PLAINTEXT_PORT);
this.nickExampleLabel.setForeground(Color.GRAY);
this.nickExampleLabel.setFont(
@@ -206,7 +221,7 @@ private void init()
.createTitledBorder(Resources.getString(
"plugin.ircaccregwizz.USERNAME_AND_PASSWORD")));
- labelsServerPanel.add(server);
+ labelsServerPanel.add(this.server);
labelsServerPanel.add(emptyPanel2);
labelsServerPanel.add(port);
@@ -216,7 +231,12 @@ private void init()
serverPanel.add(labelsServerPanel, BorderLayout.WEST);
serverPanel.add(valuesServerPanel, BorderLayout.CENTER);
- serverPanel.add(defaultPort, BorderLayout.SOUTH);
+
+ JPanel serverSubPanel = new JPanel(new BorderLayout());
+ serverSubPanel.setOpaque(false);
+ serverSubPanel.add(defaultPort, BorderLayout.WEST);
+ serverSubPanel.add(useSecureConnection, BorderLayout.EAST);
+ serverPanel.add(serverSubPanel, BorderLayout.SOUTH);
serverPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.ircaccregwizz.IRC_SERVER")));
@@ -314,6 +334,7 @@ public void commitPage()
registration.setRememberPassword(rememberPassBox.isSelected());
registration.setAutoChangeNick(autoNickChange.isSelected());
registration.setRequiredPassword(!passwordNotRequired.isSelected());
+ registration.setSecureConnection(useSecureConnection.isSelected());
isCommitted = true;
}
@@ -412,6 +433,10 @@ public void loadAccount(ProtocolProviderService protocolProvider)
String noPasswordRequired =
accountID
.getAccountPropertyString(ProtocolProviderFactory.NO_PASSWORD_REQUIRED);
+
+ boolean useSecureConnection =
+ accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.DEFAULT_ENCRYPTION, true);
this.userIDField.setEnabled(false);
this.userIDField.setText(accountID.getUserID());
@@ -445,6 +470,8 @@ public void loadAccount(ProtocolProviderService protocolProvider)
passField.setEnabled(isPassRequired);
}
+
+ this.useSecureConnection.setSelected(useSecureConnection);
}
/**
@@ -455,11 +482,15 @@ public void actionPerformed(ActionEvent event)
{
if (defaultPort.isSelected())
{
- portField.setText("");
+ portField
+ .setText(useSecureConnection.isSelected() ? DEFAULT_SECURE_PORT
+ : DEFAULT_PLAINTEXT_PORT);
portField.setEnabled(false);
}
else
+ {
portField.setEnabled(true);
+ }
if (passwordNotRequired.isSelected())
{
@@ -472,7 +503,8 @@ public void actionPerformed(ActionEvent event)
passField.setEnabled(true);
rememberPassBox.setEnabled(true);
}
-
+
+ setNextButtonAccordingToUserID();
}
public void changedUpdate(DocumentEvent event){}
@@ -514,4 +546,14 @@ public boolean isCommitted()
{
return isCommitted;
}
+
+ public String getCurrentUserId()
+ {
+ return this.userIDField.getText();
+ }
+
+ public String getCurrentServer()
+ {
+ return this.serverField.getText();
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java
index bb519c8c8..62f907a2f 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java
@@ -21,6 +21,7 @@ public class IrcAccountRegistration
private boolean rememberPassword;
private boolean autoChangeNick;
private boolean isRequiredPassword;
+ private boolean secureConnection;
/**
* Returns the User ID of the IRC registration account.
@@ -168,4 +169,26 @@ public void setRememberPassword(boolean rememberPassword)
{
this.rememberPassword = rememberPassword;
}
+
+ /**
+ * Indicates if the the connection must be secure or not.
+ *
+ * @return returns true to indicate that the connection should
+ * be secure, or false for unsecured connection.
+ */
+ public boolean isSecureConnection()
+ {
+ return this.secureConnection;
+ }
+
+ /**
+ * Set the useSecureConnection property.
+ *
+ * @param secureConnection true to require secure connection, or false
+ * for unsecured connections
+ */
+ public void setSecureConnection(boolean secureConnection)
+ {
+ this.secureConnection = secureConnection;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
index a98a5d4f0..44faec7d7 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
@@ -108,7 +108,14 @@ public String getProtocolDescription()
public Iterator getPages()
{
java.util.List pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(this);
+ String userId = "";
+ String server = "";
+ if (firstWizardPage != null)
+ {
+ userId = firstWizardPage.getCurrentUserId();
+ server = firstWizardPage.getCurrentServer();
+ }
+ firstWizardPage = new FirstWizardPage(this, userId, server);
pages.add(firstWizardPage);
@@ -227,6 +234,9 @@ public ProtocolProviderService installAccount(
accountProperties.put(
ProtocolProviderFactory.NO_PASSWORD_REQUIRED,
new Boolean(!registration.isRequiredPassword()).toString());
+
+ accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION,
+ new Boolean(registration.isSecureConnection()).toString());
if (isModification())
{
@@ -366,7 +376,7 @@ public boolean isSimpleFormEnabled()
@Override
public Object getSimpleForm(boolean isCreateAccount)
{
- firstWizardPage = new FirstWizardPage(this);
+ firstWizardPage = new FirstWizardPage(this, "", "");
return firstWizardPage.getSimpleForm();
}