[folks] Fix our birthday string parsing for Telepathy backend.



commit 38b99d5cdbee676dfc382efda3f7dbfa0860f371
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Tue Oct 11 14:46:34 2011 -0700

    Fix our birthday string parsing for Telepathy backend.

 backends/telepathy/lib/tpf-persona.vala    |   22 ++++++++++++++--------
 tests/telepathy/individual-properties.vala |    4 +---
 2 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index ca099cf..227f5ef 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -776,15 +776,21 @@ public class Tpf.Persona : Folks.Persona,
       if (new_birthday_str != "")
         {
           var timeval = TimeVal ();
-          timeval.from_iso8601 (new_birthday_str);
-          /* work around bgo#661397 by forcing our microseconds to zero */
-          timeval.tv_usec = 0;
-          var d = new DateTime.from_timeval_utc (timeval);
-          if (this._birthday == null ||
-              (this._birthday != null && !this._birthday.equal (d.to_utc ())))
+          if (timeval.from_iso8601 (new_birthday_str))
             {
-              this._birthday = d.to_utc ();
-              this.notify_property ("birthday");
+              var d = new DateTime.from_timeval_utc (timeval);
+              if (this._birthday == null ||
+                  (this._birthday != null &&
+                    !this._birthday.equal (d.to_utc ())))
+                {
+                  this._birthday = d.to_utc ();
+                  this.notify_property ("birthday");
+                }
+            }
+          else
+            {
+              warning ("Failed to parse new birthday string '%s'",
+                  new_birthday_str);
             }
         }
       else
diff --git a/tests/telepathy/individual-properties.vala b/tests/telepathy/individual-properties.vala
index d55924d..5bf1771 100644
--- a/tests/telepathy/individual-properties.vala
+++ b/tests/telepathy/individual-properties.vala
@@ -396,9 +396,7 @@ public class IndividualPropertiesTests : Folks.TestCase
       var removed = changes.get_keys ();
 
       var timeval = TimeVal ();
-      timeval.from_iso8601 ("1929-01-11T00:00Z");
-      /* work around bgo#661397 by forcing our microseconds to zero */
-      timeval.tv_usec = 0;
+      timeval.from_iso8601 ("1929-01-11T00:00:00Z");
       var new_birthday = new DateTime.from_timeval_utc (timeval);
       var new_email_fd = new EmailFieldDetails ("cave aperturescience com");
       new_email_fd.set_parameter (AbstractFieldDetails.PARAM_TYPE,



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