phone-details: get_normalised: keep the leading '+'
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 28 Dec 2012 14:11:25 +0000 (15:11 +0100)
committerPhilip Withnall <philip@tecnocode.co.uk>
Sat, 29 Dec 2012 16:41:51 +0000 (16:41 +0000)
It's needed to be able to call phone numbers containing an international
prefix.

https://bugzilla.gnome.org/show_bug.cgi?id=685992

NEWS
folks/phone-details.vala

diff --git a/NEWS b/NEWS
index 15f0f76..058f716 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ Bugs fixed:
 • Bug 689146 — disabling EDS address books does not remove personas
 • Bug 689859 — core folks does not depend on telepathy
 • Bug 677633 — Cannot delete favourite
+• Bug 685992 — empathy strips the "+" (plus) from the numbers from the
+  gnome-contacts
 
 API changes:
 • Add Backend.enable_persona_store and disable_persona_store.
index a33cf4a..fcdd0d9 100644 (file)
@@ -130,8 +130,8 @@ public class Folks.PhoneFieldDetails : AbstractFieldDetails<string>
    * Typical normalisations:
    *
    *  - ``1-800-123-4567`` → ``18001234567``
-   *  - ``+1-800-123-4567`` → ``18001234567``
-   *  - ``+1-800-123-4567P123`` → ``18001234567P123``
+   *  - ``+1-800-123-4567`` → ``+18001234567``
+   *  - ``+1-800-123-4567P123`` → ``+18001234567P123``
    *
    * @return the normalised form of ``number``
    *
@@ -145,12 +145,7 @@ public class Folks.PhoneFieldDetails : AbstractFieldDetails<string>
         {
           var digit = this.value.slice (i, i + 1);
 
-          if (i == 0 && digit == "+")
-            {
-              /* we drop the initial + */
-              continue;
-            }
-          else if (digit in PhoneFieldDetails._extension_chars ||
+          if (digit in PhoneFieldDetails._extension_chars ||
               digit in PhoneFieldDetails._valid_digits)
             {
               /* lets keep valid digits */