From: <luc...@us...> - 2003-07-13 09:08:20
|
Update of /cvsroot/zxsync/zXSync/zxsync In directory sc8-pr-cvs1:/tmp/cvs-serv29829 Modified Files: vcard.py Log Message: - Removed UID field from vCards (the id is still available via getId(), but not as a field). This avoids a lot of trouble when the ids of a plugin are not worth much (as is currently the case with iPod and Zaurus contacts ;-)) - Added automatic sync mode assignment based on the backups (in case of vCards, use the previous field values for matching, not the current ones) Index: vcard.py =================================================================== RCS file: /cvsroot/zxsync/zXSync/zxsync/vcard.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** vcard.py 23 Jun 2003 21:21:02 -0000 1.7 --- vcard.py 13 Jul 2003 09:08:17 -0000 1.8 *************** *** 29,34 **** ! UID = "UID" ! UID_DEFAULT = "" FN = "FN" FN_DEFAULT = "" --- 29,35 ---- ! #UID = "UID" ! #UID_DEFAULT = "" ! # don't treat the UID as an ordinary field FN = "FN" FN_DEFAULT = "" *************** *** 442,447 **** def doesConflictWith(self, other): ! if self.getValue() == other.getValue() or self.getId() == UID: # UIDs never conflict return 0 return 1 --- 443,450 ---- def doesConflictWith(self, other): ! if self.getValue() == other.getValue(): #or self.getId() == UID: # UIDs never conflict + # (now obsolete since UIDs are no longer treated as ordinary + # fields) return 0 return 1 *************** *** 482,486 **** """ Entry.__init__(self, id) ! self.replaceOrRemoveChild(UID, UID_DEFAULT, convertToInternalValue(id)) --- 485,491 ---- """ Entry.__init__(self, id) ! #self.replaceOrRemoveChild(UID, UID_DEFAULT, convertToInternalValue(id)) ! # don't treat the UID as an ordinary field (that just creates some ! # ugly problems when syncing *************** *** 538,544 **** """ # TODO: add matching via UID match table ! selfName = self.getName() if selfName != None: ! otherName = other.getName() if otherName == None: return 0 --- 543,555 ---- """ # TODO: add matching via UID match table ! matchSelf = self.getPreviousEntry() ! if matchSelf == None: ! matchSelf = self ! matchOther = other.getPreviousEntry() ! if matchOther == None: ! matchOther = other ! selfName = matchSelf.getName() if selfName != None: ! otherName = matchOther.getName() if otherName == None: return 0 *************** *** 547,553 **** return 1 ! selfMails = self.getEmailAddresses() if len(selfMails) > 0: ! otherMails = other.getEmailAddresses() if len(selfMails) != len(otherMails): return 0 --- 558,564 ---- return 1 ! selfMails = matchSelf.getEmailAddresses() if len(selfMails) > 0: ! otherMails = matchOther.getEmailAddresses() if len(selfMails) != len(otherMails): return 0 *************** *** 562,570 **** return 1 ! selfOrgs = self.getOrganizations() assert len(selfOrgs) > 0 # if this is not the case, a plugin has an incorrect # implementation of isValid() ! otherOrgs = other.getOrganizations() if len(selfOrgs) != len(otherOrgs): return 0 --- 573,581 ---- return 1 ! selfOrgs = matchSelf.getOrganizations() assert len(selfOrgs) > 0 # if this is not the case, a plugin has an incorrect # implementation of isValid() ! otherOrgs = matchOther.getOrganizations() if len(selfOrgs) != len(otherOrgs): return 0 *************** *** 590,598 **** ! def getUID(self): ! """ ! Returns the UID field of this vCard as a VCardField. ! """ ! return self.getChildWithId(UID) --- 601,609 ---- ! #def getUID(self): ! # """ ! # Returns the UID field of this vCard as a VCardField. ! # """ ! # return self.getChildWithId(UID) |