aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2011-07-20 17:24:16 +0000
committerYana Stamcheva <yana@jitsi.org>2011-07-20 17:24:16 +0000
commitd09c66383886b5ecfae76499230ae800dd4c4666 (patch)
tree603162ac7b1e031bcf4672fc9cd5d4938778659a /src/net/java/sip
parentfd7ff7231237d62eabae6a490bebd0229fa76cac (diff)
downloadjitsi-d09c66383886b5ecfae76499230ae800dd4c4666.zip
jitsi-d09c66383886b5ecfae76499230ae800dd4c4666.tar.gz
jitsi-d09c66383886b5ecfae76499230ae800dd4c4666.tar.bz2
Restores the create Jabber account form and fixes some related issues.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r--src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java23
-rw-r--r--src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java11
-rw-r--r--src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java11
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/AccountPanel.java284
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java291
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java67
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java31
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberNewAccountDialog.java399
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java19
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/NewAccount.java19
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/Resources.java3
-rwxr-xr-xsrc/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf3
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml2
-rw-r--r--src/net/java/sip/communicator/service/resources/ResourceManagementService.java12
14 files changed, 650 insertions, 525 deletions
diff --git a/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java b/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java
index 586b1e9..653f4eb 100644
--- a/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java
@@ -796,6 +796,29 @@ public class ResourceManagementServiceImpl
}
/**
+ * Returns a stream from a given identifier, obtained through the class
+ * loader of the given resourceClass.
+ *
+ * @param streamKey The identifier of the stream.
+ * @param resourceClass the resource class through which the resource would
+ * be obtained
+ * @return The stream for the given identifier.
+ */
+ public InputStream getSettingsInputStream( String streamKey,
+ Class<?> resourceClass)
+ {
+ String path = settingsResources.get(streamKey);
+
+ if (path == null || path.length() == 0)
+ {
+ logger.warn("Missing resource for key: " + streamKey);
+ return null;
+ }
+
+ return resourceClass.getClassLoader().getResourceAsStream(path);
+ }
+
+ /**
* Returns the <tt>URL</tt> of the sound corresponding to the given
* property key.
*
diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
index 32d7685..1d4c439 100644
--- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
@@ -247,4 +247,15 @@ public class FacebookAccountRegistrationWizard
return super.installAccount(providerFactory, userName, passwd);
}
+
+ /**
+ * Returns an instance of <tt>CreateAccountService</tt> through which the
+ * user could create an account. This method is meant to be implemented by
+ * specific protocol provider wizards.
+ * @return an instance of <tt>CreateAccountService</tt>
+ */
+ protected JabberAccountCreationFormService getCreateAccountService()
+ {
+ return null;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
index 9d71af5..fe59243 100644
--- a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
@@ -226,4 +226,15 @@ public class GoogleTalkAccountRegistrationWizard
{
return true;
}
+
+ /**
+ * Returns an instance of <tt>CreateAccountService</tt> through which the
+ * user could create an account. This method is meant to be implemented by
+ * specific protocol provider wizards.
+ * @return an instance of <tt>CreateAccountService</tt>
+ */
+ protected JabberAccountCreationFormService getCreateAccountService()
+ {
+ return null;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/AccountPanel.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/AccountPanel.java
index d92cd97..9e98767 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/AccountPanel.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/AccountPanel.java
@@ -15,7 +15,6 @@ import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
- *
* @author Yana Stamcheva
*/
public class AccountPanel
@@ -44,12 +43,18 @@ public class AccountPanel
private final JCheckBox rememberPassBox = new SIPCommCheckBox(Resources
.getString("service.gui.REMEMBER_PASSWORD"));
- private final JPanel registerPanel
+ private final JabberAccountRegistrationForm parentForm;
+
+ private final JRadioButton existingAccountButton;
+
+ private final JRadioButton createAccountButton;
+
+ private final JPanel mainPanel
= new TransparentPanel(new BorderLayout(5, 5));
- private JabberNewAccountDialog jabberNewAccountDialog;
+ private Component registrationForm;
- private final JabberAccountRegistrationForm parentForm;
+ private Component registerChoicePanel;
/**
* Creates an instance of <tt>AccountPanel</tt> by specifying the parent
@@ -75,6 +80,12 @@ public class AccountPanel
userIDField.getDocument().addDocumentListener(this);
rememberPassBox.setSelected(true);
+ existingAccountButton = new JRadioButton(
+ parentForm.getExistingAccountLabel());
+
+ createAccountButton = new JRadioButton(
+ parentForm.getCreateAccountLabel());
+
userIDExampleLabel.setForeground(Color.GRAY);
userIDExampleLabel.setFont(userIDExampleLabel.getFont().deriveFont(8));
emptyPanel.setMaximumSize(new Dimension(40, 35));
@@ -111,118 +122,63 @@ public class AccountPanel
userIDPassPanel.add(southPanel, BorderLayout.SOUTH);
- String createAccountString = parentForm.getCreateAccountButtonLabel();
-
- if (createAccountString != null && createAccountString.length() > 0)
- {
- JPanel buttonPanel
- = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
-
- buttonPanel.add(createRegisterButton(createAccountString));
-
- registerPanel.add(buttonPanel, BorderLayout.SOUTH);
- }
-
- String createAccountInfoString = parentForm.getCreateAccountLabel();
- if (createAccountInfoString != null
- && createAccountInfoString.length() > 0)
- {
- registerPanel.add(createRegisterArea(createAccountInfoString));
- }
-
- JPanel mainPanel = new TransparentPanel();
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
- mainPanel.add(userIDPassPanel);
- mainPanel.add(Box.createVerticalStrut(10));
-
- if (registerPanel.getComponentCount() > 0)
- {
- registerPanel.setBorder(BorderFactory.createTitledBorder(""));
-
- mainPanel.add(registerPanel);
- }
-
- add(mainPanel, BorderLayout.NORTH);
+ this.add(mainPanel, BorderLayout.NORTH);
}
/**
- * Creates the register area.
- *
- * @param text the text to show to the user
+ * Creates a register choice panel.
* @return the created component
*/
- private Component createRegisterArea(String text)
+ private Component createRegisterChoicePanel()
{
- JEditorPane registerArea = new JEditorPane();
+ JPanel registerChoicePanel = new TransparentPanel(new GridLayout(0, 1));
- registerArea.setAlignmentX(JEditorPane.CENTER_ALIGNMENT);
- registerArea.setOpaque(false);
- registerArea.setContentType("text/html");
- registerArea.setEditable(false);
- registerArea.setText(text);
- /* Display the description with the font we use elsewhere in the UI. */
- registerArea.putClientProperty(
- JEditorPane.HONOR_DISPLAY_PROPERTIES,
- true);
- registerArea.addHyperlinkListener(new HyperlinkListener()
+ existingAccountButton.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent e)
{
- public void hyperlinkUpdate(HyperlinkEvent e)
+ if (existingAccountButton.isSelected())
{
- if (e.getEventType()
- .equals(HyperlinkEvent.EventType.ACTIVATED))
- {
- JabberAccRegWizzActivator
- .getBrowserLauncher().openURL(e.getURL().toString());
- }
- }
- });
+ mainPanel.remove(registrationForm);
+ mainPanel.add(userIDPassPanel, BorderLayout.CENTER);
- return registerArea;
- }
+ Window window
+ = SwingUtilities.getWindowAncestor(AccountPanel.this);
- /**
- * Creates the register button.
- *
- * @param text the text of the button
- * @return the created component
- */
- private Component createRegisterButton(String text)
- {
- JButton registerButton = new JButton(text);
+ if (window != null)
+ window.pack();
+ }
+ }
+ });
- registerButton.addActionListener(new ActionListener()
+ createAccountButton.addChangeListener(new ChangeListener()
{
- public void actionPerformed(ActionEvent evt)
+ public void stateChanged(ChangeEvent e)
{
- if (logger.isDebugEnabled())
- logger.debug("Reg OK");
-
- if (parentForm.isWebSignupSupported())
+ if (createAccountButton.isSelected())
{
- parentForm.webSignup();
- }
- else
- {
- // Open the new account dialog.
- jabberNewAccountDialog = new JabberNewAccountDialog();
-
- if (jabberNewAccountDialog.isOK == true)
- {
- // This userIDField contains the username "@" the server.
- userIDField.setText(jabberNewAccountDialog.userID + "@"
- + jabberNewAccountDialog.server);
-
- parentForm.setServerFieldAccordingToUIN(
- userIDField.getText());
- passField.setText(jabberNewAccountDialog.password);
- }
- if (logger.isDebugEnabled())
- logger.debug("Reg End");
+ mainPanel.remove(userIDPassPanel);
+ mainPanel.add(registrationForm, BorderLayout.CENTER);
+ SwingUtilities.getWindowAncestor(AccountPanel.this).pack();
}
}
});
- return registerButton;
+ ButtonGroup buttonGroup = new ButtonGroup();
+
+ existingAccountButton.setOpaque(false);
+ createAccountButton.setOpaque(false);
+
+ buttonGroup.add(existingAccountButton);
+ buttonGroup.add(createAccountButton);
+
+ registerChoicePanel.add(existingAccountButton);
+ registerChoicePanel.add(createAccountButton);
+
+ // By default we select the existing account button.
+ existingAccountButton.setSelected(true);
+
+ return registerChoicePanel;
}
/**
@@ -366,4 +322,138 @@ public class AccountPanel
return userIDField.getText() != null
&& userIDField.getText().length() > 0;
}
+
+ /**
+ * Sets to <tt>true</tt> if this panel is opened in a simple form and
+ * <tt>false</tt> if it's opened in an advanced form.
+ *
+ * @param isSimpleForm indicates if this panel is opened in a simple form or
+ * in an advanced form
+ */
+ void setSimpleForm(boolean isSimpleForm)
+ {
+ JabberAccountCreationFormService createAccountService
+ = parentForm.getCreateAccountService();
+
+ if (createAccountService != null && isSimpleForm)
+ {
+ registrationForm = createAccountService.getForm();
+ registerChoicePanel = createRegisterChoicePanel();
+
+ mainPanel.add(registerChoicePanel, BorderLayout.NORTH);
+ }
+ else
+ {
+ JPanel registerPanel = new TransparentPanel();
+
+ registerPanel.setLayout(
+ new BoxLayout(registerPanel, BoxLayout.Y_AXIS));
+
+ String createAccountInfoString = parentForm.getCreateAccountLabel();
+
+ if (createAccountInfoString != null
+ && createAccountInfoString.length() > 0)
+ {
+ registerPanel.add(createRegisterArea(createAccountInfoString));
+ }
+
+ String createAccountString
+ = parentForm.getCreateAccountButtonLabel();
+
+ if (createAccountString != null
+ && createAccountString.length() > 0)
+ {
+ JPanel buttonPanel
+ = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
+
+ buttonPanel.add(createRegisterButton(createAccountString));
+
+ registerPanel.add(buttonPanel);
+ }
+
+ mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+ mainPanel.add(userIDPassPanel);
+ mainPanel.add(Box.createVerticalStrut(10));
+
+ if (registerPanel.getComponentCount() > 0)
+ {
+ registerPanel.setBorder(BorderFactory.createTitledBorder(""));
+
+ mainPanel.add(registerPanel);
+ }
+ }
+ }
+
+ /**
+ * Indicates if the account information provided by this form is for new
+ * account or an existing one.
+ * @return <tt>true</tt> if the account information provided by this form
+ * is for new account or <tt>false</tt> if it's for an existing one
+ */
+ boolean isCreateAccount()
+ {
+ return createAccountButton.isSelected();
+ }
+
+ /**
+ * Creates the register area.
+ *
+ * @param text the text to show to the user
+ * @return the created component
+ */
+ private Component createRegisterArea(String text)
+ {
+ JEditorPane registerArea = new JEditorPane();
+
+ registerArea.setAlignmentX(JEditorPane.CENTER_ALIGNMENT);
+ registerArea.setOpaque(false);
+ registerArea.setContentType("text/html");
+ registerArea.setEditable(false);
+ registerArea.setText(text);
+ /* Display the description with the font we use elsewhere in the UI. */
+ registerArea.putClientProperty(
+ JEditorPane.HONOR_DISPLAY_PROPERTIES,
+ true);
+ registerArea.addHyperlinkListener(new HyperlinkListener()
+ {
+ public void hyperlinkUpdate(HyperlinkEvent e)
+ {
+ if (e.getEventType()
+ .equals(HyperlinkEvent.EventType.ACTIVATED))
+ {
+ JabberAccRegWizzActivator
+ .getBrowserLauncher().openURL(e.getURL().toString());
+ }
+ }
+ });
+
+ return registerArea;
+ }
+
+ /**
+ * Creates the register button.
+ *
+ * @param text the text of the button
+ * @return the created component
+ */
+ private Component createRegisterButton(String text)
+ {
+ JButton registerButton = new JButton(text);
+
+ registerButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (logger.isDebugEnabled())
+ logger.debug("Reg OK");
+
+ if (parentForm.isWebSignupSupported())
+ {
+ parentForm.webSignup();
+ }
+ }
+ });
+
+ return registerButton;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java
new file mode 100644
index 0000000..5580473
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountCreationForm.java
@@ -0,0 +1,291 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.plugin.jabberaccregwizz;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+import javax.swing.text.*;
+
+import net.java.sip.communicator.util.*;
+import net.java.sip.communicator.util.swing.*;
+
+import org.jivesoftware.smack.*;
+
+/**
+ * Dialog for adding a new Jabber account.
+ *
+ * @author Nicolas Grandclaude
+ * @author Yana Stamcheva
+ */
+public class JabberAccountCreationForm
+ extends TransparentPanel
+ implements JabberAccountCreationFormService
+{
+ private static final Logger logger = Logger
+ .getLogger(JabberAccountCreationForm.class);
+
+ private JabberServerChooserDialog jabberServerChooserDialog;
+
+ // Panels
+ private JPanel userIDPassPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
+
+ private JPanel labelsPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+
+ private JPanel valuesPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+
+ private JPanel serverPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
+
+ // Labels
+ private JLabel serverLabel
+ = new JLabel(Resources.getString("plugin.jabberaccregwizz.CSERVER"));
+
+ private JLabel userIDLabel
+ = new JLabel(Resources.getString("plugin.jabberaccregwizz.USERNAME"));
+
+ private JLabel passLabel
+ = new JLabel(Resources.getString("service.gui.PASSWORD"));
+
+ private JLabel pass2Label
+ = new JLabel(Resources.getString(
+ "plugin.jabberaccregwizz.PASSWORD_CONFIRM"));
+
+ private JLabel portLabel
+ = new JLabel(Resources.getString("service.gui.PORT"));
+
+ // Textfield
+ private JTextField serverField = new JTextField();
+
+ private JTextField userIDField = new JTextField();
+
+ private JPasswordField passField = new JPasswordField();
+
+ private JPasswordField pass2Field = new JPasswordField();
+
+ private JTextField portField = new JTextField("5222");
+
+ // Button
+ private JButton chooseButton = new JButton();
+
+ // Smack objects
+ private XMPPConnection xmppConnection = null;
+
+ private AccountManager accountManager = null;
+
+ /**
+ * The error text pane.
+ */
+ private final JTextPane errorPane = new JTextPane();
+
+ /**
+ * Creates an instance of <tt>JabberNewAccountDialog</tt>.
+ */
+ public JabberAccountCreationForm()
+ {
+ initErrorArea();
+
+ labelsPanel.add(serverLabel);
+ labelsPanel.add(userIDLabel);
+ labelsPanel.add(passLabel);
+ labelsPanel.add(pass2Label);
+ labelsPanel.add(portLabel);
+
+ userIDField.setColumns(30);
+
+ serverPanel.add(serverField, BorderLayout.CENTER);
+ serverPanel.add(chooseButton, BorderLayout.EAST);
+ valuesPanel.add(serverPanel);
+ valuesPanel.add(userIDField);
+ valuesPanel.add(passField);
+ valuesPanel.add(pass2Field);
+ valuesPanel.add(portField);
+
+ userIDPassPanel.add(labelsPanel, BorderLayout.WEST);
+ userIDPassPanel.add(valuesPanel, BorderLayout.CENTER);
+
+ chooseButton.setText(
+ Resources.getString("plugin.jabberaccregwizz.CHOOSE"));
+ chooseButton.setMnemonic(
+ Resources.getMnemonic("plugin.jabberaccregwizz.CHOOSE"));
+
+ // Choose button open the JabberServerChooserDialog
+ chooseButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ jabberServerChooserDialog = new JabberServerChooserDialog();
+ if (jabberServerChooserDialog.isOK) // OK pressed in
+ // JabberServerChooserDialog
+ {
+ serverField
+ .setText(jabberServerChooserDialog.serverSelected);
+ }
+ }
+ });
+
+ this.add(userIDPassPanel, BorderLayout.CENTER);
+ }
+
+ /**
+ * Connects to the chosen server and creates a new account with Smack.
+ *
+ * @param server the server domain
+ * @param port TCP port to connect
+ * @param username the account username
+ * @param password the account password
+ */
+ private boolean createJabberAccount(String server, int port, String username,
+ String password)
+ {
+ try
+ {
+ ConnectionConfiguration config = new ConnectionConfiguration(
+ server, port);
+
+ xmppConnection = new XMPPConnection(config);
+
+ xmppConnection.connect();
+
+ accountManager = new AccountManager(xmppConnection);
+
+ accountManager.createAccount(username, password);
+
+ return true;
+ }
+ catch (XMPPException exc)
+ {
+ if (exc.getXMPPError().getCode() == 409)
+ {
+ showErrorMessage(Resources.getString(
+ "plugin.jabberaccregwizz.USER_EXISTS_ERROR"));
+
+ logger.error(
+ "Error when created a new Jabber account :" +
+ " user already exist");
+ }
+ else
+ {
+ showErrorMessage(Resources.getString(
+ "plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR"));
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Creates an account.
+ *
+ * @return the created account
+ */
+ public NewAccount createAccount()
+ {
+ String userID = userIDField.getText();
+ char[] password = passField.getPassword();
+ char[] password2 = pass2Field.getPassword();
+ String server = serverField.getText();
+ String port = portField.getText();
+
+ if (new String(password).equals(new String(password2)))
+ {
+ // the two password fields are the same
+ boolean result = createJabberAccount(server,
+ 5222,
+ userID,
+ new String(password));
+
+ if (result == true)
+ {
+ return new NewAccount(
+ getCompleteUserID(userID, server), password, server, port);
+ }
+ }
+ else
+ {
+ showErrorMessage(Resources.getString(
+ "plugin.jabberaccregwizz.NOT_SAME_PASSWORD"));
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the create account form.
+ *
+ * @return the create account form
+ */
+ public Component getForm()
+ {
+ return this;
+ }
+
+ /**
+ * Clears all fields contained in this form.
+ */
+ public void clear()
+ {
+ userIDField.setText("");
+ passField.setText("");
+ pass2Field.setText("");
+ serverField.setText(Resources.getSettingsString(
+ "plugin.jabberaccregwizz.NEW_ACCOUNT_DEFAULT_SERVER"));
+ errorPane.setText("");
+
+ userIDPassPanel.remove(errorPane);
+ }
+
+ /**
+ * Creates the error area component.
+ */
+ private void initErrorArea()
+ {
+ SimpleAttributeSet attribs = new SimpleAttributeSet();
+ StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_RIGHT);
+ StyleConstants.setFontFamily(attribs, errorPane.getFont().getFamily());
+ StyleConstants.setForeground(attribs, Color.RED);
+ errorPane.setParagraphAttributes(attribs, true);
+ errorPane.setPreferredSize(new Dimension(100, 50));
+ errorPane.setMinimumSize(new Dimension(100, 50));
+ errorPane.setOpaque(false);
+ }
+
+ /**
+ * Shows the given error message.
+ *
+ * @param text the text of the error
+ */
+ private void showErrorMessage(String text)
+ {
+ errorPane.setText(text);
+
+ if (errorPane.getParent() == null)
+ userIDPassPanel.add(errorPane, BorderLayout.NORTH);
+
+ SwingUtilities.getWindowAncestor(this).pack();
+ }
+
+ /**
+ * Returns the complete user id, by adding to it the server part.
+ *
+ * @param userID the username
+ * @param server the server address
+ * @return the complete user id
+ */
+ private String getCompleteUserID(String userID, String server)
+ {
+ if (userID.indexOf("@") < 0 && server != null && server.length() > 0)
+ {
+ return userID + "@" + server;
+ }
+
+ return userID;
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
index 42512b0..30a5aa5 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
@@ -72,6 +72,9 @@ public class JabberAccountRegistrationForm
if (!JabberAccRegWizzActivator.isAdvancedAccountConfigDisabled())
{
+ // Indicate that this panel is opened in a simple form.
+ accountPanel.setSimpleForm(false);
+
if (accountPanel.getParent() != tabbedPane)
tabbedPane.addTab( Resources.getString("service.gui.ACCOUNT"),
accountPanel);
@@ -210,20 +213,53 @@ public class JabberAccountRegistrationForm
*/
public boolean commitPage(JabberAccountRegistration registration)
{
- String userID = accountPanel.getUsername();
+ String userID = null;
+ char[] password = null;
+ String serverAddress = null;
+ String serverPort = null;
+
+ if (accountPanel.isCreateAccount())
+ {
+ NewAccount newAccount
+ = getCreateAccountService().createAccount();
+
+ if (newAccount != null)
+ {
+ userID = newAccount.getUserName();
+ password = newAccount.getPassword();
+ serverAddress = newAccount.getServerAddress();
+ serverPort = newAccount.getServerPort();
+
+ if (serverAddress == null)
+ setServerFieldAccordingToUIN(userID);
+ }
+ else
+ {
+ // If we didn't succeed to create our new account, we have
+ // nothing more to do here.
+ return false;
+ }
+ }
+ else
+ {
+ userID = accountPanel.getUsername();
- if(userID == null || userID.trim().length() == 0)
- throw new IllegalStateException("No user ID provided.");
+ if(userID == null || userID.trim().length() == 0)
+ throw new IllegalStateException("No user ID provided.");
- if(userID.indexOf('@') < 0
- && registration.getDefaultUserSufix() != null)
- userID = userID + '@' + registration.getDefaultUserSufix();
+ if(userID.indexOf('@') < 0
+ && registration.getDefaultUserSufix() != null)
+ userID = userID + '@' + registration.getDefaultUserSufix();
+
+ password = accountPanel.getPassword();
+ serverAddress = connectionPanel.getServerAddress();
+ serverPort = connectionPanel.getServerPort();
+ }
registration.setUserID(userID);
- registration.setPassword(new String(accountPanel.getPassword()));
+ registration.setPassword(new String(password));
registration.setRememberPassword(accountPanel.isRememberPassword());
-
- registration.setServerAddress(connectionPanel.getServerAddress());
+ registration.setServerAddress(serverAddress);
registration.setSendKeepAlive(connectionPanel.isSendKeepAlive());
registration.setGmailNotificationEnabled(
connectionPanel.isGmailNotificationsEnabled());
@@ -233,7 +269,6 @@ public class JabberAccountRegistrationForm
connectionPanel.isAutogenerateResourceEnabled());
registration.setResource(connectionPanel.getResource());
- String serverPort = connectionPanel.getServerPort();
if (serverPort != null)
registration.setPort(Integer.parseInt(serverPort));
@@ -465,6 +500,9 @@ public class JabberAccountRegistrationForm
if (createAccountService != null)
createAccountService.clear();
+ // Indicate that this panel is opened in a simple form.
+ accountPanel.setSimpleForm(true);
+
return accountPanel;
}
@@ -553,6 +591,15 @@ public class JabberAccountRegistrationForm
}
/**
+ * Return the string for add existing account button.
+ * @return the string for add existing account button.
+ */
+ protected String getExistingAccountLabel()
+ {
+ return wizard.getExistingAccountLabel();
+ }
+
+ /**
* Return the string for home page link label.
* @return the string for home page link label
*/
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
index c7cc8fb..7ceadbd 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
@@ -12,7 +12,7 @@ import java.util.List;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.Logger;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -59,6 +59,11 @@ public class JabberAccountRegistrationWizard
private ProtocolProviderService protocolProvider;
/**
+ * The create account form.
+ */
+ private JabberAccountCreationForm createAccountService;
+
+ /**
* Creates an instance of <tt>JabberAccountRegistrationWizard</tt>.
* @param wizardContainer the wizard container, where this wizard
* is added
@@ -233,6 +238,10 @@ public class JabberAccountRegistrationWizard
if(!firstWizardPage.isCommitted())
firstWizardPage.commitPage();
+ if(!firstWizardPage.isCommitted())
+ throw new OperationFailedException("Could not confirm data.",
+ OperationFailedException.GENERAL_ERROR);
+
ProtocolProviderFactory factory
= JabberAccRegWizzActivator.getJabberProtocolProviderFactory();
@@ -426,7 +435,7 @@ public class JabberAccountRegistrationWizard
"Account already exists.",
OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (Exception exc)
+ catch (Throwable exc)
{
logger.warn(exc.getMessage());
@@ -540,8 +549,6 @@ public class JabberAccountRegistrationWizard
*/
public void webSignup()
{
- JabberAccRegWizzActivator.getBrowserLauncher()
- .openURL("https://register.jabber.org/");
}
/**
@@ -552,7 +559,7 @@ public class JabberAccountRegistrationWizard
*/
public boolean isWebSignupSupported()
{
- return true;
+ return false;
}
/**
@@ -624,7 +631,10 @@ public class JabberAccountRegistrationWizard
*/
protected JabberAccountCreationFormService getCreateAccountService()
{
- return null;
+ if (createAccountService == null)
+ createAccountService = new JabberAccountCreationForm();
+
+ return createAccountService;
}
/**
@@ -657,6 +667,15 @@ public class JabberAccountRegistrationWizard
}
/**
+ * Return the string for add existing account button.
+ * @return the string for add existing account button.
+ */
+ protected String getExistingAccountLabel()
+ {
+ return Resources.getString("plugin.jabberaccregwizz.EXISTING_ACCOUNT");
+ }
+
+ /**
* Return the string for home page link label.
* @return the string for home page link label
*/
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberNewAccountDialog.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberNewAccountDialog.java
deleted file mode 100644
index 79708f5..0000000
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberNewAccountDialog.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.sip.communicator.plugin.jabberaccregwizz;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.io.*;
-
-import javax.imageio.*;
-import javax.swing.*;
-import javax.swing.border.*;
-import javax.swing.event.*;
-
-import net.java.sip.communicator.util.*;
-import net.java.sip.communicator.util.swing.*;
-
-import org.jivesoftware.smack.*;
-
-/**
- * Dialog for adding a new Jabber account.
- *
- * @author Nicolas Grandclaude
- */
-public class JabberNewAccountDialog
- extends SIPCommDialog
- implements DocumentListener
-{
- private static final Logger logger = Logger
- .getLogger(JabberNewAccountDialog.class);
-
- private JabberServerChooserDialog jabberServerChooserDialog;
-
- // Panels
- private JPanel userIDPassPanel = new TransparentPanel(new BorderLayout(10, 10));
-
- private JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
-
- private JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
-
- private JPanel serverPanel = new TransparentPanel(new BorderLayout(10, 10));
-
- private JPanel buttonPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
-
- private Box buttonBox = new Box(BoxLayout.X_AXIS);
-
- private JPanel mainPanel = new TransparentPanel(new BorderLayout());
-
- private JPanel westPanel = new TransparentPanel(new BorderLayout(10, 10));
-
- // Labels
- private JLabel serverLabel
- = new JLabel(Resources.getString("plugin.jabberaccregwizz.CSERVER"));
-
- private JLabel userIDLabel
- = new JLabel(Resources.getString("plugin.jabberaccregwizz.USERNAME"));
-
- private JLabel passLabel
- = new JLabel(Resources.getString("service.gui.PASSWORD"));
-
- private JLabel pass2Label
- = new JLabel(Resources.getString(
- "plugin.jabberaccregwizz.PASSWORD_CONFIRM"));
-
- private JLabel portLabel
- = new JLabel(Resources.getString("service.gui.PORT"));
-
- private JLabel westIconLabel = new JLabel();
-
- // Textfield
- private JTextField serverField = new JTextField();
-
- private JTextField userIDField = new JTextField();
-
- private JPasswordField passField = new JPasswordField();
-
- private JPasswordField pass2Field = new JPasswordField();
-
- private JTextField portField = new JTextField("5222");
-
- // Button
- private JButton chooseButton = new JButton();
-
- private JButton okButton = new JButton();
-
- private JButton cancelButton = new JButton();
-
- // Smack objects
- private XMPPConnection xmppConnection = null;
-
- private AccountManager accountManager = null;
-
- // Variables for FirstWizardPage
- public boolean isOK = false;
-
- public String userID = null;
-
- public String password = null;
-
- public String server = null;
-
- public String port = null;
-
- private LoadingAccountGlassPane loadingAccountGlassPane
- = new LoadingAccountGlassPane();
-
- /**
- * Creates an instance of <tt>JabberNewAccountDialog</tt>.
- */
- public JabberNewAccountDialog()
- {
- this.setSize(new Dimension(450, 250));
- this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle(
- Resources.getString("plugin.jabberaccregwizz.NEW_ACCOUNT_TITLE"));
- this.setModal(true);
- this.setGlassPane(loadingAccountGlassPane);
-
- // Place the window in the screen center
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation(screenSize.width / 2 - this.getWidth() / 2,
- screenSize.height / 2 - this.getHeight() / 2);
-
- this.init();
- }
-
- /**
- * Connect to the choose server and create a new account with Smack
- *
- * @param server the server domain
- * @param port TCP port to connect
- * @param username username
- * @param password password
- */
- private boolean addNewAccount(String server, int port, String username,
- String password)
- {
- try
- {
- ConnectionConfiguration config = new ConnectionConfiguration(
- server, port);
-
- xmppConnection = new XMPPConnection(config);
- xmppConnection.connect();
-
- accountManager = new AccountManager(xmppConnection);
- accountManager.createAccount(username, password);
- return true;
- }
- catch (XMPPException exc)
- {
- if (exc.getXMPPError().getCode() == 409)
- {
- JOptionPane.showMessageDialog(
- null,
- Resources.getString(
- "plugin.jabberaccregwizz.USER_EXISTS_ERROR"),
- Resources.getString(
- "plugin.jabberaccregwizz.XMPP_ERROR"),
- JOptionPane.ERROR_MESSAGE);
-
- logger.error(
- "Error when created a new Jabber account :" +
- " user already exist");
- }
- else
- {
- JOptionPane.showMessageDialog(
- null,
- Resources.getString(
- "plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR"),
- Resources.getString(
- "plugin.jabberaccregwizz.XMPP_ERROR"),
- JOptionPane.ERROR_MESSAGE);
- }
- return false;
- }
- }
-
- /**
- * Initializes all panels, buttons, etc.
- */
- private void init()
- {
-
- labelsPanel.add(serverLabel);
- labelsPanel.add(userIDLabel);
- labelsPanel.add(passLabel);
- labelsPanel.add(pass2Label);
- labelsPanel.add(portLabel);
-
- userIDField.setColumns(30);
-
- serverPanel.add(serverField, BorderLayout.CENTER);
- serverPanel.add(chooseButton, BorderLayout.EAST);
- valuesPanel.add(serverPanel);
- valuesPanel.add(userIDField);
- valuesPanel.add(passField);
- valuesPanel.add(pass2Field);
- valuesPanel.add(portField);
-
- serverField.getDocument().addDocumentListener(this);
- userIDField.getDocument().addDocumentListener(this);
- passField.getDocument().addDocumentListener(this);
- pass2Field.getDocument().addDocumentListener(this);
- portField.getDocument().addDocumentListener(this);
-
- userIDPassPanel.add(labelsPanel, BorderLayout.WEST);
- userIDPassPanel.add(valuesPanel, BorderLayout.CENTER);
-
- chooseButton.setText(
- Resources.getString("plugin.jabberaccregwizz.CHOOSE"));
- chooseButton.setMnemonic(
- Resources.getMnemonic("plugin.jabberaccregwizz.CHOOSE"));
-
- westIconLabel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createEmptyBorder(20, 20, 20, 20), BorderFactory
- .createTitledBorder("")));
- try
- {
- westIconLabel.setIcon(new ImageIcon(ImageIO
- .read(new ByteArrayInputStream(Resources
- .getImage(Resources.PAGE_IMAGE)))));
- }
- catch (IOException e)
- {
- logger.error("Could not read image.", e);
- }
-
- westPanel.add(westIconLabel, BorderLayout.NORTH);
- this.mainPanel.add(westPanel, BorderLayout.WEST);
-
- // Choose button open the JabberServerChooserDialog
- chooseButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- jabberServerChooserDialog = new JabberServerChooserDialog();
- if (jabberServerChooserDialog.isOK) // OK pressed in
- // JabberServerChooserDialog
- {
- serverField
- .setText(jabberServerChooserDialog.serverSelected);
- }
- }
- });
-
- // Ok button
- okButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- if (new String(passField.getPassword()).equals(new String(
- pass2Field.getPassword())))
- { // the two password fields are the same
- new Thread()
- {
- public void run()
- {
- boolean result = addNewAccount(serverField.getText(),
- Integer.parseInt(portField.getText()),
- userIDField.getText(),
- new String(passField.getPassword()));
-
- if (result == true)
- {
- // Update FirstWizardDialog field
- isOK = true;
- userID = new String(userIDField.getText());
- password = new String(passField.getPassword());
- server = new String(serverField.getText());
- port = new String(portField.getText());
- dispose();
- }
- }
- }.start();
-
- loadingAccountGlassPane.setVisible(true);
- }
- else
- {
- JOptionPane.showMessageDialog(
- null,
- Resources.getString(
- "plugin.jabberaccregwizz.PROTOCOL_DESCRIPTION"),
- Resources.getString(
- "plugin.jabberaccregwizz.XMPP_ERROR"),
- JOptionPane.ERROR_MESSAGE);
- }
- }
- });
-
- // Cancel button
- cancelButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- dispose();
- }
- });
-
- okButton.setText(Resources.getString("service.gui.OK"));
- okButton.setMnemonic(Resources.getMnemonic("service.gui.OK"));
- okButton.setEnabled(false);
-
- cancelButton.setText(Resources.getString("service.gui.CANCEL"));
- cancelButton.setMnemonic(Resources.getMnemonic("service.gui.CANCEL"));
-
- buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
- buttonBox.add(okButton);
- buttonBox.add(Box.createHorizontalStrut(10));
- buttonBox.add(cancelButton);
-
- buttonPanel.add(buttonBox);
-
- this.mainPanel.add(userIDPassPanel, BorderLayout.CENTER);
- this.mainPanel.add(buttonPanel, BorderLayout.SOUTH);
-
- mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- this.getContentPane().add(mainPanel, BorderLayout.NORTH);
-
- this.setVisible(true);
- }
-
- /**
- * Sets the "Ok" button enabled if all fields are filled.
- */
- private void enableOKButton()
- {
- okButton.setEnabled(false);
- try
- {
- Integer.parseInt(portField.getText());
- }
- catch (NumberFormatException ex)
- {
- okButton.setEnabled(false);
- return;
- }
-
- if (serverField.getText().equals("")
- || userIDField.getText().equals("")
- || (new String(passField.getPassword())).equals("")
- || (new String(pass2Field.getPassword())).equals(""))
- {
- okButton.setEnabled(false);
- }
- else
- {
- okButton.setEnabled(true);
- }
- }
-
- public void insertUpdate(DocumentEvent evt)
- {
- this.enableOKButton();
- }
-
- public void removeUpdate(DocumentEvent evt)
- {
- this.enableOKButton();
- }
-
- public void changedUpdate(DocumentEvent evt)
- {
- }
-
- public void pageHiding()
- {
- }
-
- public void pageShown()
- {
- }
-
- public void pageBack()
- {
- }
-
- protected void close(boolean isEscaped)
- {
- cancelButton.doClick();
- }
-
- /**
- * A GlassPane that would change the cursor to a waiting cursor until the
- * new account is registered.
- */
- private static class LoadingAccountGlassPane extends JComponent
- {
- public LoadingAccountGlassPane()
- {
- this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- }
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java
index 48b16a9..e0193c4 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java
@@ -45,7 +45,7 @@ public class JabberServerChooserDialog
private JTable serversTable;
private JTextArea chooseArea = new JTextArea(Resources
- .getString("chooseServerText"));
+ .getString("plugin.jabberaccregwizz.CHOOSE_SERVER_TEXT"));
// Panel
private JPanel mainPanel = new TransparentPanel(new BorderLayout());
@@ -63,17 +63,19 @@ public class JabberServerChooserDialog
private JLabel westIconLabel = new JLabel();
- private JButton okButton = new JButton(Resources.getString("okLabel"));
+ private JButton okButton
+ = new JButton(Resources.getString("service.gui.OK"));
private JButton cancelButton = new JButton(Resources
- .getString("cancelLabel"));
+ .getString("service.gui.CANCEL"));
private Vector<String> servers = new Vector<String>();
private FileAccessService faService = null;
private String[] columnNames =
- {Resources.getString("serverColumn"), Resources.getString("commentColumn")};
+ { Resources.getString("plugin.jabberaccregwizz.SERVER_COLUMN"),
+ Resources.getString("plugin.jabberaccregwizz.COMMENT_COLUMN")};
public boolean isOK = false;
@@ -86,7 +88,8 @@ public class JabberServerChooserDialog
{
this.setSize(new Dimension(550, 450));
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle(Resources.getString("chooseTitle"));
+ this.setTitle(Resources.getString(
+ "plugin.jabberaccregwizz.CHOOSE_SERVER_TITLE"));
this.setModal(true);
// Place the window in the center
@@ -145,13 +148,11 @@ public class JabberServerChooserDialog
eastPanel.add(scrollPane, BorderLayout.CENTER);
// Ok button
- okButton.setText(Resources.getString("okLabel"));
- okButton.setMnemonic(Resources.getMnemonic("okLabel"));
+ okButton.setMnemonic(Resources.getMnemonic("service.gui.OK"));
okButton.setEnabled(false);
// Cancel button
- cancelButton.setText(Resources.getString("cancelLabel"));
- cancelButton.setMnemonic(Resources.getMnemonic("cancelLabel"));
+ cancelButton.setMnemonic(Resources.getMnemonic("service.gui.CANCEL"));
// Box with Ok and Cancel
buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/NewAccount.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/NewAccount.java
index af720cc..e6207b9 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/NewAccount.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/NewAccount.java
@@ -26,18 +26,26 @@ public class NewAccount
private String serverAddress;
/**
+ * The port to connect to.
+ */
+ private String serverPort;
+
+ /**
* Creates a new account by specifying the account user name and password.
* @param userName the account user name
* @param password the account password
* @param serverAddress the server address to set
+ * @param serverPort the port to connect to
*/
public NewAccount( String userName,
char[] password,
- String serverAddress)
+ String serverAddress,
+ String port)
{
this.userName = userName;
this.password = password;
this.serverAddress = serverAddress;
+ this.serverPort = port;
}
/**
@@ -93,4 +101,13 @@ public class NewAccount
{
return serverAddress;
}
+
+ /**
+ * Returns the port of the server.
+ * @return the port of the server
+ */
+ public String getServerPort()
+ {
+ return serverPort;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/Resources.java
index 72cc897..6c49dd8 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/Resources.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/Resources.java
@@ -85,7 +85,8 @@ public class Resources
*/
public static InputStream getPropertyInputStream(String key)
{
- return getResources().getSettingsInputStream(key);
+ return getResources().getSettingsInputStream(key,
+ JabberAccRegWizzActivator.class);
}
public static ResourceManagementService getResources()
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
index 20c617f..0ab4d5d 100755
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
@@ -39,4 +39,5 @@ Import-Package: org.osgi.framework,
javax.swing.tree,
javax.swing.undo,
javax.swing.border,
- org.jivesoftware.smack
+ org.jivesoftware.smack,
+ org.jivesoftware.smack.packet
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml b/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml
index 3c6f409..a5dff2a 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml
@@ -2,4 +2,4 @@
<query xmlns='http://jabber.org/protocol/disco#items'>
<item jid='jabber.org' comment='Jabber Software Foundation Server'/>
-</query>
+</query> \ No newline at end of file
diff --git a/src/net/java/sip/communicator/service/resources/ResourceManagementService.java b/src/net/java/sip/communicator/service/resources/ResourceManagementService.java
index 024211c..e67765d 100644
--- a/src/net/java/sip/communicator/service/resources/ResourceManagementService.java
+++ b/src/net/java/sip/communicator/service/resources/ResourceManagementService.java
@@ -178,6 +178,18 @@ public interface ResourceManagementService
public InputStream getSettingsInputStream(String streamKey);
/**
+ * Returns a stream from a given identifier, obtained through the class
+ * loader of the given resourceClass.
+ *
+ * @param streamKey The identifier of the stream.
+ * @param resourceClass the resource class through which the resource would
+ * be obtained
+ * @return The stream for the given identifier.
+ */
+ public InputStream getSettingsInputStream( String streamKey,
+ Class<?> resourceClass);
+
+ /**
* Returns the int value of the corresponding configuration key.
*
* @param key The identifier of the string in the resources properties file.