[sip-comm-dev] Re: svn commit: r6751 - trunk: . lib/installer-exclude resources/images/protocol/facebook resources/languages src/net/java/sip/communicator/impl/protoc...


#1

Hi Damencho,

When I run r6751, I get the following which does not prevent the application from starting but anyway:

Auto-properties install: org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/protocol-facebook.jar - java.io.IOException: Referenced file does not exist: sc-bundles/protocol-facebook.jar
Auto-properties start: org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/protocol-facebook.jar - java.io.IOException: Referenced file does not exist: sc-bundles/protocol-facebook.jar

The real problem that I'm facing though is that when I try to create a Facebook account and I hit the Add button of the "Add new account" dialog, it outputs a wrongly placed error message in red stating "The specified AccountID was null" and "The account you entered is already installed". Please see the attached screenshot. Is it possible that it conflicts with my Google Talk account which has the same id/username?

Best regards,
Lubo

···

On 02/12/2010 05:08 PM, damencho@dev.java.net wrote:

Author: damencho
Date: 2010-02-12 15:08:42+0000
New Revision: 6751

Added:
    trunk/resources/images/protocol/facebook/logo32x32.png (contents, props changed)
    trunk/resources/images/protocol/facebook/logo48x48.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-away.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-connecting.gif (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-dnd.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-ffc.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-offline.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-online.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-xa.png (contents, props changed)
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java
Modified:
    trunk/build.xml
    trunk/lib/installer-exclude/smack.manifest.mf
    trunk/resources/languages/resources.properties
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java

Log:
Introduce new support for Facebook, through xmpp. Remove old one.

Modified: trunk/build.xml
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/build.xml?view=diff&rev=6751&p1=trunk/build.xml&p2=trunk/build.xml&r1=6750&r2=6751

--- trunk/build.xml (original)
+++ trunk/build.xml 2010-02-12 15:08:42+0000
@@ -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 @@
                  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 @@
          </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&quot; \- manifest=&quot;{src}/net/java/sip/communicator/impl/protocol/facebook/facebook.provider.manifest.mf">
-<zipfileset dir="\{dest\}/net/java/sip/communicator/impl/protocol/facebook&quot; \- prefix=&quot;net/java/sip/communicator/impl/protocol/facebook&quot;/&gt; \-&lt;zipfileset dir=&quot;{resources}/images/protocol/facebook"
- prefix="resources/images/protocol/facebook" />
-<zipfileset src="\{lib\.noinst\}/commons\-codec\-1\.3\.jar&quot; prefix=&quot;&quot;/&gt; \-&lt;zipfileset src=&quot;{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.-->

Modified: trunk/lib/installer-exclude/smack.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/lib/installer-exclude/smack.manifest.mf?view=diff&rev=6751&p1=trunk/lib/installer-exclude/smack.manifest.mf&p2=trunk/lib/installer-exclude/smack.manifest.mf&r1=6750&r2=6751

--- trunk/lib/installer-exclude/smack.manifest.mf (original)
+++ trunk/lib/installer-exclude/smack.manifest.mf 2010-02-12 15:08:42+0000
@@ -31,5 +31,6 @@
   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

Added: trunk/resources/images/protocol/facebook/logo32x32.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/logo32x32.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/logo48x48.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/logo48x48.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-away.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-away.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-connecting.gif
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-connecting.gif?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-dnd.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-dnd.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-ffc.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-ffc.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-offline.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-offline.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-online.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-online.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-xa.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-xa.png?view=auto&rev=6751

Binary file. No diff available.

Modified: trunk/resources/languages/resources.properties
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/languages/resources.properties?view=diff&rev=6751&p1=trunk/resources/languages/resources.properties&p2=trunk/resources/languages/resources.properties&r1=6750&r2=6751

--- trunk/resources/languages/resources.properties (original)
+++ trunk/resources/languages/resources.properties 2010-02-12 15:08:42+0000
@@ -537,12 +537,12 @@
  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.

Modified: trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java 2010-02-12 15:08:42+0000
@@ -14,6 +14,7 @@
  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 @@

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

Modified: trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf&p2=trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf 2010-02-12 15:08:42+0000
@@ -10,6 +10,7 @@
   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 @@
   org.xmlpull.v1,
   org.xmlpull.mxp1,
   javax.xml.parsers,
- org.w3c.dom
+ javax.security.sasl,
+ javax.security.auth.callback

Added: trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java?view=auto&rev=6751

--- (empty file)
+++ trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java 2010-02-12 15:08:42+0000
@@ -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());
+ }
+}

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java 2010-02-12 15:08:42+0000
@@ -92,7 +92,7 @@

          String osgiFilter = "("
              + ProtocolProviderFactory.PROTOCOL
