KnugiHK / WhatsApp-Chat-Exporter

A customizable Android and iOS/iPadOS WhatsApp database parser that will give you the history of your WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14, Crypt15, and new schema supported.
https://wts.knugi.dev/
MIT License
518 stars 76 forks source link

Handle groups of VCards correctly #99

Closed jonx closed 4 weeks ago

jonx commented 2 months ago

A VCard in a message can sometimes be a group of VCards in which case ZVCARDNAME contains a list of VCard names separated by "_$!<Name-Separator>!$_". Note that the first element is the name of the group and is currently dismissed. ZVCARDSTRING contain the list of VCards separated by "_$!<VCard-Separator>!$_".

Currently the program crashes because it tries to create a Vcard named using a potentially ultra long name (I have groups of hundreds of VCards). This code now handles those groups correctly and saves each VCard in its own VCF file.

You might wanna adjust the content of message.data to your liking as it currently just provide a basic list of the VCards: "Contact 1 (See file: Contact1.vcf) + Contact 2 (See file: Contact2.vcf)".

Given the path to the VCard can be quite long, I thought you might want to use my format and create a URL link to the actual VCard?

Here is an example: ‎ZVCARDNAME = 2 contacts_$!<Name-Separator>!$_Contact 1_$!<Name-Separator>!$_Contact 2 ZVCARDSTRING =

BEGIN:VCARD
VERSION:3.0
N:Contact;1;;;
FN:Contact 1
TEL;type=CELL;type=VOICE;waid=11231231234:+1 (123) 123-1234
END:VCARD_$!<VCard-Separator>!$_BEGIN:VCARD
VERSION:3.0
N:Contact;1;;;
FN:Contact 2
ORG:Conty;
TEL;type=CELL;type=VOICE;waid=11231231234:+1 (123) 123-1234
item1.ADR;type=HOME:;;1234 Test Ct.;NYC;NY;Blah;United States
item1.X-ABADR:us
END:VCARD
KnugiHK commented 4 weeks ago

To improve user experience, I added direct links to the vCard files, allowing users to download them with a simple click instead of searching for the files themselves.

KnugiHK commented 4 weeks ago

Thanks for your contribution!

jonx commented 6 days ago

Of course, you're welcome. Thanks for creating this great tool.