From c3e5f11cc97cdf377035ebb92f8dca6654e2f86c Mon Sep 17 00:00:00 2001 From: Gabriele Carrettoni Date: Thu, 20 Feb 2014 23:31:09 +0100 Subject: [PATCH] Update ContactsController.java Check if the number has a country code, if not, prepend to the number the country code of the android user based on Locale. TOTALLY UNTESTED, just a quick idea. --- .../java/org/telegram/messenger/ContactsController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java index 85b649bf8..0ad00cfcc 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java @@ -185,12 +185,19 @@ public class ContactsController { HashMap contactsMap = new HashMap(); try { ContentResolver cr = ApplicationLoader.applicationContext.getContentResolver(); + Locale locale = Locale.getDefault(); + String country = locale.getCountry(); String ids = ""; Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projectioPhones, null, null, null); if (pCur != null) { if (pCur.getCount() > 0) { while (pCur.moveToNext()) { String number = pCur.getString(1); + + if !(number.startsWith("+")) { + number = country + number; + } + if (number == null || number.length() == 0) { continue; }