Skip to content
  • Niels De Graef's avatar
    Enable importing & exporting VCards · fcbc87c4
    Niels De Graef authored
    This commit adds the experimental functionality in Contacts to import
    VCard (*.vcf) files.
    
    Since importing a contact means we have to take in untrusted/unvalidated
    input, let's give a high-level view of what happens:
    
    * Contacts starts a native file chooser dialog so the user can choose
      which file to import
    * According to the chosen file, Contacts will launch a subprocess to do
      the actual parsing using a `Contacts.Io.Parser`. At this point, we
      only have a single subclass, which allows importing VCards.
    * The helper process serializes the result to a `GLib.Variant`, and
      sends it to the main process, which will receive the result and
      parses it again.
    * After the parsing operation is done, we can then start up a
      `ImportOperation`, which will import the contacts using libfolks' API.
    
    Exporting contacts is quite a bit easier, since we don't have to deal
    with untrusted input: we serialize the list of selected contacts and
    asynchronously write each to the given output stream. In the app, that's
    a user chosen file; in tests, that can be a string.
    
    Fixes: #1
    Fixes: #38
    fcbc87c4