Fix the account wizard so that it realy checks a JID for username.
authorDa Risk <darisk972@gmail.com>
Wed, 31 Mar 2010 21:45:03 +0200
changeset 719 a6e9d50ff96b
parent 718 f75ebc6738b9
child 720 cd132abdc136
Fix the account wizard so that it realy checks a JID for username.
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/ui/wizard/AccountConfigure.java
--- a/src/com/beem/project/beem/BeemService.java	Thu Mar 18 03:02:08 2010 +0100
+++ b/src/com/beem/project/beem/BeemService.java	Wed Mar 31 21:45:03 2010 +0200
@@ -191,9 +191,6 @@
 	mService = StringUtils.parseServer(tmpJid);
 	mHost = mService;
 
-	if ("".equals(mLogin))
-	    mLogin = mService;
-
 	if (mSettings.getBoolean("settings_key_specific_server", false)) {
 	    mHost = mSettings.getString("settings_key_xmpp_server", "");
 	    if ("".equals(mHost))
--- a/src/com/beem/project/beem/ui/wizard/AccountConfigure.java	Thu Mar 18 03:02:08 2010 +0100
+++ b/src/com/beem/project/beem/ui/wizard/AccountConfigure.java	Wed Mar 31 21:45:03 2010 +0200
@@ -47,15 +47,16 @@
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
 import android.preference.PreferenceManager;
-import android.widget.Button;
-import android.widget.EditText;
 import android.text.Editable;
 import android.text.InputFilter;
 import android.text.LoginFilter;
+import android.text.TextUtils;
 import android.text.TextWatcher;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
 
 import org.jivesoftware.smack.util.StringUtils;
 
@@ -152,12 +153,13 @@
     }
 
     /**
-     * check username.
-     * @param username  .
+     * Check that the username is really a JID.
+     * @param username
      */
     private void checkUsername(String username) {
-	String server = StringUtils.parseServer(username.toString());
-	if (server == null || "".equals(server)) {
+	String name = StringUtils.parseName(username);
+	String server = StringUtils.parseServer(username);
+	if (TextUtils.isEmpty(name) || TextUtils.isEmpty(server)) {
 	    mValidJid = false;
 	} else {
 	    mValidJid = true;
@@ -165,7 +167,7 @@
     }
 
     /**
-     * check password.
+     * Check password.
      * @param password  .
      */
     private void checkPassword(String password) {