gnokii-users
[Top][All Lists]
Advanced

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

[PATCH] vcard export fix


From: Florian Lohoff
Subject: [PATCH] vcard export fix
Date: Tue, 22 Apr 2003 17:46:21 +0200
User-agent: Mutt/1.3.28i

Hi,
after i got my 6310i to work with bluetooth (Thanks) i tried exporting 
the phonebook as vcards. (had to look into the source to find vcard
exporting magically happens if you append .vcard to filename). 

Now there seemed to be something really bogus going on concerning the
X_GSM_STORE_AT: token. Its printed above the vcard as

X_GSM_STORE_AT:X_GSM_STORE_AT:ME5

and later IN the vcard with a lot of garbe behind it. I guess this is
due to misunderstanding concerning the usage of the "gchar *addon" with
gn_phonebook2vcard. Here is a fix which only lets the users of the
function to pass in a string about the location of the entry.
By reading the function you might discover that actually the STORE_AT
can't contain valid information.

The longer fix would probably be to put the location as a real string
into the entry at readout time.

Here is a patch against cvs 


Index: gnokii/gnokii.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii.c,v
retrieving revision 1.343
diff -u -r1.343 gnokii.c
--- gnokii/gnokii.c     6 Mar 2003 21:58:00 -0000       1.343
+++ gnokii/gnokii.c     22 Apr 2003 15:39:59 -0000
@@ -3003,9 +3003,9 @@
                                if (entry.memory_type == GN_MT_MC || 
entry.memory_type == GN_MT_DC || entry.memory_type == GN_MT_RC)
                                        fprintf(stdout, "%02u.%02u.%04u 
%02u:%02u:%02u\n", entry.date.day, entry.date.month, entry.date.year, 
entry.date.hour, entry.date.minute, entry.date.second);
                        } else if (vcard) {
-                               char buf[10240];
-                               sprintf(buf, "X_GSM_STORE_AT:%s%d\n", 
memory_type_string, entry.location);
-                               gn_phonebook2vcard(stdout, &entry, buf);
+                               char location[32];
+                               sprintf(location, "%s%d", memory_type_string, 
entry.location);
+                               gn_phonebook2vcard(stdout, &entry, location);
                        } else {
                                fprintf(stdout, _("%d. Name: %s\nNumber: 
%s\nGroup id: %d\n"), entry.location, entry.name, entry.number, 
entry.caller_group);
                                for (i = 0; i < entry.subentries_count; i++) {
Index: xgnokii/xgnokii_contacts.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/xgnokii/xgnokii_contacts.c,v
retrieving revision 1.50
diff -u -r1.50 xgnokii_contacts.c
--- xgnokii/xgnokii_contacts.c  26 Feb 2003 00:15:53 -0000      1.50
+++ xgnokii/xgnokii_contacts.c  22 Apr 2003 15:40:00 -0000
@@ -2610,7 +2610,7 @@
 
 static void ExportVCARD(FILE * f)
 {
-       gchar buf2[1024];
+       gchar location[32];
        register gint i;
        PhonebookEntry *pbEntry;
 
@@ -2621,14 +2621,11 @@
                        continue;
 
                if (pbEntry->entry.memory_type == GN_MT_ME)
-                       sprintf(buf2, "X_GSM_STORE_AT:ME%d\n", i + 1);
+                       sprintf(location, "ME%d", i + 1);
                else
-                       sprintf(buf2, "X_GSM_STORE_AT:SM%d\n", i - 
memoryStatus.MaxME + 1);
+                       sprintf(location, "SM%d", i - memoryStatus.MaxME + 1);
 
-               fprintf(f, "X_GSM_STORE_AT:%s\n", buf2);
-               fprintf(f, "X_GSM_CALLERGROUP:%d\n", 
pbEntry->entry.caller_group);
-
-               gn_phonebook2vcard(f, &pbEntry->entry, buf2);
+               gn_phonebook2vcard(f, &pbEntry->entry, location);
        }
 
        fclose(f);
Index: common/vcard.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/vcard.c,v
retrieving revision 1.7
diff -u -r1.7 vcard.c
--- common/vcard.c      6 Mar 2003 21:23:59 -0000       1.7
+++ common/vcard.c      22 Apr 2003 15:40:00 -0000
@@ -34,19 +34,16 @@
 #include "compat.h"
 #include "gnokii.h"
 
-API int gn_phonebook2vcard(FILE * f, gn_phonebook_entry *entry, char *addon)
+API int gn_phonebook2vcard(FILE * f, gn_phonebook_entry *entry, char *location)
 {
-       char buf2[1024];
        int i;
 
        fprintf(f, "BEGIN:VCARD\n");
        fprintf(f, "VERSION:3.0\n");
        fprintf(f, "FN:%s\n", entry->name);
        fprintf(f, "TEL;VOICE:%s\n", entry->number);
-
-       fprintf(f, "X_GSM_STORE_AT:%s\n", buf2);
+       fprintf(f, "X_GSM_STORE_AT:%s\n", location);
        fprintf(f, "X_GSM_CALLERGROUP:%d\n", entry->caller_group);
-       fprintf(f, "%s", addon);
 
        /* Add ext. pbk info if required */
        for (i = 0; i < entry->subentries_count; i++) {

Flo
-- 
Florian Lohoff                  address@hidden             +49-5201-669912
                        Heisenberg may have been here.

Attachment: pgpXkcjULGOen.pgp
Description: PGP signature


reply via email to

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