- + "=" + "Facebook" + ")";
+ + "=" + ProtocolNames.JABBER + ")";

          try
          {

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java 2010-02-12 15:08:42+0000
@@ -14,26 +14,26 @@
   */
  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;
      }

      /**

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java 2010-02-12 15:08:42+0000
@@ -30,6 +30,8 @@
       */
      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 @@
      {
          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 @@
          if (!firstWizardPage.isCommitted())
              firstWizardPage.commitPage();

- return signin(registration.getEmail(), null);
+ return signin(registration.getUsername(), null);
      }

      /**
@@ -164,12 +166,21 @@
      {
          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 @@
              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

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java 2010-02-12 15:08:42+0000
@@ -16,7 +16,7 @@
  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 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 @@

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

      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 @@
       */
      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 void pageShowing()
      {
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
      }

      /**
@@ -220,7 +220,12 @@
       */
      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 @@
              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 @@
       * 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 void insertUpdate(DocumentEvent event)
      {
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
      }

      /**
@@ -284,7 +289,7 @@
       */
      public void removeUpdate(DocumentEvent event)
      {
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
      }

      public void changedUpdate(DocumentEvent event)
@@ -315,8 +320,8 @@
          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 @@
       * 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 @@
          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;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net


#2

Lubomir Marinov написа:

Hi Damencho,

When I run r6751, I get the following which does not prevent the
application from starting but anyway:

Auto-properties install: org.osgi.framework.BundleException: Unable to
cache bundle: reference:file:sc-bundles/protocol-facebook.jar -
java.io.IOException: Referenced file does not exist:
sc-bundles/protocol-facebook.jar
Auto-properties start: org.osgi.framework.BundleException: Unable to
cache bundle: reference:file:sc-bundles/protocol-facebook.jar -
java.io.IOException: Referenced file does not exist:
sc-bundles/protocol-facebook.jar

This is a probable culprit:

felix.client.run.properties.80:
     reference:file:sc-bundles/protocol-facebook.jar

Don't think we need this any more.

The real problem that I'm facing though is that when I try to create a
Facebook account and I hit the Add button of the "Add new account"
dialog, it outputs a wrongly placed error message in red stating "The
specified AccountID was null" and "The account you entered is already
installed". Please see the attached screenshot. Is it possible that it
conflicts with my Google Talk account which has the same id/username?

Yes, but that's probably because you are trying to register with your
e-mail address. You need to create a Username on their Account Settings
page:
    https://register.facebook.com/editaccount.php

Cheers,
Emil

···

Best regards,
Lubo

On 02/12/2010 05:08 PM, damencho@dev.java.net wrote:

Author: damencho
Date: 2010-02-12 15:08:42+0000
New Revision: 6751

