diff options
author | Tony Mantler <nicoya@google.com> | 2013-10-25 13:34:30 -0700 |
---|---|---|
committer | Tony Mantler <nicoya@google.com> | 2013-10-25 13:34:30 -0700 |
commit | b573c5c0c05deec139985b883a12869dc6cac5a0 (patch) | |
tree | d3f34a9a02c390875d48af9e4cb33560abd0ff77 /src/com/android/mail/utils/Utils.java | |
parent | 6aea786c4c8273890aa0e2d9c58d0c23907d736a (diff) | |
parent | 08ac01fcb3c8e9744696ad433804eeaf2e16ba29 (diff) | |
download | android_packages_apps_UnifiedEmail-b573c5c0c05deec139985b883a12869dc6cac5a0.tar.gz android_packages_apps_UnifiedEmail-b573c5c0c05deec139985b883a12869dc6cac5a0.tar.bz2 android_packages_apps_UnifiedEmail-b573c5c0c05deec139985b883a12869dc6cac5a0.zip |
resolved conflicts for merge of 08ac01fc to jb-ub-mail-ur11
Change-Id: I5766599c2ee08de615f3047b57f1c72d63908b36
Diffstat (limited to 'src/com/android/mail/utils/Utils.java')
-rw-r--r-- | src/com/android/mail/utils/Utils.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/com/android/mail/utils/Utils.java b/src/com/android/mail/utils/Utils.java index c026bbe56..07910678f 100644 --- a/src/com/android/mail/utils/Utils.java +++ b/src/com/android/mail/utils/Utils.java @@ -1429,7 +1429,6 @@ public class Utils { } } - public static Address getAddress(Map<String, Address> cache, String emailStr) { Address addr; synchronized (cache) { @@ -1462,4 +1461,33 @@ public class Utils { 0); return descriptionText; } + + /** + * Email addresses are supposed to be treated as case-insensitive for the host-part and + * case-sensitive for the local-part, but nobody really wants email addresses to match + * case-sensitive on the local-part, so just smash everything to lower case. + * @param email Hello@Example.COM + * @return hello@example.com + */ + public static String normalizeEmailAddress(String email) { + /* + // The RFC5321 version + if (TextUtils.isEmpty(email)) { + return email; + } + String[] parts = email.split("@"); + if (parts.length != 2) { + LogUtils.d(LOG_TAG, "Tried to normalize a malformed email address: ", email); + return email; + } + + return parts[0] + "@" + parts[1].toLowerCase(Locale.US); + */ + if (TextUtils.isEmpty(email)) { + return email; + } else { + // Doing this for other locales might really screw things up, so do US-version only + return email.toLowerCase(Locale.US); + } + } } |