1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-12 03:55:01 -05:00

Allow chars '[' and ']' in ident

This commit is contained in:
Sebastian Kaspari 2010-12-17 23:37:00 +01:00
parent aaa313e805
commit e0b4b3d25d

View File

@ -24,6 +24,15 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.regex.Pattern;
import org.yaaic.R;
import org.yaaic.Yaaic;
import org.yaaic.db.Database;
import org.yaaic.exception.ValidationException;
import org.yaaic.model.Extra;
import org.yaaic.model.Identity;
import org.yaaic.model.Server;
import org.yaaic.model.Status;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
@ -37,15 +46,6 @@ import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import org.yaaic.R;
import org.yaaic.Yaaic;
import org.yaaic.db.Database;
import org.yaaic.exception.ValidationException;
import org.yaaic.model.Extra;
import org.yaaic.model.Identity;
import org.yaaic.model.Server;
import org.yaaic.model.Status;
/**
* Add a new server to the list
*
@ -157,6 +157,7 @@ public class AddServerActivity extends Activity implements OnClickListener
/**
* On click add server or cancel activity
*/
@Override
public void onClick(View v)
{
switch (v.getId()) {
@ -407,7 +408,7 @@ public class AddServerActivity extends Activity implements OnClickListener
}
// We currently only allow chars and numbers as ident
Pattern identPattern = Pattern.compile("^[a-zA-Z0-9]+$");
Pattern identPattern = Pattern.compile("^[a-zA-Z0-9\\[\\]]+$");
if (!identPattern.matcher(ident).matches()) {
throw new ValidationException(getResources().getString(R.string.validation_invalid_ident));
}