[folks/folks-0-6] tpf-persona: ignore empty email or phone number



commit 79f7983759a7d6b8527f31f3ecaa8f9b2e5e0525
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Apr 30 14:49:39 2012 +0200

    tpf-persona: ignore empty email or phone number
    
    The interface implementation raises an error if we pass it an empty value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675144

 backends/telepathy/lib/tpf-persona.vala |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index 5425e19..e2f8364 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -791,9 +791,12 @@ public class Tpf.Persona : Folks.Persona,
             {
               foreach (var email_addr in info.field_value)
                 {
-                  var parameters = this._afd_params_from_strv (info.parameters);
-                  var email_fd = new EmailFieldDetails (email_addr, parameters);
-                  new_email_addresses.add (email_fd);
+                  if (email_addr != "")
+                    {
+                      var parameters = this._afd_params_from_strv (info.parameters);
+                      var email_fd = new EmailFieldDetails (email_addr, parameters);
+                      new_email_addresses.add (email_fd);
+                    }
                 }
             }
           else if (info.field_name == "fn")
@@ -806,18 +809,24 @@ public class Tpf.Persona : Folks.Persona,
             {
               foreach (var phone_num in info.field_value)
                 {
-                  var parameters = this._afd_params_from_strv (info.parameters);
-                  var phone_fd = new PhoneFieldDetails (phone_num, parameters);
-                  new_phone_numbers.add (phone_fd);
+                  if (phone_num != "")
+                    {
+                      var parameters = this._afd_params_from_strv (info.parameters);
+                      var phone_fd = new PhoneFieldDetails (phone_num, parameters);
+                      new_phone_numbers.add (phone_fd);
+                    }
                 }
             }
           else if (info.field_name == "url")
             {
               foreach (var url in info.field_value)
                 {
-                  var parameters = this._afd_params_from_strv (info.parameters);
-                  var url_fd = new UrlFieldDetails (url, parameters);
-                  new_urls.add (url_fd);
+                  if (url != "")
+                    {
+                      var parameters = this._afd_params_from_strv (info.parameters);
+                      var url_fd = new UrlFieldDetails (url, parameters);
+                      new_urls.add (url_fd);
+                    }
                 }
             }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]