From cab4a06974155d0f2b755eff364b64a662103c93 Mon Sep 17 00:00:00 2001 From: Buck Doyle Date: Sun, 23 Mar 2014 15:02:21 -0700 Subject: [PATCH 1/2] Remove commas in names in recipient list string Fixes #1225 --- src/org/thoughtcrime/securesms/components/RecipientsPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/components/RecipientsPanel.java b/src/org/thoughtcrime/securesms/components/RecipientsPanel.java index 84c55c4c7d..a67b1c934c 100644 --- a/src/org/thoughtcrime/securesms/components/RecipientsPanel.java +++ b/src/org/thoughtcrime/securesms/components/RecipientsPanel.java @@ -69,7 +69,7 @@ public class RecipientsPanel extends RelativeLayout { } public void addRecipient(String name, String number) { - if (name != null) recipientsText.append(name + "< " + number + ">, "); + if (name != null) recipientsText.append(name.replace(",", " ") + "< " + number + ">, "); else recipientsText.append(number + ", "); } From bc143059f6dce6eb14887022a6cf00b9fdd9133a Mon Sep 17 00:00:00 2001 From: Buck Doyle Date: Tue, 25 Mar 2014 11:11:20 -0700 Subject: [PATCH 2/2] Remove separators from names in recipient list Fixes #1225 and #1174 --- .../thoughtcrime/securesms/components/RecipientsPanel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/components/RecipientsPanel.java b/src/org/thoughtcrime/securesms/components/RecipientsPanel.java index a67b1c934c..40f29c5206 100644 --- a/src/org/thoughtcrime/securesms/components/RecipientsPanel.java +++ b/src/org/thoughtcrime/securesms/components/RecipientsPanel.java @@ -69,7 +69,7 @@ public class RecipientsPanel extends RelativeLayout { } public void addRecipient(String name, String number) { - if (name != null) recipientsText.append(name.replace(",", " ") + "< " + number + ">, "); + if (name != null) recipientsText.append(sanitizeRecipientName(name) + "< " + number + ">, "); else recipientsText.append(number + ", "); } @@ -149,6 +149,10 @@ public class RecipientsPanel extends RelativeLayout { recipientsText.setOnFocusChangeListener(new FocusChangedListener()); } + private static String sanitizeRecipientName(String name) { + return name.replaceAll("[,<>]", ""); + } + private class FocusChangedListener implements View.OnFocusChangeListener { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus && (panelChangeListener != null)) {