aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-09-30 14:43:12 +0200
committerChristian Grothoff <christian@grothoff.org>2021-09-30 14:43:12 +0200
commitfa99c50d3346c47793aa463656ff1d8ad86354ca (patch)
treee5c2e0ba6d0adda2713603c30c544924f55852f8
parentba92d27e5901f5063439914fbce99543cce74238 (diff)
downloadanastasis-gtk-fa99c50d3346c47793aa463656ff1d8ad86354ca.tar.gz
anastasis-gtk-fa99c50d3346c47793aa463656ff1d8ad86354ca.zip
allow providers to be enabled/disabled (fixes #6918)
-rw-r--r--m4/libtool.m44
-rw-r--r--po/POTFILES.in4
-rw-r--r--src/anastasis/anastasis-gtk_action.c16
-rw-r--r--src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c65
4 files changed, 49 insertions, 40 deletions
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index a6d21ae..c4c0294 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1071,11 +1071,11 @@ _LT_EOF
1071 # to the OS version, if on x86, and 10.4, the deployment 1071 # to the OS version, if on x86, and 10.4, the deployment
1072 # target defaults to 10.4. Don't you love it? 1072 # target defaults to 10.4. Don't you love it?
1073 case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 1073 case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
1074 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) 1074 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*)
1075 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 1075 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
1076 10.[[012]][[,.]]*) 1076 10.[[012]][[,.]]*)
1077 _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 1077 _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
1078 10.*) 1078 10.*|11.*)
1079 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 1079 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
1080 esac 1080 esac
1081 ;; 1081 ;;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a0f8ff8..15bc9b4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,6 +10,7 @@ src/anastasis/anastasis-gtk_handle-challenge-code.c
10src/anastasis/anastasis-gtk_handle-challenge-iban.c 10src/anastasis/anastasis-gtk_handle-challenge-iban.c
11src/anastasis/anastasis-gtk_handle-challenge-question.c 11src/anastasis/anastasis-gtk_handle-challenge-question.c
12src/anastasis/anastasis-gtk_handle-challenge-row-activated.c 12src/anastasis/anastasis-gtk_handle-challenge-row-activated.c
13src/anastasis/anastasis-gtk_handle-challenge-totp.c
13src/anastasis/anastasis-gtk_handle-clear-secret-clicked.c 14src/anastasis/anastasis-gtk_handle-clear-secret-clicked.c
14src/anastasis/anastasis-gtk_handle-continent-selected.c 15src/anastasis/anastasis-gtk_handle-continent-selected.c
15src/anastasis/anastasis-gtk_handle-core-secret-changed.c 16src/anastasis/anastasis-gtk_handle-core-secret-changed.c
@@ -30,9 +31,7 @@ src/anastasis/anastasis-gtk_handle-method-totp.c
30src/anastasis/anastasis-gtk_handle-method-video.c 31src/anastasis/anastasis-gtk_handle-method-video.c
31src/anastasis/anastasis-gtk_handle-payqr-selection-changed.c 32src/anastasis/anastasis-gtk_handle-payqr-selection-changed.c
32src/anastasis/anastasis-gtk_handle-policy-activate.c 33src/anastasis/anastasis-gtk_handle-policy-activate.c
33src/anastasis/.#anastasis-gtk_handle-policy-button.c
34src/anastasis/anastasis-gtk_handle-policy-button.c 34src/anastasis/anastasis-gtk_handle-policy-button.c
35src/anastasis/.#anastasis-gtk_handle-policy-meta.c
36src/anastasis/anastasis-gtk_handle-policy-meta.c 35src/anastasis/anastasis-gtk_handle-policy-meta.c
37src/anastasis/anastasis-gtk_handle-policy-version-changed.c 36src/anastasis/anastasis-gtk_handle-policy-version-changed.c
38src/anastasis/anastasis-gtk_handle-recovery-button-clicked.c 37src/anastasis/anastasis-gtk_handle-recovery-button-clicked.c
@@ -45,6 +44,7 @@ src/anastasis/anastasis-gtk_pe-delete-policy.c
45src/anastasis/anastasis-gtk_pe-edit-policy.c 44src/anastasis/anastasis-gtk_pe-edit-policy.c
46src/anastasis/anastasis-gtk_progress.c 45src/anastasis/anastasis-gtk_progress.c
47src/anastasis/os_installation.c 46src/anastasis/os_installation.c
47contrib/anastasis_gtk_about_window.glade
48contrib/anastasis_gtk_auth_add_email.glade 48contrib/anastasis_gtk_auth_add_email.glade
49contrib/anastasis_gtk_auth_add_iban.glade 49contrib/anastasis_gtk_auth_add_iban.glade
50contrib/anastasis_gtk_auth_add_post.glade 50contrib/anastasis_gtk_auth_add_post.glade
diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c
index 921df60..6863c65 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -708,7 +708,8 @@ action_authentications_editing (void)
708 { 708 {
709 uint32_t ec = 0; 709 uint32_t ec = 0;
710 uint32_t hc = 0; 710 uint32_t hc = 0;
711 json_t *methods; 711 bool disabled = false;
712 json_t *methods = NULL;
712 struct GNUNET_JSON_Specification spec[] = { 713 struct GNUNET_JSON_Specification spec[] = {
713 GNUNET_JSON_spec_mark_optional ( 714 GNUNET_JSON_spec_mark_optional (
714 GNUNET_JSON_spec_uint32 ("error_code", 715 GNUNET_JSON_spec_uint32 ("error_code",
@@ -716,8 +717,13 @@ action_authentications_editing (void)
716 GNUNET_JSON_spec_mark_optional ( 717 GNUNET_JSON_spec_mark_optional (
717 GNUNET_JSON_spec_json ("methods", 718 GNUNET_JSON_spec_json ("methods",
718 &methods)), 719 &methods)),
719 GNUNET_JSON_spec_uint32 ("http_status", 720 GNUNET_JSON_spec_mark_optional (
720 &hc), 721 GNUNET_JSON_spec_uint32 ("http_status",
722 &hc)),
723 GNUNET_JSON_spec_mark_optional (
724 GNUNET_JSON_spec_bool ("disabled",
725 &disabled)),
726
721 GNUNET_JSON_spec_end () 727 GNUNET_JSON_spec_end ()
722 }; 728 };
723 729
@@ -729,6 +735,8 @@ action_authentications_editing (void)
729 GNUNET_break (0); 735 GNUNET_break (0);
730 continue; 736 continue;
731 } 737 }
738 if (disabled)
739 continue;
732 switch (hc) 740 switch (hc)
733 { 741 {
734 case MHD_HTTP_OK: 742 case MHD_HTTP_OK:
@@ -820,7 +828,7 @@ action_authentications_editing (void)
820 * @param[out] method_cost cost to return 828 * @param[out] method_cost cost to return
821 * @return #GNUNET_OK on success 829 * @return #GNUNET_OK on success
822 */ 830 */
823static int 831static enum GNUNET_GenericReturnValue
824lookup_recovery_cost (const char *provider, 832lookup_recovery_cost (const char *provider,
825 const char *type, 833 const char *type,
826 struct TALER_Amount *method_cost) 834 struct TALER_Amount *method_cost)
diff --git a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
index 02da9d5..9b83813 100644
--- a/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
+++ b/src/anastasis/anastasis-gtk_handle-auth-edit-provider-clicked.c
@@ -314,7 +314,7 @@ url_add_button_clicked_cb (GtkButton *button,
314 -1, 314 -1,
315 AG_PMC_PROVIDER_URL, url, 315 AG_PMC_PROVIDER_URL, url,
316 AG_PMC_PROVIDER_STATUS, _ ("new"), 316 AG_PMC_PROVIDER_STATUS, _ ("new"),
317 AG_PMC_PROVIDER_STATUS_COLOR, "yellow", 317 AG_PMC_PROVIDER_STATUS_COLOR, "blue",
318 AG_PMC_PROVIDER_ENABLED, true, 318 AG_PMC_PROVIDER_ENABLED, true,
319 AG_PMC_PROVIDER_SENSITIVE, false, 319 AG_PMC_PROVIDER_SENSITIVE, false,
320 AG_PMC_PROVIDER_NOT_SENSITIVE, true, 320 AG_PMC_PROVIDER_NOT_SENSITIVE, true,
@@ -363,8 +363,7 @@ edit_provider_dialog_response_cb (GtkDialog *dialog,
363 GtkBuilder *builder = GTK_BUILDER (user_data); 363 GtkBuilder *builder = GTK_BUILDER (user_data);
364 GtkTreeModel *tm; 364 GtkTreeModel *tm;
365 GtkTreeIter iter; 365 GtkTreeIter iter;
366 const json_t *providers; 366 json_t *args;
367 json_t *urls;
368 367
369 if (GTK_RESPONSE_APPLY != response_id) 368 if (GTK_RESPONSE_APPLY != response_id)
370 { 369 {
@@ -379,9 +378,7 @@ edit_provider_dialog_response_cb (GtkDialog *dialog,
379 GNUNET_break (0); 378 GNUNET_break (0);
380 return; 379 return;
381 } 380 }
382 providers = json_object_get (AG_redux_state, 381 args = json_object ();
383 "authentication_providers");
384 urls = json_array ();
385 if (gtk_tree_model_get_iter_first (tm, 382 if (gtk_tree_model_get_iter_first (tm,
386 &iter)) 383 &iter))
387 do { 384 do {
@@ -393,34 +390,26 @@ edit_provider_dialog_response_cb (GtkDialog *dialog,
393 AG_PMC_PROVIDER_URL, &url, 390 AG_PMC_PROVIDER_URL, &url,
394 AG_PMC_PROVIDER_ENABLED, &enabled, 391 AG_PMC_PROVIDER_ENABLED, &enabled,
395 -1); 392 -1);
396 if (NULL == json_object_get (providers, 393 GNUNET_assert (0 ==
397 url)) 394 json_object_set_new (
398 { 395 args,
399 // FIXME: store enabled status in JSON state! 396 url,
400 GNUNET_assert (0 == 397 GNUNET_JSON_PACK (
401 json_array_append_new (urls, 398 GNUNET_JSON_pack_bool ("disabled",
402 json_string (url))); 399 ! enabled))));
403 }
404 g_free (url); 400 g_free (url);
405 } 401 }
406 while (gtk_tree_model_iter_next (tm, 402 while (gtk_tree_model_iter_next (tm,
407 &iter)); 403 &iter));
408 gtk_widget_destroy (GTK_WIDGET (dialog)); 404 gtk_widget_destroy (GTK_WIDGET (dialog));
409 g_object_unref (G_OBJECT (builder)); 405 g_object_unref (G_OBJECT (builder));
410 { 406 AG_freeze ();
411 json_t *args; 407 AG_ra = ANASTASIS_redux_action (AG_redux_state,
412 408 "add_provider",
413 args = GNUNET_JSON_PACK ( 409 args,
414 GNUNET_JSON_pack_array_steal ("urls", 410 &AG_action_cb,
415 urls)); 411 NULL);
416 AG_freeze (); 412 json_decref (args);
417 AG_ra = ANASTASIS_redux_action (AG_redux_state,
418 "add_provider",
419 args,
420 &AG_action_cb,
421 NULL);
422 json_decref (args);
423 }
424} 413}
425 414
426 415
@@ -458,11 +447,14 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
458 uint32_t http_code; 447 uint32_t http_code;
459 uint32_t ec; 448 uint32_t ec;
460 struct TALER_Amount ll; 449 struct TALER_Amount ll;
450 bool disabled = false;
461 struct GNUNET_JSON_Specification spec[] = { 451 struct GNUNET_JSON_Specification spec[] = {
462 GNUNET_JSON_spec_mark_optional ( 452 GNUNET_JSON_spec_mark_optional (
463 GNUNET_JSON_spec_uint32 ("http_status", 453 GNUNET_JSON_spec_uint32 ("http_status",
464 &http_code)), 454 &http_code)),
465 // FIXME: check: right fieldname? 455 GNUNET_JSON_spec_mark_optional (
456 GNUNET_JSON_spec_bool ("disabled",
457 &disabled)),
466 GNUNET_JSON_spec_mark_optional ( 458 GNUNET_JSON_spec_mark_optional (
467 TALER_JSON_spec_amount_any ("liability_limit", 459 TALER_JSON_spec_amount_any ("liability_limit",
468 &ll)), 460 &ll)),
@@ -490,7 +482,8 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
490 JSON_INDENT (2)); 482 JSON_INDENT (2));
491 continue; 483 continue;
492 } 484 }
493 if (MHD_HTTP_OK == http_code) 485 if ( (MHD_HTTP_OK == http_code) &&
486 (! disabled) )
494 { 487 {
495 status = GNUNET_strdup (_ ("available")); 488 status = GNUNET_strdup (_ ("available"));
496 color = "green"; 489 color = "green";
@@ -501,7 +494,8 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
501 else 494 else
502 GNUNET_break (0); 495 GNUNET_break (0);
503 } 496 }
504 else if (0 == http_code) 497 else if ( (0 == http_code) &&
498 (! disabled) )
505 { 499 {
506 GNUNET_asprintf (&status, 500 GNUNET_asprintf (&status,
507 _ ("Network failure: %s (#%u)"), 501 _ ("Network failure: %s (#%u)"),
@@ -509,6 +503,13 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
509 (unsigned int) ec); 503 (unsigned int) ec);
510 color = "red"; 504 color = "red";
511 } 505 }
506 else if (disabled)
507 {
508 GNUNET_asprintf (&status,
509 _ ("disabled"));
510 color = "blue";
511 sensitive = true;
512 }
512 else 513 else
513 { 514 {
514 GNUNET_asprintf (&status, 515 GNUNET_asprintf (&status,
@@ -527,7 +528,7 @@ anastasis_gtk_edit_provider_list_clicked_cb (GtkButton *object,
527 AG_PMC_PROVIDER_STATUS, status, 528 AG_PMC_PROVIDER_STATUS, status,
528 AG_PMC_PROVIDER_STATUS_COLOR, color, 529 AG_PMC_PROVIDER_STATUS_COLOR, color,
529 AG_PMC_PROVIDER_LIABILITY_LIMIT, ll_s, 530 AG_PMC_PROVIDER_LIABILITY_LIMIT, ll_s,
530 AG_PMC_PROVIDER_ENABLED, sensitive, // FIXME: store active/inactive status in JSON state! 531 AG_PMC_PROVIDER_ENABLED, ! disabled,
531 AG_PMC_PROVIDER_SENSITIVE, sensitive, 532 AG_PMC_PROVIDER_SENSITIVE, sensitive,
532 AG_PMC_PROVIDER_NOT_SENSITIVE, ! sensitive, 533 AG_PMC_PROVIDER_NOT_SENSITIVE, ! sensitive,
533 -1); 534 -1);