Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
authorAndrew Flegg <andrew@bleb.org>
Wed, 9 Jun 2010 23:29:28 +0000 (00:29 +0100)
committerAndrew Flegg <andrew@bleb.org>
Wed, 9 Jun 2010 23:29:28 +0000 (00:29 +0100)
package/src/org/maemo/hermes/engine/contact.py
package/src/org/maemo/hermes/engine/friend.py

index eeef1fb..9953048 100644 (file)
@@ -171,8 +171,8 @@ class Contact:
     
     # -----------------------------------------------------------------------
     def get_birthday(self):
-        photo = self._contact.get_property('birth-date')
-        return cast(c_void_p(hash(photo)), POINTER(EContactDate))
+        date = self._contact.get_property('birth-date')
+        return date is not None and cast(c_void_p(hash(date)), POINTER(EContactDate)) or None
         
     
     # -----------------------------------------------------------------------
index 4f90ae9..c1347be 100644 (file)
@@ -95,14 +95,18 @@ class Friend():
            without overwriting unless overwrite is set to True.
            Returns flag indicating if anything *was* changed."""
         
-        def fixme(arg):
-            pass
-            #print "FIXME - birthday date needs to be parsed/fixed %s before calling contact.set_birthday" % arg
+        def set_birthday(arg):
+            # Hackily assumes Facebook format
+            date_str = arg.split('/')
+            date_str.append('0')
+            return contact.set_birthday(int(date_str[1]),
+                                        int(date_str[0]),
+                                        int(date_str[2]))
 
         updated = False
         if overwrite or contact.get_photo() is None:    updated += self._if_defined('photo-url', contact.set_photo)
         if overwrite or contact.get_nickname() is None: updated += self._if_defined('nickname', contact.set_nickname)
-        if overwrite or contact.get_birthday() is None: updated += self._if_defined('bday', fixme)
+        if overwrite or contact.get_birthday() is None: updated += self._if_defined('bday', set_birthday)
         if self._multi_attributes.has_key('url'):
             for url in self._multi_attributes['url']:
                 updated += contact.add_url(url)

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment