--- Begin Message ---
Subject: |
[PATCH] Avoid duplicate phone and address entries |
Date: |
Sun, 8 Jul 2007 21:33:01 -0700 |
---
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
--- End Message ---
--- Begin Message ---
Subject: |
confirm ba36e14bae4a93048e5f23f50ad7897cb415c07b |
If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message. Do this if the message is
spam. If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list. The Approved: header can also appear in the first line
of the body of the reply.
--- End Message ---