Auto fill the server for google talk users

cusax-fix
Damian Minkov 20 years ago
parent 3b6402352c
commit 8ad5fe408c

@ -26,6 +26,9 @@ public class FirstWizardPage extends JPanel
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
private static final String GOOGLE_USER_SUFFIX = "gmail.com";
private static final String GOOGLE_CONNECT_SRV = "talk.google.com";
private JPanel uinPassPanel = new JPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new JPanel(new GridLayout(0, 1, 10, 10));
@ -201,17 +204,14 @@ public void pageNext() {
registration.setUin(uinField.getText());
registration.setPassword(new String(passField.getPassword()));
registration.setRememberPassword(rememberPassBox.isSelected());
if(enableAdvOpButton.isSelected())
registration.setServerAddress(serverField.getText());
try
{
registration.setOverrideDefOptions(true);
registration.setServerAddress(serverField.getText());
try
{
registration.setPort(Integer.parseInt(portField.getText()));
}
catch (NumberFormatException ex)
{}
registration.setPort(Integer.parseInt(portField.getText()));
}
catch (NumberFormatException ex)
{}
}
/**
@ -288,7 +288,13 @@ private void setServerFieldAccordingToUIN()
String uin = uinField.getText();
int delimIndex = uin.indexOf("@");
if (delimIndex != -1)
serverField.setText(uin.substring(delimIndex + 1));
{
String newServerAddr = uin.substring(delimIndex + 1);
if(newServerAddr.equals(GOOGLE_USER_SUFFIX))
serverField.setText(GOOGLE_CONNECT_SRV);
else
serverField.setText(newServerAddr);
}
}
}

@ -20,8 +20,6 @@ public class JabberAccountRegistration {
private boolean rememberPassword;
private boolean overrideDefOptions;
private String serverAddress;
private int port;
@ -85,15 +83,6 @@ public int getPort()
return port;
}
/**
* Whether server and port are pointed by the user
* @return boolean
*/
public boolean isOverrideDefOptions()
{
return overrideDefOptions;
}
/**
* Sets the UIN of the jabber registration account.
* @param uin the UIN of the jabber registration account.
@ -119,13 +108,4 @@ public void setPort(int port)
{
this.port = port;
}
/**
* Setting whether user has choosen advance options for server and port
* @param overrideDefOptions boolean
*/
public void setOverrideDefOptions(boolean overrideDefOptions)
{
this.overrideDefOptions = overrideDefOptions;
}
}

@ -131,14 +131,11 @@ public ProtocolProviderService installAccount(
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
if(registration.isOverrideDefOptions())
{
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
registration.getServerAddress());
accountProperties.put(ProtocolProviderFactory.SERVER_PORT,
accountProperties.put(ProtocolProviderFactory.SERVER_PORT,
String.valueOf(registration.getPort()));
}
if(protocolProvider != null) {
providerFactory.uninstallAccount(protocolProvider.getAccountID());

Loading…
Cancel
Save