Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vCard-based address book import API #5202

Closed
link2xt opened this issue Jan 21, 2024 · 0 comments · Fixed by #5582
Closed

vCard-based address book import API #5202

link2xt opened this issue Jan 21, 2024 · 0 comments · Fixed by #5582
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@link2xt
Copy link
Collaborator

link2xt commented Jan 21, 2024

We have several issues and forum discussions related to contact sharing, export and import. There is generally an agreement to use vCard because it is supported by at least Android Contacts application and Thunderbird, but no plan to introduce it or API design.

Current contact import API is dc_add_address_book. It takes input in an ad-hoc text format where each contact is represented as a line containing contact display name followed by the line containing contact email address. Call returns the number of imported contacts which can be displayed in a dialog on success. Android UI currently iterates over contacts returned by Contacts Provider to construct dc_add_address_book input.

This issue is a proposal to add similar API dc_add_vcard_contacts accepting a single string consisting of vCards concatenated together like in .vcf file generated by Android Contacts or Thunderbird. Android Contacts Provider has APIs to provide vCard: https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_MULTI_VCARD_URI Besides that, vCards may be imported in the UI by selecting a file or drag-and-dropping a .vcf file. Reading the file contents should be done by the UI in this case to avoid adding more APIs accepting filenames which may be problematic when running the core sandboxed, dealing with OS-specific permissions and portals etc.

As a first step a JSON-RPC API with a test being able to import email addresses and display names from .vcf files exported from Thunderbird and Android is enough. Next step is to be able to read KEY:data:application/pgp-keys;base64,... key and apply it as a gossiped key if we don't have a peerstate for the contact yet, see https://datatracker.ietf.org/doc/html/rfc6350#section-6.8.1 How to treat the key if we already have a peerstate is not clear, but for now it is safe to ignore it then. We can always change this behavior later based on how we implement contact export and contact sharing.

Exporting vCards, sharing contacts as vCards, storing additional fields like phone number in Delta Chat address book etc. is outside of the scope of this issue.

There is a closed PR with an attempt to encode avatars as vCards: #1279 It is closed without merging because we decided to gossip avatars via invisible headers, but the code can be looked up for an example of using ical crate for parsing. Other vCard-parsing crates may be evaluated, but this one has already been lightly tested, has good stats on crates.io and is maintained, so should be good enough.

@link2xt link2xt added the enhancement New feature or request label Jan 21, 2024
This was referenced Jan 21, 2024
@link2xt link2xt added the good first issue Good for newcomers label Jan 22, 2024
@Septias Septias self-assigned this Feb 28, 2024
@iequidoo iequidoo self-assigned this May 4, 2024
iequidoo added a commit that referenced this issue May 6, 2024
iequidoo added a commit that referenced this issue May 11, 2024
Hocuri pushed a commit that referenced this issue May 13, 2024
iequidoo added a commit that referenced this issue May 15, 2024
iequidoo added a commit that referenced this issue May 15, 2024
iequidoo added a commit that referenced this issue May 15, 2024
iequidoo added a commit that referenced this issue May 15, 2024
iequidoo added a commit that referenced this issue May 15, 2024
Add a function parsing a vCard file at the given path.

Co-authored-by: Hocuri <[email protected]>
Co-authored-by: Asiel Díaz Benítez <[email protected]>
iequidoo added a commit that referenced this issue May 15, 2024
iequidoo added a commit that referenced this issue May 15, 2024
Add a function parsing a vCard file at the given path.

Co-authored-by: Hocuri <[email protected]>
Co-authored-by: Asiel Díaz Benítez <[email protected]>
iequidoo added a commit that referenced this issue May 15, 2024
iequidoo added a commit that referenced this issue May 15, 2024
Add a function parsing a vCard file at the given path.

Co-authored-by: Hocuri <[email protected]>
Co-authored-by: Asiel Díaz Benítez <[email protected]>
iequidoo added a commit that referenced this issue May 15, 2024
iequidoo added a commit that referenced this issue May 16, 2024
Add a function parsing a vCard file at the given path.

Co-authored-by: Hocuri <[email protected]>
Co-authored-by: Asiel Díaz Benítez <[email protected]>
iequidoo added a commit that referenced this issue May 16, 2024
iequidoo added a commit that referenced this issue May 17, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 17, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 17, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 17, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 17, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 17, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 18, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 19, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 19, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 20, 2024
Add a function importing contacts from the given vCard.
iequidoo added a commit that referenced this issue May 21, 2024
Add a function importing contacts from the given vCard.
link2xt pushed a commit that referenced this issue May 21, 2024
Add a function importing contacts from the given vCard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants