aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2010-02-12 15:08:42 +0000
committerDamian Minkov <damencho@jitsi.org>2010-02-12 15:08:42 +0000
commitd7092d65ddc6376dee589024527531f6ed65a5c6 (patch)
treead9e9ce68c1cf336f9e3c783b3a15ab3c16bbe60
parent19ad20f4a15a007bda51c6b6c1eed7fc8181f647 (diff)
downloadjitsi-d7092d65ddc6376dee589024527531f6ed65a5c6.zip
jitsi-d7092d65ddc6376dee589024527531f6ed65a5c6.tar.gz
jitsi-d7092d65ddc6376dee589024527531f6ed65a5c6.tar.bz2
Introduce new support for Facebook, through xmpp. Remove old one.
-rw-r--r--build.xml18
-rw-r--r--lib/installer-exclude/smack.manifest.mf3
-rw-r--r--resources/images/protocol/facebook/logo32x32.pngbin0 -> 1293 bytes
-rw-r--r--resources/images/protocol/facebook/logo48x48.pngbin0 -> 1521 bytes
-rw-r--r--resources/images/protocol/facebook/status16x16-away.pngbin0 -> 3203 bytes
-rw-r--r--resources/images/protocol/facebook/status16x16-connecting.gifbin0 -> 522 bytes
-rw-r--r--resources/images/protocol/facebook/status16x16-dnd.pngbin0 -> 552 bytes
-rw-r--r--resources/images/protocol/facebook/status16x16-ffc.pngbin0 -> 552 bytes
-rw-r--r--resources/images/protocol/facebook/status16x16-offline.pngbin0 -> 567 bytes
-rw-r--r--resources/images/protocol/facebook/status16x16-online.pngbin0 -> 552 bytes
-rw-r--r--resources/images/protocol/facebook/status16x16-xa.pngbin0 -> 552 bytes
-rw-r--r--resources/languages/resources.properties8
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java8
-rwxr-xr-xsrc/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java116
-rw-r--r--src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java2
-rw-r--r--src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java18
-rw-r--r--src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java24
-rw-r--r--src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java69
19 files changed, 208 insertions, 62 deletions
diff --git a/build.xml b/build.xml
index 3ac8523..02d9206 100644
--- a/build.xml
+++ b/build.xml
@@ -885,7 +885,7 @@
bundle-plugin-googletalkaccregwizz,bundle-argdelegation-service,
bundle-argdelegation,bundle-zrtp4j,
bundle-filehistory,bundle-metahistory,bundle-metahistory-slick,
- bundle-facebook,bundle-plugin-facebookaccregwizz,
+ bundle-plugin-facebookaccregwizz,
bundle-bouncycastle,bundle-plugin-otr,bundle-plugin-iptelaccregwizz"/>
<!--BUNDLE-SC-LAUNCHER-->
@@ -1304,6 +1304,7 @@ javax.swing.event, javax.swing.border"/>
prefix="resources/images">
<include name="protocol/icq/**/*"/>
<include name="protocol/googletalk/**/*"/>
+ <include name="protocol/facebook/**/*"/>
<include name="protocol/jabber/**/*"/>
<include name="protocol/msn/**/*"/>
<include name="protocol/yahoo/**/*"/>
@@ -1475,21 +1476,6 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
- <!-- BUNDLE-FACEBOOK -->
- <target name="bundle-facebook">
- <!-- Creates a bundle containing the Facebook impl of the protocol provider.-->
- <jar compress="false" destfile="${bundles.dest}/protocol-facebook.jar"
- manifest="${src}/net/java/sip/communicator/impl/protocol/facebook/facebook.provider.manifest.mf">
- <zipfileset dir="${dest}/net/java/sip/communicator/impl/protocol/facebook"
- prefix="net/java/sip/communicator/impl/protocol/facebook"/>
- <zipfileset dir="${resources}/images/protocol/facebook"
- prefix="resources/images/protocol/facebook" />
- <zipfileset src="${lib.noinst}/commons-codec-1.3.jar" prefix=""/>
- <zipfileset src="${lib.noinst}/httpclient-4.0-beta2.jar" prefix=""/>
- <zipfileset src="${lib.noinst}/json-20090723.jar" prefix=""/>
- </jar>
- </target>
-
<!-- BUNDLE-UI-SERVICE -->
<target name="bundle-ui-service">
<!-- Bundle sip-communicator's UI.-->
diff --git a/lib/installer-exclude/smack.manifest.mf b/lib/installer-exclude/smack.manifest.mf
index 44a8cfc..5498f88 100644
--- a/lib/installer-exclude/smack.manifest.mf
+++ b/lib/installer-exclude/smack.manifest.mf
@@ -31,5 +31,6 @@ Export-Package: org.jivesoftware.smack,
org.jivesoftware.smackx.jingle.listeners,
org.jivesoftware.smackx.filetransfer,
org.jivesoftware.smackx.provider,
+ org.jivesoftware.smack.sasl,
org.xmlpull.v1,
- org.xmlpull.mxp1
+ org.xmlpull.mxp1 \ No newline at end of file
diff --git a/resources/images/protocol/facebook/logo32x32.png b/resources/images/protocol/facebook/logo32x32.png
new file mode 100644
index 0000000..a6da37b
--- /dev/null
+++ b/resources/images/protocol/facebook/logo32x32.png
Binary files differ
diff --git a/resources/images/protocol/facebook/logo48x48.png b/resources/images/protocol/facebook/logo48x48.png
new file mode 100644
index 0000000..2501aca
--- /dev/null
+++ b/resources/images/protocol/facebook/logo48x48.png
Binary files differ
diff --git a/resources/images/protocol/facebook/status16x16-away.png b/resources/images/protocol/facebook/status16x16-away.png
new file mode 100644
index 0000000..771d75f
--- /dev/null
+++ b/resources/images/protocol/facebook/status16x16-away.png
Binary files differ
diff --git a/resources/images/protocol/facebook/status16x16-connecting.gif b/resources/images/protocol/facebook/status16x16-connecting.gif
new file mode 100644
index 0000000..84b16f1
--- /dev/null
+++ b/resources/images/protocol/facebook/status16x16-connecting.gif
Binary files differ
diff --git a/resources/images/protocol/facebook/status16x16-dnd.png b/resources/images/protocol/facebook/status16x16-dnd.png
new file mode 100644
index 0000000..bc42cf9
--- /dev/null
+++ b/resources/images/protocol/facebook/status16x16-dnd.png
Binary files differ
diff --git a/resources/images/protocol/facebook/status16x16-ffc.png b/resources/images/protocol/facebook/status16x16-ffc.png
new file mode 100644
index 0000000..bc42cf9
--- /dev/null
+++ b/resources/images/protocol/facebook/status16x16-ffc.png
Binary files differ
diff --git a/resources/images/protocol/facebook/status16x16-offline.png b/resources/images/protocol/facebook/status16x16-offline.png
new file mode 100644
index 0000000..50ed131
--- /dev/null
+++ b/resources/images/protocol/facebook/status16x16-offline.png
Binary files differ
diff --git a/resources/images/protocol/facebook/status16x16-online.png b/resources/images/protocol/facebook/status16x16-online.png
new file mode 100644
index 0000000..bc42cf9
--- /dev/null
+++ b/resources/images/protocol/facebook/status16x16-online.png
Binary files differ
diff --git a/resources/images/protocol/facebook/status16x16-xa.png b/resources/images/protocol/facebook/status16x16-xa.png
new file mode 100644
index 0000000..bc42cf9
--- /dev/null
+++ b/resources/images/protocol/facebook/status16x16-xa.png
Binary files differ
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index adb866d..8932340 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -537,12 +537,12 @@ plugin.callhistoryform.INCOMING=Incoming
plugin.callhistoryform.OUTGOING=Outgoing
# facebookaccregwizz
-plugin.facebookaccregwizz.EXPERIMENTAL_WARNING=<html><body>The support for this protocol is experimental and may not work as expected. Please report bugs to <a href="mailto:dev@sip-communicator.dev.java.net">dev@sip-communicator.dev.java.net</a>.</body></html>
-plugin.facebookaccregwizz.INVALID_EMAIL_ADDRESS=Invalid email address
+plugin.facebookaccregwizz.DESCRIPTION=<html><body><center>User must have registered its username through Facebook profile settings page.</center></body></html>
+plugin.facebookaccregwizz.INVALID_EMAIL_ADDRESS=Invalid username
plugin.facebookaccregwizz.PROTOCOL_DESCRIPTION=The Facebook Chat protocol
plugin.facebookaccregwizz.PROTOCOL_NAME=Facebook
-plugin.facebookaccregwizz.USERNAME=Email:
-plugin.facebookaccregwizz.USERNAME_AND_PASSWORD=Email and Password
+plugin.facebookaccregwizz.USERNAME=Username:
+plugin.facebookaccregwizz.USERNAME_AND_PASSWORD=Username and Password
# generalconfig
plugin.generalconfig.AUTO_START=Auto - start {0} when computer restarts or reboots.
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
index acfaad3..de49700 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
@@ -14,6 +14,7 @@ import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.jabberconstants.*;
import net.java.sip.communicator.util.*;
+import net.java.sip.communicator.impl.protocol.jabber.sasl.*;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.packet.*;
@@ -375,6 +376,13 @@ public class ProtocolProviderServiceJabberImpl
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
+ // Insert our sasl mechanism implementation
+ // in order to support some incompatable servers
+ SASLAuthentication.unregisterSASLMechanism("DIGEST-MD5");
+ SASLAuthentication.registerSASLMechanism("DIGEST-MD5",
+ SASLDigestMD5Mechanism.class);
+ SASLAuthentication.supportSASLMechanism("DIGEST-MD5");
+
try
{
connection.login(userID, password, accountResource);
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
index 6c0b831..06fea28 100755
--- a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
@@ -10,6 +10,7 @@ Import-Package: org.osgi.framework,
org.jivesoftware.smack.provider,
org.jivesoftware.smack.util,
org.jivesoftware.smack.filter,
+ org.jivesoftware.smack.sasl,
org.jivesoftware.smackx,
org.jivesoftware.smackx.muc,
org.jivesoftware.smackx.packet,
@@ -34,4 +35,5 @@ Import-Package: org.osgi.framework,
org.xmlpull.v1,
org.xmlpull.mxp1,
javax.xml.parsers,
- org.w3c.dom
+ javax.security.sasl,
+ javax.security.auth.callback
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java b/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java
new file mode 100644
index 0000000..adeef1f
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java
@@ -0,0 +1,116 @@
+/*
+ * 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.impl.protocol.jabber.sasl;
+
+import java.io.*;
+import java.util.*;
+import javax.security.auth.callback.*;
+import javax.security.sasl.*;
+
+import org.jivesoftware.smack.*;
+import org.jivesoftware.smack.util.Base64;
+
+/**
+ * Creates our custom SASLDigestMD5Mechanism with some changes in order
+ * to be compatible with some jabber servers.
+ * @author Damian Minkov
+ */
+public class SASLDigestMD5Mechanism
+ extends org.jivesoftware.smack.sasl.SASLDigestMD5Mechanism
+{
+ /**
+ * Creates our mechanism.
+ * @param saslAuthentication
+ */
+ public SASLDigestMD5Mechanism(SASLAuthentication saslAuthentication)
+ {
+ super(saslAuthentication);
+ }
+
+ /**
+ * Builds and sends the <tt>auth</tt> stanza to the server. Note that this method of
+ * authentication is not recommended, since it is very inflexible. Use
+ * {@link #authenticate(String, String, CallbackHandler)} whenever possible.
+ *
+ * @param username the username of the user being authenticated.
+ * @param host the hostname where the user account resides.
+ * @param password the password for this account.
+ * @throws IOException If a network error occurs while authenticating.
+ * @throws XMPPException If a protocol error occurs or the user is not authenticated.
+ */
+ public void authenticate(String username, String host, String password)
+ throws IOException, XMPPException
+ {
+ //Since we were not provided with a CallbackHandler, we will use our own with the given
+ //information
+
+ //Set the authenticationID as the username, since they must be the same in this case.
+ this.authenticationId = username;
+ this.password = password;
+ this.hostname = host;
+
+ String[] mechanisms = { getName() };
+ Map<String,String> props = new HashMap<String,String>();
+ sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, this);
+ authenticate();
+ }
+
+ /**
+ * Builds and sends the <tt>auth</tt> stanza to the server. The callback handler will handle
+ * any additional information, such as the authentication ID or realm, if it is needed.
+ *
+ * @param username the username of the user being authenticated.
+ * @param host the hostname where the user account resides.
+ * @param cbh the CallbackHandler to obtain user information.
+ * @throws IOException If a network error occurs while authenticating.
+ * @throws XMPPException If a protocol error occurs or the user is not authenticated.
+ */
+ public void authenticate(String username, String host, CallbackHandler cbh)
+ throws IOException, XMPPException
+ {
+ String[] mechanisms = { getName() };
+ Map<String,String> props = new HashMap<String,String>();
+ sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, cbh);
+ authenticate();
+ }
+
+ /**
+ * The server is challenging the SASL mechanism for the stanza he just sent. Send a
+ * response to the server's challenge.
+ *
+ * @param challenge a base64 encoded string representing the challenge.
+ * @throws IOException if an exception sending the response occurs.
+ */
+ public void challengeReceived(String challenge)
+ throws IOException
+ {
+ // Build the challenge response stanza encoding the response text
+ StringBuilder stanza = new StringBuilder();
+
+ byte response[];
+ if(challenge != null) {
+ response = sc.evaluateChallenge(Base64.decode(challenge));
+ } else {
+ response = sc.evaluateChallenge(null);
+ }
+
+ String authenticationText = null;
+ if(null != response) {
+ authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
+ }
+ if((null == authenticationText) || (authenticationText.equals(""))) {
+ authenticationText = "=";
+ }
+
+ stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
+ stanza.append(authenticationText);
+ stanza.append("</response>");
+
+ // Send the authentication to the server
+ getSASLAuthentication().send(stanza.toString());
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java
index ab0ae20..90a228a 100644
--- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java
@@ -92,7 +92,7 @@ public class FacebookAccRegWizzActivator
String osgiFilter = "("
+ ProtocolProviderFactory.PROTOCOL
- + "=" + "Facebook" + ")";
+ + "=" + ProtocolNames.JABBER + ")";
try
{
diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java
index e0f6630..b109a8e 100644
--- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java
@@ -14,26 +14,26 @@ package net.java.sip.communicator.plugin.facebookaccregwizz;
*/
public class FacebookAccountRegistration
{
- private String email;
+ private String username;
private String password;
private boolean rememberPassword;
/**
- * Returns the Email of the facebook registration account.
- * @return the Email of the facebook registration account.
+ * Returns the username of the facebook registration account.
+ * @return the username of the facebook registration account.
*/
- public String getEmail()
+ public String getUsername()
{
- return email;
+ return username;
}
/**
- * Sets the Email of the facebook registration account.
- * @param email the userID of the facebook registration account.
+ * Sets the username of the facebook registration account.
+ * @param username the userID of the facebook registration account.
*/
- public void setEmail(String email)
+ public void setUsername(String username)
{
- this.email = email;
+ this.username = username;
}
/**
diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
index e7adc87..6f3a5f3 100644
--- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
@@ -30,6 +30,8 @@ public class FacebookAccountRegistrationWizard
*/
private FirstWizardPage firstWizardPage;
+ public static final String SERVER_ADDRESS = "chat.facebook.com";
+
/**
* The object that we use to store details on an account that we will be
* creating.
@@ -121,7 +123,7 @@ public class FacebookAccountRegistrationWizard
{
Map<String, String> summaryTable = new Hashtable<String, String>();
- summaryTable.put("User ID", registration.getEmail());
+ summaryTable.put("User ID", registration.getUsername());
return summaryTable.entrySet().iterator();
}
@@ -134,7 +136,7 @@ public class FacebookAccountRegistrationWizard
if (!firstWizardPage.isCommitted())
firstWizardPage.commitPage();
- return signin(registration.getEmail(), null);
+ return signin(registration.getUsername(), null);
}
/**
@@ -164,12 +166,21 @@ public class FacebookAccountRegistrationWizard
{
Map<String, String> accountProperties = new Hashtable<String, String>();
+ /* Make the account use the resources specific to Facebook. */
+ accountProperties.put(ProtocolProviderFactory.PROTOCOL,
+ ProtocolNames.FACEBOOK);
+ accountProperties
+ .put(ProtocolProviderFactory.PROTOCOL_ICON_PATH,
+ "resources/images/protocol/facebook");
+
if (registration.isRememberPassword())
{
accountProperties.put( ProtocolProviderFactory.PASSWORD,
registration.getPassword());
}
+ accountProperties.put("SEND_KEEP_ALIVE", Boolean.TRUE.toString());
+
if (isModification)
{
providerFactory.uninstallAccount(protocolProvider.getAccountID());
@@ -177,6 +188,15 @@ public class FacebookAccountRegistrationWizard
this.isModification = false;
}
+ accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
+ SERVER_ADDRESS);
+
+ accountProperties.put(ProtocolProviderFactory.SERVER_PORT, "5222");
+
+ accountProperties.put(ProtocolProviderFactory.RESOURCE, "sip-comm");
+
+ accountProperties.put(ProtocolProviderFactory.RESOURCE_PRIORITY, "10");
+
Throwable exception = null;
try
diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java
index e85f33f..dfe2e21 100644
--- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java
@@ -16,7 +16,7 @@ import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
/**
- * The <tt>FirstWizardPage</tt> is the page, where user could enter the email
+ * The <tt>FirstWizardPage</tt> is the page, where user could enter the username
* and the password of the account.
*
* @author Dai Zhiwei
@@ -29,7 +29,7 @@ public class FirstWizardPage
{
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
- public static final String USER_NAME_EXAMPLE = "Ex: username@email.com";
+ public static final String USER_NAME_EXAMPLE = "Ex: username";
private JPanel userPassPanel
= new TransparentPanel(new BorderLayout(10, 10));
@@ -38,7 +38,7 @@ public class FirstWizardPage
private JPanel valuesPanel = new TransparentPanel();
- private JLabel emailLabel
+ private JLabel usernameLabel
= new JLabel(Resources.getString("plugin.facebookaccregwizz.USERNAME"));
private JLabel passLabel
@@ -49,9 +49,9 @@ public class FirstWizardPage
private JPanel emptyPanel = new TransparentPanel();
- private JLabel emailExampleLabel = new JLabel(USER_NAME_EXAMPLE);
+ private JLabel usernameExampleLabel = new JLabel(USER_NAME_EXAMPLE);
- private JTextField emailField = new JTextField();
+ private JTextField usernameField = new JTextField();
private JPasswordField passField = new JPasswordField();
@@ -93,32 +93,32 @@ public class FirstWizardPage
*/
private void init()
{
- this.emailField.getDocument().addDocumentListener(this);
+ this.usernameField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
this.rememberPassBox.setOpaque(false);
this.existingAccountLabel.setForeground(Color.RED);
- this.emailExampleLabel.setForeground(Color.GRAY);
- this.emailExampleLabel.setFont(
- emailExampleLabel.getFont().deriveFont(8));
+ this.usernameExampleLabel.setForeground(Color.GRAY);
+ this.usernameExampleLabel.setFont(
+ usernameExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
- this.emailExampleLabel.setBorder(
+ this.usernameExampleLabel.setBorder(
BorderFactory.createEmptyBorder(0, 0, 8,0));
- labelsPanel.add(emailLabel);
+ labelsPanel.add(usernameLabel);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
- valuesPanel.add(emailField);
- valuesPanel.add(emailExampleLabel);
+ valuesPanel.add(usernameField);
+ valuesPanel.add(usernameExampleLabel);
valuesPanel.add(passField);
JLabel experimentalWarningLabel
= new JLabel(
Resources.getString(
- "plugin.facebookaccregwizz.EXPERIMENTAL_WARNING"));
- experimentalWarningLabel.setForeground(Color.RED);
+ "plugin.facebookaccregwizz.DESCRIPTION"));
+ experimentalWarningLabel.setHorizontalAlignment(JLabel.CENTER);
setPreferredWidthInCharCount(experimentalWarningLabel, 50);
userPassPanel.add(experimentalWarningLabel, BorderLayout.NORTH);
@@ -212,7 +212,7 @@ public class FirstWizardPage
*/
public void pageShowing()
{
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
}
/**
@@ -220,7 +220,12 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String userID = emailField.getText().trim();
+
+ String userID = usernameField.getText().trim();
+
+ // add server part to username
+ if(userID.indexOf("@") == -1)
+ userID += "@" + FacebookAccountRegistrationWizard.SERVER_ADDRESS;
if (!wizard.isModification() && isExistingAccount(userID))
{
@@ -236,7 +241,7 @@ public class FirstWizardPage
FacebookAccountRegistration registration
= wizard.getRegistration();
- registration.setEmail(emailField.getText());
+ registration.setUsername(userID);
if (passField.getPassword() != null)
registration.setPassword(new String(passField.getPassword()));
@@ -251,9 +256,9 @@ public class FirstWizardPage
* Enables or disables the "Next" wizard button according to whether the
* User ID field is empty.
*/
- private void setNextButtonAccordingToEmail()
+ private void setNextButtonAccordingToUsername()
{
- if (emailField.getText() == null || emailField.getText().equals(""))
+ if (usernameField.getText() == null || usernameField.getText().equals(""))
{
wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
@@ -272,7 +277,7 @@ public class FirstWizardPage
*/
public void insertUpdate(DocumentEvent event)
{
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
}
/**
@@ -284,7 +289,7 @@ public class FirstWizardPage
*/
public void removeUpdate(DocumentEvent event)
{
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
}
public void changedUpdate(DocumentEvent event)
@@ -315,8 +320,8 @@ public class FirstWizardPage
String password = accountID.getAccountProperties()
.get(ProtocolProviderFactory.PASSWORD);
- this.emailField.setEnabled(false);
- this.emailField.setText(accountID.getUserID());
+ this.usernameField.setEnabled(false);
+ this.usernameField.setText(accountID.getUserID());
if (password != null)
{
@@ -329,11 +334,11 @@ public class FirstWizardPage
* Verifies whether there is already an account installed with the same
* details as the one that the user has just entered.
*
- * @param email the name of the user that the account is registered for
+ * @param username the name of the user that the account is registered for
* @return true if there is already an account for this userID and false
* otherwise.
*/
- private boolean isExistingAccount(String email)
+ private boolean isExistingAccount(String username)
{
ProtocolProviderFactory factory
= FacebookAccRegWizzActivator.getFacebookProtocolProviderFactory();
@@ -341,16 +346,24 @@ public class FirstWizardPage
Iterable<AccountID> registeredAccounts = factory.getRegisteredAccounts();
for (AccountID accountID : registeredAccounts)
- if (email.equalsIgnoreCase(accountID.getUserID()))
+ if (username.equalsIgnoreCase(accountID.getUserID()))
return true;
return false;
}
+ /**
+ * The simple form.
+ * @return
+ */
public Object getSimpleForm()
{
return userPassPanel;
}
-
+
+ /**
+ * Is committed.
+ * @return Is committed.
+ */
public boolean isCommitted()
{
return isCommitted;