From 94a669fcb861d9cff4414d98abb289d1452c9300 Mon Sep 17 00:00:00 2001 From: lookshe Date: Sat, 11 Apr 2015 20:53:25 +0200 Subject: no trim of messages or password check password with only spaces separately --- src/main/java/eu/siacs/conversations/crypto/PgpEngine.java | 2 +- src/main/java/eu/siacs/conversations/entities/Message.java | 4 ++-- .../java/eu/siacs/conversations/ui/ChangePasswordActivity.java | 9 ++++++--- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 2 +- src/main/java/eu/siacs/conversations/utils/UIHelper.java | 3 +-- src/main/res/values-de/strings.xml | 1 + src/main/res/values/strings.xml | 3 +++ 7 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java index ad5a4132..5e9f8fbf 100644 --- a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java +++ b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java @@ -162,7 +162,7 @@ public class PgpEngine { String[] lines = os.toString().split("\n"); for (int i = 2; i < lines.length - 1; ++i) { if (!lines[i].contains("Version")) { - encryptedMessageBody.append(lines[i].trim()); + encryptedMessageBody.append(lines[i]); } } message.setEncryptedBody(encryptedMessageBody diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 8015eead..fc2fdafd 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -393,9 +393,9 @@ public class Message extends AbstractEntity { public String getMergedBody() { final Message next = this.next(); if (this.mergeable(next)) { - return getBody().trim() + '\n' + next.getMergedBody(); + return getBody() + '\n' + next.getMergedBody(); } - return getBody().trim(); + return getBody(); } public boolean hasMeCommand() { diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java index 54c064c6..aac435fd 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java @@ -27,11 +27,14 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti mCurrentPassword.requestFocus(); mCurrentPassword.setError(getString(R.string.account_status_unauthorized)); } else if (!newPassword.equals(newPasswordConfirm)) { - mNewPasswordConfirm.requestFocus(); - mNewPasswordConfirm.setError(getString(R.string.passwords_do_not_match)); + mNewPasswordConfirm.requestFocus(); + mNewPasswordConfirm.setError(getString(R.string.passwords_do_not_match)); + } else if (newPassword.isEmpty()) { + mNewPassword.requestFocus(); + mNewPassword.setError(getString(R.string.password_should_not_be_empty)); } else if (newPassword.trim().isEmpty()) { mNewPassword.requestFocus(); - mNewPassword.setError(getString(R.string.password_should_not_be_empty)); + mNewPassword.setError(getString(R.string.password_should_not_contain_only_spaces)); } else { mCurrentPassword.setError(null); mNewPassword.setError(null); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index d5f20e41..4da9d101 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -545,7 +545,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } protected void highlightInConference(String nick) { - String oldString = mEditMessage.getText().toString().trim(); + String oldString = mEditMessage.getText().toString(); if (oldString.isEmpty() || mEditMessage.getSelectionStart() == 0) { mEditMessage.getText().insert(0, nick + ": "); } else { diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index 0ddf606f..0bea6e53 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -226,7 +226,6 @@ public class UIHelper { for (EmoticonPattern p : patterns) { body = p.replaceAll(body); } - body = body.trim(); } return body; } @@ -302,7 +301,7 @@ public class UIHelper { return new Pair<>(context.getString(R.string.location), true); } } else{ - return new Pair<>(message.getBody().trim(), false); + return new Pair<>(message.getBody(), false); } } } diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 14e5b091..5e75f55c 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -370,6 +370,7 @@ Aktuelles Passwort Neues Passwort Das Passwort darf nicht leer sein + Das Passwort darf nicht nur aus Leerzeichen bestehen Alle Konten anschalten Alle Konten abschalten Aktion durchführen mit diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index b6e897cf..f6abfc66 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -397,6 +397,7 @@ Current password New password Password should not be empty + Password should not contain only spaces Enable all accounts Disable all accounts Perform action with @@ -460,4 +461,6 @@ Select %d contact Select %d contacts + LED notification color + Change the color of the LED notification -- cgit v1.2.3