Ticket #555 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

Motorola razr v3i moto-sync changes

Reported by: klattimer Assigned to: andrewb
Priority: normal Milestone: 0.40
Component: Plugin: moto Version: 0.22
Severity: trivial Keywords:
Cc:

Description

I downloaded and installed the 0.22 moto-sync plugin to work with my V3, there were a few issues but it mostly worked.

A few changes were required but not many, mostly to do with ensuring the data received is of the correct size otherwise there are a few out of range errors.

As I can't attach the patch as a file, here it is

diff -uNr libopensync-plugin-moto-0.22/motosync.py libopensync-plugin-moto-0.22.b/motosync.py
--- libopensync-plugin-moto-0.22/motosync.py	2007-03-27 12:49:49.000000000 +0100
+++ libopensync-plugin-moto-0.22.b/motosync.py	2007-09-02 17:21:36.000000000 +0100
@@ -1220,11 +1220,19 @@
         self.firstlast_index = data[12]
         assert(data[14] == 0) # unknown?
         assert(data[15] == 0) # unknown?
-        self.nickname = data[22]
-        if data[23] == '':
-            self.birthday = None
+        if len(data) >= 21:
+            self.nickname = data[22]
+        else:
+            self.nickname = None
+            
+        if len(data) >= 22:
+            if data[23] == '':
+                self.birthday = None
+            else:
+                self.birthday = parse_moto_time(data[23])
         else:
-            self.birthday = parse_moto_time(data[23])
+            self.birthday = None
+            
         if len(data) >= 25:
             assert(data[24] == '') # unknown? old phones don't have it
 
@@ -1309,9 +1317,10 @@
                     contacts[i] = (moto_type, content, True)
                     break
             else:
-                # no non-email contacts, so just make the first email preferred
-                (moto_type, content, _) = contacts[0]
-                contacts[0] = (moto_type, content, True)
+                if type(contacts) == list and len(contacts) > 0:
+                    # no non-email contacts, so just make the first email preferred
+                    (moto_type, content, _) = contacts[0]
+                    contacts[0] = (moto_type, content, True)
 
         # process addresses, create a hash from contacttype to address
         # FIXME: addresses that don't map to moto contact types are dropped
@@ -1435,7 +1444,10 @@
     """Phone contact child object for children created from phone data."""
     def __init__(self, parent, data):
         assert(type(data) == list and len(data) >= 24)
-        adr = (data[17], data[16], data[18], data[19], data[20], data[21])
+        if len(data) >= 20: 
+            adr = (data[17], data[16], data[18], data[19], data[20], data[21])
+        else:
+            adr = ("", "", "", "", "", "")
         PhoneContactChild.__init__(self, parent, data[1], data[4], data[8], adr)
         self.pos = data[0]
         self.numtype = data[2]

Attachments

motosync-v3.patch (2.3 kB) - added by klattimer on 09/02/07 18:32:05.

Change History

09/02/07 18:32:05 changed by klattimer

  • attachment motosync-v3.patch added.

11/04/07 16:17:59 changed by andrewb

  • status changed from new to closed.
  • type changed from defect to enhancement.
  • resolution set to fixed.

Thanks for the patch. I've forward-ported it to current SVN, and applied it as r2734. Please check 0.40 when it is released (or a development version if you are game) and open a bug if the v3i doesn't work.