Fix overzealous matching on URL; and fix "Non-string URLs" from Twitter.
[hermes] / package / src / org / maemo / hermes / engine / facebook / service.py
index d9b0b4c..aa912c5 100644 (file)
@@ -129,7 +129,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 +138,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: