aboutsummaryrefslogtreecommitdiff
path: root/src/anastasis/anastasis-gtk_action.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/anastasis/anastasis-gtk_action.c')
-rw-r--r--src/anastasis/anastasis-gtk_action.c96
1 files changed, 66 insertions, 30 deletions
diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c
index 82c00bb..6d2bdb9 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -1840,6 +1840,8 @@ translate_state (const char *state)
.out = _ ("wait, tries exceeded") },
{ .in = "authentication-timeout",
.out = _ ("awaiting completion of authentication process") },
+ { .in = "external-instructions",
+ .out = _ ("challenge-specific action required") },
{ .in = NULL,
.out = NULL }
};
@@ -2748,6 +2750,7 @@ diag_question (const json_t *details)
uuid_str = json_string_value (json_object_get (details,
"uuid"));
+ /* Why do we do this? */
render_feedback (builder,
"anastasis_gtk_c_question_error_label",
uuid_str);
@@ -2766,6 +2769,27 @@ static GtkDialog *
diag_code (const json_t *details)
{
GtkBuilder *builder;
+ const char *instructions;
+ const char *uuid_str;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_string ("instructions",
+ &instructions),
+ GNUNET_JSON_spec_string ("uuid",
+ &uuid_str),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (details,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ json_dumpf (details,
+ stderr,
+ JSON_INDENT (2));
+ return NULL;
+ }
builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_code.glade",
NULL);
@@ -2776,25 +2800,16 @@ diag_code (const json_t *details)
}
{
GtkLabel *label;
- const char *instructions;
label = GTK_LABEL (gtk_builder_get_object (builder,
"challenge_instructions_label"));
- instructions = json_string_value (json_object_get (details,
- "instructions"));
gtk_label_set_text (label,
instructions);
- }
- {
- GtkLabel *clabel;
- const char *uuid_str;
-
- clabel = GTK_LABEL (gtk_builder_get_object (builder,
- "anastasis_gtk_c_challenge_label"));
- uuid_str = json_string_value (json_object_get (details,
- "uuid"));
- gtk_label_set_text (clabel,
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "anastasis_gtk_c_challenge_label"));
+ gtk_label_set_text (label,
uuid_str);
+ /* Why do we do this? */
render_feedback (builder,
"anastasis_gtk_c_code_error_label",
uuid_str);
@@ -2823,15 +2838,13 @@ diag_iban (const json_t *details)
const char *credit_iban;
const char *business;
const char *subject;
+ const char *uuid_str;
+ const char *debit_iban_hint;
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_amount_any ("challenge_amount",
- &amount),
- GNUNET_JSON_spec_string ("credit_iban",
- &credit_iban),
- GNUNET_JSON_spec_string ("business_name",
- &business),
- GNUNET_JSON_spec_string ("wire_transfer_subject",
- &subject),
+ GNUNET_JSON_spec_string ("uuid",
+ &uuid_str),
+ GNUNET_JSON_spec_string ("instructions",
+ &debit_iban_hint),
GNUNET_JSON_spec_end ()
};
@@ -2846,6 +2859,38 @@ diag_iban (const json_t *details)
JSON_INDENT (2));
return NULL;
}
+ {
+ json_t *cf = json_object_get (AG_redux_state,
+ "challenge_feedback");
+ json_t *ci = json_object_get (cf,
+ uuid_str);
+ json_t *cd = json_object_get (ci,
+ "details");
+ struct GNUNET_JSON_Specification ispec[] = {
+ TALER_JSON_spec_amount_any ("challenge_amount",
+ &amount),
+ GNUNET_JSON_spec_string ("credit_iban",
+ &credit_iban),
+ GNUNET_JSON_spec_string ("business_name",
+ &business),
+ GNUNET_JSON_spec_string ("wire_transfer_subject",
+ &subject),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if ( (NULL == cd) ||
+ (GNUNET_OK !=
+ GNUNET_JSON_parse (cd,
+ ispec,
+ NULL, NULL)) )
+ {
+ GNUNET_break (0);
+ json_dumpf (AG_redux_state,
+ stderr,
+ JSON_INDENT (2));
+ return NULL;
+ }
+ }
builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_iban.glade",
NULL);
@@ -2857,19 +2902,10 @@ diag_iban (const json_t *details)
{
GtkLabel *label;
-#if 0
- /* Note: need to extract the hint from the global
- state, but not sure if the JSON argument gives
- us the required data... */
label = GTK_LABEL (gtk_builder_get_object (builder,
"debit_account_label"));
gtk_label_set_text (label,
debit_iban_hint);
-#else
- json_dumpf (details,
- stderr,
- JSON_INDENT (2));
-#endif
label = GTK_LABEL (gtk_builder_get_object (builder,
"credit_account_label"));
gtk_label_set_text (label,