From 45cb9a2d7e8cffd17bab05e29ee38f0463743a9c Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Fri, 17 Oct 2025 11:10:09 +0200
Subject: [PATCH] vcard-export: Adapt to evolution-data-server 3.59.1 EVCard
 API changes

The e_vcard_to_string() newly does not have any argument, the vCard
is saved in a version it is stored in the structure. To export in
a specific version, one can use e_vcard_convert_to_string().

Upstream-Status: Merged in version 50.alpha
---
 meson.build                                    |  3 +++
 src/io/contacts-io-vcard-export-operation.vala | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/meson.build b/meson.build
index e2a70a98..b90cb36d 100644
--- a/meson.build
+++ b/meson.build
@@ -52,6 +52,9 @@ libadwaita_dep = dependency('libadwaita-1', version: '>= 1.8.alpha')
 # E-D-S
 libebook = dependency('libebook-1.2', version: '>=' + min_eds_version)
 libedataserver = dependency('libedataserver-1.2', version: '>=' + min_eds_version)
+if libebook.version().version_compare('>=3.59.1')
+  add_project_arguments('-D', 'HAVE_EDS_3_59_1', language: 'vala')
+endif
 # Camera
 libportal_dep = dependency('libportal-gtk4', version: '>= 0.7')
 gstreamer_dep = dependency('gstreamer-1.0')
diff --git a/src/io/contacts-io-vcard-export-operation.vala b/src/io/contacts-io-vcard-export-operation.vala
index 74ed6572..a692a67d 100644
--- a/src/io/contacts-io-vcard-export-operation.vala
+++ b/src/io/contacts-io-vcard-export-operation.vala
@@ -16,7 +16,9 @@ public class Contacts.Io.VCardExportOperation : ExportOperation {
 
   // We _could_ parameterize this with our own enum, but there's no need for
   // that at the moment.
+#if !HAVE_EDS_3_59_1
   private E.VCardFormat vcard_format = E.VCardFormat.@30;
+#endif
 
   // This should always be on false, except for debugging/troubleshooting
   // purposes. It forces E-D-S personas to use our manual serialization instead
@@ -53,7 +55,11 @@ public class Contacts.Io.VCardExportOperation : ExportOperation {
     // that's an E.VCard already
     if (persona is Edsf.Persona && !avoid_eds) {
       unowned var contact = ((Edsf.Persona) persona).contact;
+#if HAVE_EDS_3_59_1
+      return contact.to_string ();
+#else
       return contact.to_string (this.vcard_format);
+#endif
     }
 
     var vcard = new E.VCard ();
@@ -104,7 +110,11 @@ public class Contacts.Io.VCardExportOperation : ExportOperation {
       vcard_set_webservice_details (vcard, (WebServiceDetails) persona);
 */
 
+#if HAVE_EDS_3_59_1
+    return vcard.to_string ();
+#else
     return vcard.to_string (this.vcard_format);
+#endif
   }
 
   private void vcard_set_avatar_details (E.VCard vcard,
-- 
GitLab

