diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index eeadfbbff..8d55e8baf 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -807,10 +807,12 @@ plugin.iptelaccregwizz.NEW_ACCOUNT_TITLE=Subscribe to iptel.org
# sip2sip accregwizz
plugin.sip2sipaccregwizz.PROTOCOL_NAME=sip2sip.info
plugin.sip2sipaccregwizz.PROTOCOL_DESCRIPTION=VoIP and chat
-plugin.sip2sipaccregwizz.USERNAME=User name
+plugin.sip2sipaccregwizz.USERNAME=Username
plugin.sip2sipaccregwizz.RETYPE_PASSWORD=Retype password
plugin.sip2sipaccregwizz.EMAIL=Email address
plugin.sip2sipaccregwizz.NEW_ACCOUNT_TITLE=Subscribe to sip2sip.info
+plugin.sip2sipaccregwizz.EMAIL_NOTE=The email address is used to send voicemail messages,
missed calls notifications and to recover a lost password
+plugin.sip2sipaccregwizz.INFO_NOTE=For help about this service visit http://wiki.sip2sip.info
# key binding chooser
plugin.keybindings.CHAT_CLOSE=Close Chat Window
diff --git a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java
index 88255a13d..9ee2663c0 100644
--- a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java
+++ b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/CreateSip2SipAccountForm.java
@@ -7,6 +7,7 @@
package net.java.sip.communicator.plugin.sip2sipaccregwizz;
import java.awt.*;
+import java.awt.event.*;
import java.io.*;
import java.net.*;
@@ -75,10 +76,6 @@ public CreateSip2SipAccountForm()
{
super(new BorderLayout());
- this.setBorder(BorderFactory.createTitledBorder(
- Sip2SipAccRegWizzActivator.getResources()
- .getI18NString("plugin.sipaccregwizz.CREATE_ACCOUNT_TITLE")));
-
this.init();
}
@@ -87,13 +84,19 @@ public CreateSip2SipAccountForm()
*/
private void init()
{
+ JPanel mainPanel = new TransparentPanel(new BorderLayout());
+
+ mainPanel.setBorder(BorderFactory.createTitledBorder(
+ Sip2SipAccRegWizzActivator.getResources()
+ .getI18NString("plugin.sipaccregwizz.CREATE_ACCOUNT_TITLE")));
+
JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1));
JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1));
JLabel usernameLabel
= new JLabel(Sip2SipAccRegWizzActivator.getResources()
- .getI18NString("plugin.sipaccregwizz.USERNAME"));
+ .getI18NString("plugin.sip2sipaccregwizz.USERNAME"));
JLabel displayNameLabel
= new JLabel(Sip2SipAccRegWizzActivator.getResources()
@@ -111,22 +114,52 @@ private void init()
= new JLabel(Sip2SipAccRegWizzActivator.getResources()
.getI18NString("plugin.sip2sipaccregwizz.EMAIL"));
- labelsPanel.add(usernameLabel);
labelsPanel.add(displayNameLabel);
+ labelsPanel.add(usernameLabel);
labelsPanel.add(passLabel);
labelsPanel.add(retypePasswordLabel);
labelsPanel.add(emailLabel);
- valuesPanel.add(usernameField);
valuesPanel.add(displayNameField);
+ valuesPanel.add(usernameField);
valuesPanel.add(passField);
valuesPanel.add(retypePassField);
valuesPanel.add(emailField);
+ JLabel emailDescriptionLabel
+ = new JLabel(Sip2SipAccRegWizzActivator.getResources()
+ .getI18NString("plugin.sip2sipaccregwizz.EMAIL_NOTE"),
+ SwingConstants.CENTER);
+ emailDescriptionLabel.setForeground(Color.GRAY);
+ emailDescriptionLabel.setFont(emailDescriptionLabel.getFont().deriveFont(8));
+ emailDescriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 8, 10));
+
initErrorArea();
- add(labelsPanel, BorderLayout.WEST);
- add(valuesPanel, BorderLayout.CENTER);
+ mainPanel.add(labelsPanel, BorderLayout.WEST);
+ mainPanel.add(valuesPanel, BorderLayout.CENTER);
+ mainPanel.add(emailDescriptionLabel, BorderLayout.SOUTH);
+
+ this.add(mainPanel, BorderLayout.CENTER);
+
+ JLabel infoLabel
+ = new JLabel(Sip2SipAccRegWizzActivator.getResources()
+ .getI18NString("plugin.sip2sipaccregwizz.INFO_NOTE"),
+ SwingConstants.RIGHT);
+ infoLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ infoLabel.setForeground(Color.GRAY);
+ infoLabel.setFont(emailDescriptionLabel.getFont().deriveFont(8));
+ infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
+ infoLabel.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ Sip2SipAccRegWizzActivator.getBrowserLauncher()
+ .openURL("http://wiki.sip2sip.info");
+ }
+ });
+
+ this.add(infoLabel, BorderLayout.SOUTH);
}
/**
@@ -153,13 +186,25 @@ public NewAccount createAccount()
NewAccount newAccount = null;
try
{
- registerLink += "email=" + emailField.getText()
- + "&password=" + new String(passField.getPassword())
- + "&display_name=" + displayNameField.getText()
- + "&username=" + usernameField.getText()
- + "&user_agent=sip-communicator.org";
-
- URL url = new URL(registerLink);
+ StringBuilder registerLinkBuilder = new StringBuilder(registerLink);
+ registerLinkBuilder
+ .append(URLEncoder.encode("email", "UTF-8"))
+ .append("=").append(
+ URLEncoder.encode(emailField.getText(), "UTF-8"))
+ .append("&").append(URLEncoder.encode("password", "UTF-8"))
+ .append("=").append(
+ URLEncoder.encode(new String(passField.getPassword()), "UTF-8"))
+ .append("&").append(URLEncoder.encode("display_name", "UTF-8"))
+ .append("=").append(
+ URLEncoder.encode(displayNameField.getText(), "UTF-8"))
+ .append("&").append(URLEncoder.encode("username", "UTF-8"))
+ .append("=").append(
+ URLEncoder.encode(usernameField.getText(), "UTF-8"))
+ .append("&").append(URLEncoder.encode("user_agent", "UTF-8"))
+ .append("=").append(
+ URLEncoder.encode("sip-communicator.org", "UTF-8"));
+
+ URL url = new URL(registerLinkBuilder.toString());
URLConnection conn = url.openConnection();
// If this is not an http connection we have nothing to do here.
diff --git a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccRegWizzActivator.java
index aeda6a2d9..657a4da1d 100644
--- a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccRegWizzActivator.java
@@ -89,32 +89,6 @@ public void start(BundleContext bc)
public void stop(BundleContext bundleContext) throws Exception {}
- /**
- * Returns the ProtocolProviderFactory for the IP Tel protocol.
- *
- * @return the ProtocolProviderFactory for the IP Tel protocol
- */
- public static ProtocolProviderFactory getIptelProtocolProviderFactory()
- {
- ServiceReference[] serRefs = null;
-
- String osgiFilter = "("
- + ProtocolProviderFactory.PROTOCOL
- + "=" + ProtocolNames.SIP + ")";
-
- try
- {
- serRefs = bundleContext.getServiceReferences(
- ProtocolProviderFactory.class.getName(), osgiFilter);
- }
- catch (InvalidSyntaxException ex)
- {
- logger.error("IptelAccRegWizzActivator : " + ex);
- }
-
- return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]);
- }
-
/**
* Returns the UIService.
*
diff --git a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java
index 3f0b7703b..846bc9325 100644
--- a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java
@@ -48,6 +48,11 @@ public class Sip2SipAccountRegistrationWizard
public Sip2SipAccountRegistrationWizard(WizardContainer wizardContainer)
{
super(wizardContainer);
+
+ // set default proxy, common for sip2sip
+ getRegistration().setProxy("proxy.sipthor.net");
+ getRegistration().setKeepAliveMethod("NONE");
+ getRegistration().setDefaultDomain("sip2sip.info");
}
/**
@@ -163,4 +168,13 @@ protected CreateAccountService getCreateAccountService()
{
return createAccountForm;
}
+
+ /**
+ * Returns the display label used for the sip id field.
+ * @return the sip id display label string.
+ */
+ protected String getUsernameLabel()
+ {
+ return Resources.getString("plugin.sip2sipaccregwizz.USERNAME");
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java
index 1964f1944..6f8602902 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/AccountPanel.java
@@ -84,7 +84,7 @@ public AccountPanel(SIPAccountRegistrationForm regform)
uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
JLabel uinLabel
- = new JLabel(Resources.getString("plugin.sipaccregwizz.USERNAME"));
+ = new JLabel(regform.getUsernameLabel());
JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
@@ -330,6 +330,8 @@ public void stateChanged(ChangeEvent e)
if (createAccountButton.isSelected())
{
mainPanel.remove(uinPassPanel);
+ // clear the pannel before add
+ regform.getCreateAccountService().clear();
mainPanel.add(registrationForm, BorderLayout.CENTER);
SwingUtilities.getWindowAncestor(AccountPanel.this).pack();
}
@@ -338,6 +340,9 @@ public void stateChanged(ChangeEvent e)
ButtonGroup buttonGroup = new ButtonGroup();
+ existingAccountButton.setOpaque(false);
+ createAccountButton.setOpaque(false);
+
buttonGroup.add(existingAccountButton);
buttonGroup.add(createAccountButton);
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
index 6357af42f..e57ecd943 100755
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
@@ -63,6 +63,8 @@ public class SIPAccountRegistration
private String keepAliveInterval = DEFAULT_KEEP_ALIVE_INTERVAL;
+ private String defaultDomain = null;
+
public String getPreferredTransport()
{
return preferredTransport;
@@ -402,4 +404,25 @@ public void setSipZrtpAttribute(boolean sipZrtpAttribute) {
public boolean isSipZrtpAttribute() {
return sipZrtpAttribute;
}
+
+ /**
+ * This is the default domain.
+ * @return the defaultDomain
+ */
+ public String getDefaultDomain()
+ {
+ return defaultDomain;
+ }
+
+ /**
+ * If default domain is set this means we cannot create registerless
+ * accounts through this wizard. And every time we write only the username,
+ * will will end up with username@defaultDomain.
+ *
+ * @param defaultDomain the defaultDomain to set
+ */
+ public void setDefaultDomain(String defaultDomain)
+ {
+ this.defaultDomain = defaultDomain;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
index 796674b25..b483cf02a 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
@@ -167,6 +167,16 @@ public boolean commitPage(SIPAccountRegistration registration)
else
{
userID = accountPanel.getUserID();
+
+ if(getServerFromUserName(userID) == null
+ && registration.getDefaultDomain() != null)
+ {
+ // we have only a username and we want to add
+ // a defautl domain
+ userID = userID + "@" + registration.getDefaultDomain();
+ setServerFieldAccordingToUIN(userID);
+ }
+
password = accountPanel.getPassword();
serverAddress = connectionPanel.getServerAddress();
proxyAddress = connectionPanel.getProxy();
@@ -183,7 +193,11 @@ public boolean commitPage(SIPAccountRegistration registration)
registration.setRememberPassword(accountPanel.isRememberPassword());
registration.setServerAddress(serverAddress);
- registration.setProxy(proxyAddress);
+
+ // set the proxy only if its not already set by some custom
+ // extending wizard like sip2sip
+ if(registration.getProxy() == null)
+ registration.setProxy(proxyAddress);
String displayName = accountPanel.getDisplayName();
registration.setDisplayName(displayName);
@@ -210,8 +224,13 @@ public boolean commitPage(SIPAccountRegistration registration)
presencePanel.getPollPeriod());
registration.setSubscriptionExpiration(
presencePanel.getSubscriptionExpiration());
- registration.setKeepAliveMethod(
- connectionPanel.getKeepAliveMethod());
+
+ // set the keepalive method only if its not already set by some custom
+ // extending wizard like sip2sip
+ if(registration.getKeepAliveMethod() == null)
+ registration.setKeepAliveMethod(
+ connectionPanel.getKeepAliveMethod());
+
registration.setKeepAliveInterval(
connectionPanel.getKeepAliveInterval());
@@ -385,4 +404,13 @@ public CreateAccountService getCreateAccountService()
{
return wizard.getCreateAccountService();
}
+
+ /**
+ * Returns the display label used for the sip id field.
+ * @return the sip id display label string.
+ */
+ protected String getUsernameLabel()
+ {
+ return wizard.getUsernameLabel();
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
index 857f176a1..67d118a26 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
@@ -611,4 +611,13 @@ protected CreateAccountService getCreateAccountService()
{
return null;
}
+
+ /**
+ * Returns the display label used for the sip id field.
+ * @return the sip id display label string.
+ */
+ protected String getUsernameLabel()
+ {
+ return Resources.getString("plugin.sipaccregwizz.USERNAME");
+ }
}