Added:
    trunk/resources/images/protocol/facebook/logo32x32.png (contents, props changed)
    trunk/resources/images/protocol/facebook/logo48x48.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-away.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-connecting.gif (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-dnd.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-ffc.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-offline.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-online.png (contents, props changed)
    trunk/resources/images/protocol/facebook/status16x16-xa.png (contents, props changed)
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java
Modified:
    trunk/build.xml
    trunk/lib/installer-exclude/smack.manifest.mf
    trunk/resources/languages/resources.properties
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
    trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
    trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java

Log:
Introduce new support for Facebook, through xmpp. Remove old one.

Modified: trunk/build.xml
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/build.xml?view=diff&rev=6751&p1=trunk/build.xml&p2=trunk/build.xml&r1=6750&r2=6751

--- trunk/build.xml (original)
+++ trunk/build.xml 2010-02-12 15:08:42+0000
@@ -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 @@
                  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 @@
          </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&quot; \- manifest=&quot;{src}/net/java/sip/communicator/impl/protocol/facebook/facebook.provider.manifest.mf">
-<zipfileset dir="\{dest\}/net/java/sip/communicator/impl/protocol/facebook&quot; \- prefix=&quot;net/java/sip/communicator/impl/protocol/facebook&quot;/&gt; \-&lt;zipfileset dir=&quot;{resources}/images/protocol/facebook"
- prefix="resources/images/protocol/facebook" />
-<zipfileset src="\{lib\.noinst\}/commons\-codec\-1\.3\.jar&quot; prefix=&quot;&quot;/&gt; \-&lt;zipfileset src=&quot;{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.-->

Modified: trunk/lib/installer-exclude/smack.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/lib/installer-exclude/smack.manifest.mf?view=diff&rev=6751&p1=trunk/lib/installer-exclude/smack.manifest.mf&p2=trunk/lib/installer-exclude/smack.manifest.mf&r1=6750&r2=6751

--- trunk/lib/installer-exclude/smack.manifest.mf (original)
+++ trunk/lib/installer-exclude/smack.manifest.mf 2010-02-12 15:08:42+0000
@@ -31,5 +31,6 @@
   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

Added: trunk/resources/images/protocol/facebook/logo32x32.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/logo32x32.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/logo48x48.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/logo48x48.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-away.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-away.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-connecting.gif
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-connecting.gif?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-dnd.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-dnd.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-ffc.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-ffc.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-offline.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-offline.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-online.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-online.png?view=auto&rev=6751

Binary file. No diff available.

Added: trunk/resources/images/protocol/facebook/status16x16-xa.png
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/images/protocol/facebook/status16x16-xa.png?view=auto&rev=6751

Binary file. No diff available.

Modified: trunk/resources/languages/resources.properties
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/resources/languages/resources.properties?view=diff&rev=6751&p1=trunk/resources/languages/resources.properties&p2=trunk/resources/languages/resources.properties&r1=6750&r2=6751

--- trunk/resources/languages/resources.properties (original)
+++ trunk/resources/languages/resources.properties 2010-02-12 15:08:42+0000
@@ -537,12 +537,12 @@
  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.

Modified: trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java 2010-02-12 15:08:42+0000
@@ -14,6 +14,7 @@
  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 @@

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

Modified: trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf&p2=trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf 2010-02-12 15:08:42+0000
@@ -10,6 +10,7 @@
   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 @@
   org.xmlpull.v1,
   org.xmlpull.mxp1,
   javax.xml.parsers,
- org.w3c.dom
+ javax.security.sasl,
+ javax.security.auth.callback

Added: trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java?view=auto&rev=6751

--- (empty file)
+++ trunk/src/net/java/sip/communicator/impl/protocol/jabber/sasl/SASLDigestMD5Mechanism.java 2010-02-12 15:08:42+0000
@@ -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());
+ }
+}

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccRegWizzActivator.java 2010-02-12 15:08:42+0000
@@ -92,7 +92,7 @@

          String osgiFilter = "("
              + ProtocolProviderFactory.PROTOCOL
- + "=" + "Facebook" + ")";
+ + "=" + ProtocolNames.JABBER + ")";

          try
          {

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistration.java 2010-02-12 15:08:42+0000
@@ -14,26 +14,26 @@
   */
  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;
      }

      /**

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java 2010-02-12 15:08:42+0000
@@ -30,6 +30,8 @@
       */
      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 @@
      {
          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 @@
          if (!firstWizardPage.isCommitted())
              firstWizardPage.commitPage();

- return signin(registration.getEmail(), null);
+ return signin(registration.getUsername(), null);
      }

      /**
@@ -164,12 +166,21 @@
      {
          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 @@
              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

Modified: trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java?view=diff&rev=6751&p1=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java&p2=trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java&r1=6750&r2=6751

--- trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java 2010-02-12 15:08:42+0000
@@ -16,7 +16,7 @@
  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 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 @@

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

      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 @@
       */
      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 void pageShowing()
      {
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
      }

      /**
@@ -220,7 +220,12 @@
       */
      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 @@
              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 @@
       * 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 void insertUpdate(DocumentEvent event)
      {
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
      }

      /**
@@ -284,7 +289,7 @@
       */
      public void removeUpdate(DocumentEvent event)
      {
- this.setNextButtonAccordingToEmail();
+ this.setNextButtonAccordingToUsername();
      }

      public void changedUpdate(DocumentEvent event)
@@ -315,8 +320,8 @@
          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 @@
       * 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 @@
          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;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

------------------------------------------------------------------------

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

--
Emil Ivov, Ph.D. 67000 Strasbourg,
Project Lead France
SIP Communicator
emcho@sip-communicator.org PHONE: +33.1.77.62.43.30
http://sip-communicator.org FAX: +33.1.77.62.47.31

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net