[pkg-fso-commits] [SCM] freesmartphone.org demo GUI branch, master, updated. milestone2-10-gb9e0ec4

Michael 'Mickey' Lauer mickey at vanille-media.de
Sun Aug 24 13:00:12 UTC 2008


The following commit has been merged in the master branch:
commit 1493f30ffb32615b0428382f80bd9afca432cf42
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sat Aug 9 19:32:05 2008 -0300

    Handle non-complete phone numbers in the phonebook
    
    When comparing phone numbers to label SMS appropriately, use
    this logic:
    
    Compares two phone numbers. They are considered equal if:
     a) Both start with a "+", and all following digits are equal
    or
      b) At least one of them does not start with a "+", and the
         last 7 digits are equal

diff --git a/src/zhone b/src/zhone
index 9b54021..7a797e0 100755
--- a/src/zhone
+++ b/src/zhone
@@ -652,9 +652,25 @@ class pyphone_contacts(edje_group):
         self.prepare()
         self.updateList()
 
+    def comparePhoneNumber(self, number1, number2):
+        '''
+        Compares two phone numbers. They are considered equal if:
+          a) Both start with a "+", and all following digits are equal
+        or
+          b) At least one of them does not start with a "+", and the
+             last 7 digits are equal
+        '''
+        number1 = filter (lambda c: c.isdigit() or c == '+', number1)
+        number2 = filter (lambda c: c.isdigit() or c == '+', number2)
+
+        if number1[0] == number2[0] == '+':
+            return number1 == number2
+        else:
+            return number1[-7:] == number2[-7:]
+
     def tryNumberToName( self, number ):
         for i in range( len( self.phonebook ) ):
-            if self.phonebook[i][2] == number:
+            if self.comparePhoneNumber(self.phonebook[i][2], number):
                 return self.phonebook[i][1]
         return number
 

-- 
freesmartphone.org demo GUI



More information about the pkg-fso-commits mailing list