gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Opensync-users] [PATCH] Avoid duplicate phone and address entries


From: Pawel Kot
Subject: Re: [Opensync-users] [PATCH] Avoid duplicate phone and address entries
Date: Mon, 9 Jul 2007 21:37:11 +0200

Hi,

This one is also not understandable for me. Why it happens? Why would
one need such validation?

take care,
pkot

On 7/9/07, Keith Packard <address@hidden> wrote:
---
 common/phones/nk6510.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/common/phones/nk6510.c b/common/phones/nk6510.c
index d48ea49..81eca47 100644
--- a/common/phones/nk6510.c
+++ b/common/phones/nk6510.c
@@ -2387,10 +2387,19 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
                                case GN_PHONEBOOK_ENTRY_StateProvince:
                                case GN_PHONEBOOK_ENTRY_ZipCode:
                                case GN_PHONEBOOK_ENTRY_Country:
+                               case GN_PHONEBOOK_ENTRY_Postal:
                                case GN_PHONEBOOK_ENTRY_LastName:
                                case GN_PHONEBOOK_ENTRY_FirstName:
                                        break;
                                case GN_PHONEBOOK_ENTRY_Number:
+                                       for (j = 0; j < i; j++) {
+                                               if (entry->subentries[i].entry_type == 
entry->subentries[j].entry_type &&
+                                                   entry->subentries[i].number_type == 
entry->subentries[j].number_type &&
+                                                   !strcmp 
(entry->subentries[i].data.number, entry->subentries[j].data.number))
+                                                       break;
+                                       }
+                                       if (j < i)
+                                               break;
                                        if (i != defaultn) {
                                                string[0] = 
entry->subentries[i].number_type;
                                                string[1] = string[2] = 
string[3] = 0;
@@ -2447,11 +2456,20 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
                                for (i = 0; i < entry->subentries_count; i++) {
                                        switch 
(entry->subentries[i].entry_type) {
                                        case GN_PHONEBOOK_ENTRY_ExtendedAddress:
+                                       case GN_PHONEBOOK_ENTRY_Postal:
                                        case GN_PHONEBOOK_ENTRY_Street:
                                        case GN_PHONEBOOK_ENTRY_City:
                                        case GN_PHONEBOOK_ENTRY_StateProvince:
                                        case GN_PHONEBOOK_ENTRY_ZipCode:
                                        case GN_PHONEBOOK_ENTRY_Country:
+                                               for (j = 0; j < i; j++) {
+                                                       if 
(entry->subentries[i].entry_type == entry->subentries[j].entry_type &&
+                                                           
entry->subentries[i].number_type == entry->subentries[j].number_type &&
+                                                           !strcmp 
(entry->subentries[i].data.number, entry->subentries[j].data.number))
+                                                               break;
+                                               }
+                                               if (j < i)
+                                                       break;
                                                j = 
strlen(entry->subentries[i].data.number);
                                                j = char_unicode_encode((string + 
1), entry->subentries[i].data.number, j);
                                                string[j + 1] = 0;
--
1.5.2.2


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensync-users mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/opensync-users



--
Pawel Kot




reply via email to

[Prev in Thread] Current Thread [Next in Thread]