diff options
| author | Mathias Hasselmann <mathias@openismus.com> | 2013-03-01 12:49:44 +0100 |
|---|---|---|
| committer | Mathias Hasselmann <mathias@openismus.com> | 2013-03-06 12:10:34 +0100 |
| commit | c2c059e4e81410edfea4384d653fbf18838a0978 (patch) | |
| tree | 7c30e29e8f5eb06cb7043451586c96918ed2d392 /addressbook/libebook-contacts/e-phone-number.c | |
| parent | 335d9afe932070f5d3bfd79d30e52d860eec3bd9 (diff) | |
| download | evolution-data-server-c2c059e4e81410edfea4384d653fbf18838a0978.tar.gz | |
libedata-book: Improve national phone number matching
e_phone_number_compare() and e_phone_number_compare_strings()
had different opinion how well "1234" and "234" match within
NANP regions. First considered them a national significant
number match as it interpreted the leading "1" as country
calling code, the later didn't. The former interpretion fits
better our E.164 normalization we do in the SQLite backend,
therefore we adopted that approach.
This also introduces e_phone_number_compare_strings_for_region().
https://bugs.freedesktop.org/show_bug.cgi?id=59571
Diffstat (limited to 'addressbook/libebook-contacts/e-phone-number.c')
| -rw-r--r-- | addressbook/libebook-contacts/e-phone-number.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/addressbook/libebook-contacts/e-phone-number.c b/addressbook/libebook-contacts/e-phone-number.c index face50a71..6194f69f1 100644 --- a/addressbook/libebook-contacts/e-phone-number.c +++ b/addressbook/libebook-contacts/e-phone-number.c @@ -324,9 +324,33 @@ e_phone_number_compare_strings (const gchar *first_number, const gchar *second_number, GError **error) { + return e_phone_number_compare_strings_with_region ( + first_number, second_number, NULL, error); +} + +/** + * e_phone_number_compare_strings_with_region: + * @first_number: the first EPhoneNumber to compare + * @second_number: the second EPhoneNumber to compare + * @region_code: (allow-none): a two-letter country code, or %NULL + * @error: (out): a #GError to set an error, if any + * + * Compares two phone numbers within the context of @region_code. + * + * Returns: The quality of matching for the two phone numbers. + * + * Since: 3.8 + **/ +EPhoneNumberMatch +e_phone_number_compare_strings_with_region (const gchar *first_number, + const gchar *second_number, + const gchar *region_code, + GError **error) +{ #ifdef ENABLE_PHONENUMBER - return _e_phone_number_cxx_compare_strings (first_number, second_number, error); + return _e_phone_number_cxx_compare_strings ( + first_number, second_number, region_code, error); #else /* ENABLE_PHONENUMBER */ |
