Merge pull request #1228 from backspace/support-commas-in-contact-names

Remove commas in names in recipient list string
This commit is contained in:
Moxie Marlinspike 2014-03-31 08:39:15 -07:00
commit c414334059

View File

@ -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(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)) {