Use full jid to login in wizard account when the jid entered is a Google talk
authorDa Risk <da_risk@beem-project.com>
Sat, 27 Oct 2012 02:13:23 +0200
changeset 1002 85cce4bb7f5e
parent 1001 ec0c60b581ed
child 1003 d793c2b09350
Use full jid to login in wizard account when the jid entered is a Google talk account. fix #454
.hgignore
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java
--- a/.hgignore	Tue Oct 09 01:08:40 2012 +0200
+++ b/.hgignore	Sat Oct 27 02:13:23 2012 +0200
@@ -1,10 +1,53 @@
 syntax: glob
-bin/*
-R.java
-doc/javadoc
+# generated files
+bin/
+gen/
 src/com/beem/project/beem/service/aidl/*.java
-gen/*
+doc/javadoc
+
+# Local configuration file (sdk path, etc)
 local.properties
-**~
-**/.*.sw?
+
+# built application files
+*.apk
+*.ap_
+
+# keystore
+*.keystore
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# maven output folder
+target
+
+# Eclipse project files
 .classpath
+.project
+.metadata
+.settings
+
+# IntelliJ files
+.idea
+*.iml
+
+# OSX files
+.DS_Store
+
+# Windows files
+Thumbs.db
+
+# vi swap files
+.*.sw?
+
+# backup files
+*.bak
+*~
+
+# maven eclipse files
+.externalToolBuilders
+maven-eclipse.xml
+
--- a/src/com/beem/project/beem/BeemService.java	Tue Oct 09 01:08:40 2012 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Sat Oct 27 02:13:23 2012 +0200
@@ -165,6 +165,7 @@
 	if (mSettings.getBoolean("settings_key_specific_server", false))
 	    mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService, mProxyInfo);
 	if (useSystemAccount) {
+	    SASLAuthentication.supportSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME);
 	    String accountType = mSettings.getString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, "");
 	    String accountName = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
 	    Account account = getAccount(accountName, accountType);
@@ -180,6 +181,7 @@
 	    } else
 		mConnectionConfiguration.setCallbackHandler(new AccountAuthenticator(this, account));
 	} else {
+	    SASLAuthentication.unsupportSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME);
 	    mConnectionConfiguration = new ConnectionConfiguration(mService, mProxyInfo);
 		mConnectionConfiguration.setCallbackHandler(new PreferenceAuthenticator(this));
 	}
@@ -552,7 +554,6 @@
 	/* register additionnals sasl mechanisms */
 	SASLAuthentication.registerSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME,
 	    SASLGoogleOAuth2Mechanism.class);
-	SASLAuthentication.supportSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME);
     }
 
     /**
--- a/src/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java	Tue Oct 09 01:08:40 2012 +0200
+++ b/src/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java	Sat Oct 27 02:13:23 2012 +0200
@@ -425,10 +425,17 @@
 		    port = Integer.parseInt(params[3]);
 		}
 	    }
+	    String login = StringUtils.parseName(jid);
+	    String serviceName = StringUtils.parseServer(jid);
 	    Connection connection = prepareConnection(jid, server, port);
+	    if (settings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false)
+		|| "gmail.com".equals(serviceName)
+		|| "googlemail.com".equals(serviceName)) {
+		login = jid;
+	    }
 	    try {
 		connection.connect();
-		connection.login(StringUtils.parseName(jid), password);
+		connection.login(login, password);
 	    } catch (XMPPException e) {
 		Log.e(TAG, "Unable to connect to Xmpp server", e);
 		exception = e;