aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin/yahooaccregwizz
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2009-01-21 12:51:15 +0000
committerYana Stamcheva <yana@jitsi.org>2009-01-21 12:51:15 +0000
commit333a823b1417bfe834e7090a19d95a510b1b51e0 (patch)
tree26a56dbd25ba307a037a589a34e910449fe91fd6 /src/net/java/sip/communicator/plugin/yahooaccregwizz
parenta832239300e3479bffad2a955b00bb555e55c44a (diff)
downloadjitsi-333a823b1417bfe834e7090a19d95a510b1b51e0.zip
jitsi-333a823b1417bfe834e7090a19d95a510b1b51e0.tar.gz
jitsi-333a823b1417bfe834e7090a19d95a510b1b51e0.tar.bz2
- Fixes Issue #: 434 Wrong ID when try to install an already installed account.
- Removes the "Override server" option from account wizards. - Adds a property to the ProtocolProviderFactory which indicates if the server has been modified
Diffstat (limited to 'src/net/java/sip/communicator/plugin/yahooaccregwizz')
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java39
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java32
2 files changed, 24 insertions, 47 deletions
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
index 80d76f7..c81f661 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
@@ -44,9 +44,6 @@ public class FirstWizardPage
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel =
- new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JLabel uinExampleLabel = new JLabel(USER_NAME_EXAMPLE);
@@ -106,8 +103,6 @@ public class FirstWizardPage
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
@@ -183,25 +178,14 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String uin = uinField.getText();
+ YahooAccountRegistration registration = wizard.getRegistration();
- if (!wizard.isModification() && isExistingAccount(uin))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- uinPassPanel.remove(existingAccountLabel);
+ registration.setUin(uinField.getText());
+ registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- YahooAccountRegistration registration = wizard.getRegistration();
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- registration.setUin(uinField.getText());
- registration.setPassword(new String(passField.getPassword()));
- registration.setRememberPassword(rememberPassBox.isSelected());
- }
isCommitted = true;
}
@@ -281,19 +265,6 @@ public class FirstWizardPage
}
}
- private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory =
- YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
-
- for (AccountID accountID : factory.getRegisteredAccounts())
- {
- if (accountName.equalsIgnoreCase(accountID.getUserID()))
- return true;
- }
- return false;
- }
-
public Object getSimpleForm()
{
return uinPassPanel;
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
index 8873294..00c6995 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -23,6 +24,8 @@ import org.osgi.framework.*;
public class YahooAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(YahooAccountRegistrationWizard.class);
private FirstWizardPage firstWizardPage;
@@ -136,9 +139,9 @@ public class YahooAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin( registration.getUin(),
registration.getPassword());
@@ -151,8 +154,8 @@ public class YahooAccountRegistrationWizard
* created account.
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory =
YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
@@ -172,6 +175,7 @@ public class YahooAccountRegistrationWizard
*/
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory, String user, String passwd)
+ throws OperationFailedException
{
Hashtable accountProperties = new Hashtable();
@@ -202,19 +206,21 @@ public class YahooAccountRegistrationWizard
(ProtocolProviderService) YahooAccRegWizzActivator
.bundleContext.getService(serRef);
}
- catch (IllegalArgumentException e)
+ catch (IllegalStateException exc)
{
- YahooAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException e)
+ catch (Exception exc)
{
- YahooAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;