Fix overzealous matching on URL; and fix "Non-string URLs" from Twitter. 0.8.4
authorAndrew Flegg <andrew@bleb.org>
Sun, 4 Jul 2010 13:10:01 +0000 (14:10 +0100)
committerAndrew Flegg <andrew@bleb.org>
Sun, 4 Jul 2010 13:10:01 +0000 (14:10 +0100)
package/debian/changelog
package/src/org/maemo/hermes/engine/facebook/service.py
package/src/org/maemo/hermes/engine/friend.py
package/src/org/maemo/hermes/engine/linkedin/service.py
package/src/org/maemo/hermes/gui/gtkui.py

index f55d44f..4aa2c19 100644 (file)
@@ -1,3 +1,12 @@
+hermes (0.8.4) fremantle; urgency=low
+
+  * Prevent overzealous matching on LinkedIn/Facebook based on *any* 
+    URL.
+  * Handle cases of empty URLs & phone numbers attempting to be
+    added (silently ignore).
+
+ -- Andrew Flegg <andrew@bleb.org>  Sun,  4 Jul 2010 13:51:08 +0100
+
 hermes (0.8.3) fremantle; urgency=low
 
   * Handle multiple Twitter matches causing a failure. MB#10667,
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:
index 28b8d74..632f33a 100644 (file)
@@ -27,13 +27,15 @@ class Friend():
     # public accessors -----------------
     
     def add_url(self, url):
-        if not isinstance(url, basestring):
-            print url
-            raise Exception('Not valid to add non-string URLs')
-        self._add('url', url)
+       if url:
+           if not isinstance(url, basestring):
+               print url
+               raise Exception('Not valid to add non-string URLs')
+            self._add('url', url)
     
     def add_phone(self, phone):
-        self._add('phone', phone)
+       if phone:
+            self._add('phone', phone)
         
     def get_birthday_date(self):
         return self._safe_get('bday')
index 86650a2..805ea3a 100644 (file)
@@ -21,3 +21,11 @@ class Service(org.maemo.hermes.engine.facebook.service.Service):
         friends = self.linkedInApi.get_friends()
         for friend in friends:
             self._register_friend(friend)
+
+
+    # -----------------------------------------------------------------------
+    def is_profile_url(self, url):
+        """Return True if this is a URL for this service."""
+
+        return url and "linkedin.com" in url
+
index 5008925..fd675ad 100644 (file)
@@ -26,7 +26,7 @@ class HermesGUI(WimpWorks):
     # -----------------------------------------------------------------------
     def __init__(self, providers = None):
         gettext.install('hermes','/opt/hermes/share/locale/')
-        WimpWorks.__init__(self, 'Hermes', version = '0.8.2', dbus_name = 'org.maemo.hermes')
+        WimpWorks.__init__(self, 'Hermes', version = '0.8.4', dbus_name = 'org.maemo.hermes')
         self.set_background('background.png')
         
         layout = HildonMainScreenLayout(offset = 0.8, container = self)