From 6febff295d9ac37c79a7613242b0811dde763519 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 13 Apr 2022 22:52:17 +0200 Subject: implement #7221 --- src/anastasis/anastasis-gtk_action.c | 5 ++- ...stasis-gtk_handle-main-window-forward-clicked.c | 47 +++++++--------------- src/anastasis/anastasis-gtk_helper.h | 7 +++- 3 files changed, 24 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c index 6f0f3ed..2bce9b2 100644 --- a/src/anastasis/anastasis-gtk_action.c +++ b/src/anastasis/anastasis-gtk_action.c @@ -1809,6 +1809,7 @@ show_challenge_feedback (const char *uuid, * present in the state that was used to locate this version * @param server_time when did the provider receive the upload * @param secret_name name the user assigned to the backup + * @param providers json array of providers offering this policy */ static void expand_policy_list (void *cls, @@ -1817,7 +1818,8 @@ expand_policy_list (void *cls, uint32_t version, json_int_t attribute_mask, struct GNUNET_TIME_Timestamp server_time, - const char *secret_name) + const char *secret_name, + const json_t *providers) { GtkListStore *ls = cls; GtkTreeIter iter; @@ -1835,6 +1837,7 @@ expand_policy_list (void *cls, AG_SSMC_SECRET_NAME, secret_name, AG_SSMC_POLICY_DATE_STRING, GNUNET_TIME_timestamp2s (server_time), AG_SSMC_POLICY_DATE_NUMERIC, (guint64) server_time.abs_time.abs_value_us, + AG_SSMC_POLICY_PROVIDER_JSON, (gpointer) providers, -1); if (! have_first) { diff --git a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c index 4c4eab9..de25cff 100644 --- a/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c +++ b/src/anastasis/anastasis-gtk_handle-main-window-forward-clicked.c @@ -449,13 +449,9 @@ forward_secret_selecting (void) gchar *secret_name; gint version; gint mask; + const json_t *providers; AG_freeze (); - if (NULL != AG_pd) - { - ANASTASIS_policy_discovery_stop (AG_pd); - AG_pd = NULL; - } AG_stop_long_action (); selection = GTK_TREE_SELECTION ( GCG_get_main_window_object ( @@ -475,41 +471,26 @@ forward_secret_selecting (void) AG_SSMC_POLICY_VERSION, &version, AG_SSMC_ATTRIBUTE_MASK, &mask, AG_SSMC_SECRET_NAME, &secret_name, + AG_SSMC_POLICY_PROVIDER_JSON, &providers, -1); - { - json_t *providers; - - providers = json_array (); - /* FIXME #7221: should build array with _all_ providers - that provide the same policy here, instead of - just picking one of them... - => requires change in tree model or different - lookup. */ - GNUNET_assert (NULL != providers); - GNUNET_assert ( - 0 == - json_array_append ( - providers, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("url", - provider_url), - GNUNET_JSON_pack_uint64 ("version", - version)))); - args = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_array_steal ("providers", - providers), - GNUNET_JSON_pack_uint64 ("attribute_mask", - mask), - GNUNET_JSON_pack_string ("secret_name", - secret_name) - ); - } + args = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_array_incref ("providers", + (json_t *) providers), + GNUNET_JSON_pack_uint64 ("attribute_mask", + mask), + GNUNET_JSON_pack_string ("secret_name", + secret_name)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Proceeding with policy version %u at provider %s\n", (unsigned int) version, provider_url); g_free (provider_url); g_free (secret_name); + if (NULL != AG_pd) + { + ANASTASIS_policy_discovery_stop (AG_pd); + AG_pd = NULL; + } AG_ra = ANASTASIS_redux_action (AG_redux_state, "select_version", args, diff --git a/src/anastasis/anastasis-gtk_helper.h b/src/anastasis/anastasis-gtk_helper.h index b19e6dd..48972a2 100644 --- a/src/anastasis/anastasis-gtk_helper.h +++ b/src/anastasis/anastasis-gtk_helper.h @@ -90,7 +90,12 @@ enum AG_SecretSelectionModelColumns /** * A guint64. */ - AG_SSMC_POLICY_DATE_NUMERIC = 5 + AG_SSMC_POLICY_DATE_NUMERIC = 5, + + /** + * A gpointer. + */ + AG_SSMC_POLICY_PROVIDER_JSON = 6 }; -- cgit v1.2.3