Fix creating sip2sip accounts (encode url params).

Set sip2sip proxy to default one (proxy.sipthor.net).
Disable keepalives for sip2sip.
Fix grey background on Windows in sip account wizard for radio buttons.
Move display name above username in sip2sip account wizard and rename Sip Id to Username.
When creating existing account putting only username will work.
Add some notes and links in sip2sip account wizard, about email and overall description.
cusax-fix
Damian Minkov 16 years ago
parent 4a4252938b
commit 5263e31124

@ -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=<html>The email address is used to send voicemail messages, <br>missed calls notifications and to recover a lost password</html>
plugin.sip2sipaccregwizz.INFO_NOTE=<html>For help about this service visit <a href=''>http://wiki.sip2sip.info</a></html>
# key binding chooser
plugin.keybindings.CHAT_CLOSE=Close Chat Window

@ -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.

@ -89,32 +89,6 @@ public void start(BundleContext bc)
public void stop(BundleContext bundleContext) throws Exception {}
/**
* Returns the <tt>ProtocolProviderFactory</tt> for the IP Tel protocol.
*
* @return the <tt>ProtocolProviderFactory</tt> 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 <tt>UIService</tt>.
*

@ -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");
}
}

@ -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);

@ -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;
}
}

@ -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();
}
}

@ -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");
}
}

Loading…
Cancel
Save