summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-01 13:44:42 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-01 13:44:42 +0200
commita808e1d5422ea7818110753e5b4ff7205b984d30 (patch)
tree6deaf5855e4a0fd19afd85531ddd916e67e3007d /src
parent380a5e1a76b6d0e3e269c1fd44e6f4886554626f (diff)
downloadtaler-mdb-a808e1d5422ea7818110753e5b4ff7205b984d30.tar.gz
taler-mdb-a808e1d5422ea7818110753e5b4ff7205b984d30.tar.bz2
taler-mdb-a808e1d5422ea7818110753e5b4ff7205b984d30.zip
include ESSID in payto URI
Diffstat (limited to 'src')
-rw-r--r--src/main.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c
index a80bda5..103b101 100644
--- a/src/main.c
+++ b/src/main.c
@@ -622,6 +622,11 @@ static char *fulfillment_msg;
static char *authorization;
/**
+ * ESSID of a WLAN network offered by the snack system, or NULL.
+ */
+static char *essid;
+
+/**
* Handle for the payment
*/
static struct PaymentActivity *payment_activity;
@@ -1392,6 +1397,7 @@ check_payment_cb (void *cls,
const char *taler_pay_uri)
{
struct PaymentActivity *pa = cls;
+ char *uri;
(void) refunded;
(void) refund_amount;
@@ -1424,29 +1430,33 @@ check_payment_cb (void *cls,
}
return;
}
- else
+ /* Start to check for payment. Note that we do this even before
+ we talked successfully to the wallet via NFC because we MAY show the
+ QR code in the future and in that case the payment may happen
+ anytime even before the NFC communication succeeds. */
+ if ( (NULL == pa->cpo) &&
+ (NULL == pa->delay_pay_task) )
{
- /* Start to check for payment. Note that we do this even before
- we talked successfully to the wallet via NFC because we MAY show the
- QR code in the future and in that case the payment may happen
- anytime even before the NFC communication succeeds. */
- if ( (NULL == pa->cpo) &&
- (NULL == pa->delay_pay_task) )
- {
- pa->delay_pay_task = GNUNET_SCHEDULER_add_delayed (MAX_HTTP_RETRY_FREQ,
- &check_payment_again,
- pa);
- }
+ pa->delay_pay_task = GNUNET_SCHEDULER_add_delayed (MAX_HTTP_RETRY_FREQ,
+ &check_payment_again,
+ pa);
}
if (NULL == pa->taler_pay_uri)
{
+ if (NULL == essid)
+ uri = GNUNET_strdup (taler_pay_uri);
+ else
+ GNUNET_asprintf (&uri,
+ "%s#%s",
+ taler_pay_uri,
+ essid);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trying to talk to wallet to give it pay URI `%s'\n",
- taler_pay_uri);
+ uri);
GNUNET_assert (NULL == pa->pnd);
- pa->taler_pay_uri = GNUNET_strdup (taler_pay_uri);
+ pa->taler_pay_uri = uri;
#if HAVE_QRENCODE_H
- show_qrcode (taler_pay_uri);
+ show_qrcode (uri);
#endif
pa->task = GNUNET_SCHEDULER_add_now (&open_nfc_reader,
pa);
@@ -2943,6 +2953,17 @@ run (void *cls,
auth);
GNUNET_free (auth);
}
+ {
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "taler-mdb",
+ "essid",
+ &essid))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "No ESSID specified, will not advertise WLAN\n");
+ }
+ }
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
"taler-mdb",