Implement OAuth for Twitter, and share common infrastructure for all
[hermes] / package / src / org / maemo / hermes / engine / facebook / service.py
index d9b0b4c..91dfe33 100644 (file)
@@ -76,6 +76,7 @@ class Service(org.maemo.hermes.engine.service.Service):
         
         def if_defined(data, key, callback):
             if key in data and data[key]:
+                print key, data[key]
                 callback(data[key])
         
         friends_data = self._get_friends_data()
@@ -129,7 +130,8 @@ class Service(org.maemo.hermes.engine.service.Service):
         self._friends_without_contact.add(friend)
         
         for url in friend.get_urls():
-            self._friends_by_url[url] = friend
+            if self.is_profile_url(url):
+                self._friends_by_url[url] = friend
 
         if self._allow_friend_to_match_by_name(friend):
             key = canonical(friend.get_name())
@@ -137,6 +139,13 @@ class Service(org.maemo.hermes.engine.service.Service):
 
 
     # -----------------------------------------------------------------------
+    def is_profile_url(self, url):
+        """Return True if this is a URL for this service."""
+
+        return url and "facebook.com" in url
+
+
+    # -----------------------------------------------------------------------
     def _allow_friend_to_match_by_name(self, friend):
         for url in friend.get_urls():
             if url in self._known_urls: