listhelper-moderate
[Top][All Lists]
Advanced

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

gnokii-users post from address@hidden requires approval


From: gnokii-users-owner
Subject: gnokii-users post from address@hidden requires approval
Date: Mon, 09 Jul 2007 00:33:32 -0400

As list administrator, your authorization is requested for the
following mailing list posting:

    List:    address@hidden
    From:    address@hidden
    Subject: [PATCH] Set of address blocks counts as one data block.
    Reason:  Post by non-member to a members-only list

At your convenience, visit:

    http://lists.nongnu.org/mailman/admindb/gnokii-users
        
to approve or deny the request.
--- Begin Message --- Subject: [PATCH] Set of address blocks counts as one data block. Date: Sun, 8 Jul 2007 21:33:03 -0700
When sending the broken-down address fields, the whole set of them together
counts as one data block; the number of address 'sub blocks' is indicated in
the overall PostalAddress block.
---
 common/phones/nk6510.c |   56 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/common/phones/nk6510.c b/common/phones/nk6510.c
index b9e310e..a76638f 100644
--- a/common/phones/nk6510.c
+++ b/common/phones/nk6510.c
@@ -2327,6 +2327,8 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
        char string[GN_PHONEBOOK_ENTRY_MAX_LENGTH];
        int block, i, j, defaultn, has_address = 0;
        unsigned int count = 22;
+       unsigned int postal_count;
+       int postal_block = 0;
        gn_phonebook_entry *entry;
        gn_error error;
 
@@ -2412,6 +2414,8 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
                                        break;
                                case GN_PHONEBOOK_ENTRY_Date:
                                case GN_PHONEBOOK_ENTRY_Birthday:
+                                       if (GN_PHONEBOOK_ENTRY_MAX_LENGTH - 
count < 12)
+                                               break;
                                        req[count++] = 
entry->subentries[i].entry_type;
                                        req[count++] = 0x00;
                                        req[count++] = 0x00;
@@ -2434,18 +2438,9 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
                                        break;
                                }
                        /* Addresses */
-                       for (i = 0; i < entry->subentries_count; i++)  {
-                               if (entry->subentries[i].entry_type == 
GN_PHONEBOOK_ENTRY_ExtendedAddress ||
-                                       entry->subentries[i].entry_type == 
GN_PHONEBOOK_ENTRY_Postal ||
-                                       entry->subentries[i].entry_type == 
GN_PHONEBOOK_ENTRY_Street ||
-                                       entry->subentries[i].entry_type == 
GN_PHONEBOOK_ENTRY_City ||
-                                       entry->subentries[i].entry_type == 
GN_PHONEBOOK_ENTRY_StateProvince ||
-                                       entry->subentries[i].entry_type == 
GN_PHONEBOOK_ENTRY_ZipCode ||
-                                       entry->subentries[i].entry_type == 
GN_PHONEBOOK_ENTRY_Country)
-                                       has_address++;
-                       }
-                       dprintf("address parts: %d\n", has_address);
-                       if (has_address) {
+                       if (GN_PHONEBOOK_ENTRY_MAX_LENGTH - count > 13)
+                       {
+                               postal_count = count;
                                req[count++] = GN_PHONEBOOK_ENTRY_PostalAddress;
                                req[count++] = 0x00;
                                req[count++] = 0x00;
@@ -2453,7 +2448,7 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
                                req[count++] = 0xff;
                                req[count++] = 0x00;
                                req[count++] = 0x00;
-                               req[count++] = has_address;
+                               req[count++] = 0;
                                for (i = 0; i < entry->subentries_count; i++) {
                                        switch 
(entry->subentries[i].entry_type) {
                                        case GN_PHONEBOOK_ENTRY_ExtendedAddress:
@@ -2474,13 +2469,20 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
                                                j = 
strlen(entry->subentries[i].data.number);
                                                j = char_unicode_encode((string 
+ 1), entry->subentries[i].data.number, j);
                                                string[j + 1] = 0;
-                                               string[0] = j + 2;
-                                               count += 
PackBlock(entry->subentries[i].entry_type, j + 1, &block, string, req + count, 
GN_PHONEBOOK_ENTRY_MAX_LENGTH - count);
+                                               string[0] = j;
+                                               count += 
PackBlock(entry->subentries[i].entry_type, j + 1, &postal_block, string, req + 
count, GN_PHONEBOOK_ENTRY_MAX_LENGTH - count);
                                                break;
                                        default:
                                                break;
                                        }
                                }
+                               if (postal_block > 0)
+                               {
+                                       req[postal_count + 7] = postal_block;
+                                       block++;
+                               }
+                               else
+                                       count = postal_count;
                        }
                }
                req[21] = block - 1;
@@ -2488,6 +2490,30 @@ static gn_error NK6510_WritePhonebookLocation(gn_data 
*data, struct gn_statemach
        } else {
                return NK6510_DeletePhonebookLocation(data, state);
        }
+#if 0
+       /* Validate block */
+       {
+               gn_phonebook_entry *save_entry = data->phonebook_entry;
+               void               *save_speed_dial = data->speed_dial;
+               void               *save_bitmap = data->bitmap;
+               gn_phonebook_entry *temp_entry = calloc (1, sizeof 
(gn_phonebook_entry));
+               
+
+               data->speed_dial = NULL;
+               data->bitmap = NULL;
+               data->phonebook_entry = temp_entry;
+
+               error = phonebook_decode (req + 22, count - 21, data, req[21], 
req[11], 12);
+               if (error)
+                       fprintf (stderr, "Mis-encoded phonebook, error %d\n", 
error);
+               
+               free (temp_entry);
+               data->phonebook_entry = save_entry;
+               data->speed_dial = save_speed_dial;
+               data->bitmap = save_bitmap;
+       }
+#endif
+        
        if (sm_message_send (count, NK6510_MSG_PHONEBOOK, req, state)) return 
GN_ERR_NOTREADY;
        error = sm_block (NK6510_MSG_PHONEBOOK, data, state);
        if (error)
-- 
1.5.2.2




--- End Message ---
--- Begin Message --- Subject: confirm 996b7ad89f9d8bf4401f40e7490ed2d7dad84950
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 ---

reply via email to

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