From 5f04a6eb099e714d76e6531051aa4677cc46ea78 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 8 Mar 2022 18:33:42 -0600 Subject: [PATCH] QR-code: Actually use Uri.join if glib version supports it --- CMakeLists.txt | 3 ++- plugins/omemo/src/ui/contact_details_dialog.vala | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8963937..c9525870 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,7 +198,8 @@ include(${VALA_USE_FILE}) include(MultiFind) include(GlibCompileResourcesSupport) -set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --target-glib=${GLib_GLOBAL_VERSION}") +find_package(GLib ${GLib_GLOBAL_VERSION} REQUIRED) +set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --target-glib=${GLib_VERSION}") add_subdirectory(qlite) add_subdirectory(xmpp-vala) diff --git a/plugins/omemo/src/ui/contact_details_dialog.vala b/plugins/omemo/src/ui/contact_details_dialog.vala index df98d772..a40970d0 100644 --- a/plugins/omemo/src/ui/contact_details_dialog.vala +++ b/plugins/omemo/src/ui/contact_details_dialog.vala @@ -93,13 +93,13 @@ public class ContactDetailsDialog : Gtk.Dialog { int sid = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id)[plugin.db.identity.device_id]; var iri_query = @"omemo-sid-$(sid)=$(fingerprint)"; - #if 0 +#if GLIB_2_66 // glib >=2.66 only; never compiled - string iri = GLib.Uri.join("xmpp", null, null, 0, jid, iri_query); - #else + string iri = GLib.Uri.join(UriFlags.NONE, "xmpp", null, null, 0, jid.to_string(), iri_query, null); +#else var iri_path_seg = escape_for_iri_path_segment(jid.to_string()); var iri = @"xmpp:$(iri_path_seg)?$(iri_query)"; - #endif +#endif const int QUIET_ZONE_MODULES = 4; // MUST be at least 4 const int MODULE_SIZE_PX = 4; // arbitrary @@ -136,9 +136,9 @@ public class ContactDetailsDialog : Gtk.Dialog { private static string escape_for_iri_path_segment(string s) { // from RFC 3986, 2.2. Reserved Characters: - /*const*/ string SUB_DELIMS = "!$&'()*+,;="; + string SUB_DELIMS = "!$&'()*+,;="; // from RFC 3986, 3.3. Path (pchar without unreserved and pct-encoded): - /*const*/ string ALLOWED_RESERVED_CHARS = SUB_DELIMS + ":@"; + string ALLOWED_RESERVED_CHARS = SUB_DELIMS + ":@"; return GLib.Uri.escape_string(s, ALLOWED_RESERVED_CHARS, true); }