commit 56a225b2575d133ee63fabdef70b80464d618818 parent f22b4eea546ba86e14ca7a3b8f651762cddd30d1 Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch> Date: Thu, 18 Jan 2024 13:17:38 +0100 added charity delete Diffstat:
20 files changed, 313 insertions(+), 89 deletions(-)
diff --git a/src/donau/Makefile.am b/src/donau/Makefile.am @@ -44,6 +44,7 @@ donau_httpd_SOURCES = \ donau-httpd_keys.c donau-httpd_keys.h \ donau-httpd_config.c donau-httpd_config.h \ donau-httpd_get-charities.c donau_httpd_charity.h \ + donau-httpd_charity_delete.c \ donau-httpd_get-charity.c donau-httpd_post-charity.c \ donau-httpd_get-history.c \ donau-httpd_post-submit-receipt.c donau_httpd_receipt.h \ diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c @@ -482,6 +482,14 @@ handle_mhd_request (void *cls, .method = MHD_HTTP_METHOD_POST, .handler.post = &DH_handler_charity_post }, + /* DELETE charities */ + { + .url = "charities", + .method = MHD_HTTP_METHOD_DELETE, + .handler.delete = &DH_handler_charity_delete, + .nargs = 1, + .nargs_is_upper_bound = true + }, /** etc diff --git a/src/donau/donau-httpd_charity.h b/src/donau/donau-httpd_charity.h @@ -23,6 +23,7 @@ #include <microhttpd.h> #include "donau-httpd.h" +#include "donaudb_plugin.h" /** @@ -63,4 +64,16 @@ MHD_RESULT DH_handler_charities_get ( struct DH_RequestContext *rc); +/** + * Handle a DELETE "/charity/$CHARITY_ID" request. + * + * @param rc request details about the request to handle + * @param args argument with the public key of the purse + * @return MHD result code + */ +MHD_RESULT +DH_handler_charity_delete ( + struct DH_RequestContext *rc, + const char *const args[1]); + #endif diff --git a/src/donau/donau-httpd_charity_delete.c b/src/donau/donau-httpd_charity_delete.c @@ -0,0 +1,86 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file donau-httpd_charity_delete.c + * @brief Handle DELETE /charitys/$PID requests; parses the request and + * verifies the signature before handing deletion to the database. + * @author Johannes Casaburi + */ +#include "taler/platform.h" +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_json_lib.h> +#include <jansson.h> +#include <microhttpd.h> +#include "taler/taler_dbevents.h" +#include "taler/taler_json_lib.h" +#include "taler/taler_mhd_lib.h" +// #include "donau-httpd_common_deposit.h" +#include "donau-httpd_charity.h" +// #include "donau-httpd_responses.h" +// #include "taler_exchangedb_lib.h" +// #include "donau-httpd_keys.h" + + +MHD_RESULT +DH_handler_charity_delete ( + struct DH_RequestContext *rc, + const char *const args[1]) +{ + unsigned long long charity_id; + char dummy; + + if ( (NULL == args[0]) || + (1 != sscanf (args[0], + "%llu%c", + &charity_id, + &dummy)) ) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error (rc->connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "charity_id"); + } + + { + enum GNUNET_DB_QueryStatus qs; + + qs = DH_plugin->do_charity_delete (DH_plugin->cls, + charity_id); + switch (qs) + { + case GNUNET_DB_STATUS_HARD_ERROR: + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); + return TALER_MHD_reply_with_error (rc->connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + NULL); + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + return TALER_MHD_reply_static ( + rc->connection, + MHD_HTTP_NO_CONTENT, + NULL, + NULL, + 0); + } + } + +} + + +/* end of donau-httpd_charity_delete.c */ diff --git a/src/donau/donau-httpd_get-history.c b/src/donau/donau-httpd_get-history.c @@ -44,7 +44,7 @@ static void history_cb ( void *cls, - uint64_t charity_id, + unsigned long long charity_id, struct TALER_Amount final_amount, uint64_t donation_year) { @@ -86,8 +86,8 @@ DH_handler_history_get ( history = json_array (); GNUNET_assert (NULL != history); qs = DH_plugin->get_history (DH_plugin->cls, - &history_cb, - history); + &history_cb, + history); switch (qs) { case GNUNET_DB_STATUS_HARD_ERROR: diff --git a/src/donaudb/Makefile.am b/src/donaudb/Makefile.am @@ -86,6 +86,7 @@ libtaler_plugin_donaudb_postgres_la_SOURCES = \ pg_get_history.h pg_get_history.c \ pg_get_charities.h pg_get_charities.c \ pg_insert_charity.h pg_insert_charity.c \ + pg_do_charity_delete.h pg_do_charity_delete.c \ pg_lookup_charity.h pg_lookup_charity.c \ pg_insert_history_entry.h pg_insert_history_entry.c \ pg_insert_issued_receipt.h pg_insert_issued_receipt.c \ diff --git a/src/donaudb/pg_do_charity_delete.c b/src/donaudb/pg_do_charity_delete.c @@ -0,0 +1,51 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ +/** + * @file exchangedb/pg_do_charity_delete.c + * @brief Implementation of the do_charity_delete function for Postgres + * @author Johannes Casaburi + */ +#include "taler/platform.h" +#include "taler/taler_error_codes.h" +#include "taler/taler_dbevents.h" +#include "taler/taler_pq_lib.h" +#include "pg_do_charity_delete.h" +#include "pg_helper.h" + + +enum GNUNET_DB_QueryStatus +DH_PG_do_charity_delete ( + void *cls, + unsigned long long charity_id) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&charity_id), + GNUNET_PQ_query_param_end + }; + struct GNUNET_PQ_ResultSpec rs[] = { + GNUNET_PQ_result_spec_end + }; + + PREPARE (pg, + "call_charity_delete", + "DELETE FROM charities " + "WHERE charity_id=$1"); + return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, + "call_charity_delete", + params, + rs); +} diff --git a/src/donaudb/pg_do_charity_delete.h b/src/donaudb/pg_do_charity_delete.h @@ -0,0 +1,41 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ +/** + * @file exchangedb/pg_do_charity_delete.h + * @brief implementation of the do_charity_delete function for Postgres + * @author Johannes Casaburi + */ +#ifndef PG_DO_PURSE_DELETE_H +#define PG_DO_PURSE_DELETE_H + +#include "taler/taler_util.h" +#include "taler/taler_json_lib.h" +#include "donaudb_plugin.h" + + +/** + * Function called to explicitly delete a charity. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param charity_id charity to delete + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +DH_PG_do_charity_delete ( + void *cls, + unsigned long long charity_id); + +#endif diff --git a/src/donaudb/pg_get_history.c b/src/donaudb/pg_get_history.c @@ -58,14 +58,14 @@ struct GetHistoryContext */ static void get_history_cb (void *cls, - PGresult *result, - unsigned int num_results) + PGresult *result, + unsigned int num_results) { struct GetHistoryContext *ctx = cls; for (unsigned int i = 0; i < num_results; i++) { - uint64_t charity_id; + unsigned long long charity_id; struct TALER_Amount final_amount; uint64_t donation_year; @@ -100,8 +100,8 @@ get_history_cb (void *cls, enum GNUNET_DB_QueryStatus DH_PG_get_history (void *cls, - DONAUDB_GetHistoryCallback cb, - void *cb_cls) + DONAUDB_GetHistoryCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GetHistoryContext ctx = { diff --git a/src/donaudb/pg_insert_history_entry.c b/src/donaudb/pg_insert_history_entry.c @@ -27,7 +27,7 @@ enum GNUNET_DB_QueryStatus DH_PG_insert_history_entry (void *cls, - const uint64_t charity_id, + const unsigned long long charity_id, const struct TALER_Amount *final_amount, const uint64_t donation_year) { diff --git a/src/donaudb/pg_insert_history_entry.h b/src/donaudb/pg_insert_history_entry.h @@ -36,7 +36,7 @@ */ enum GNUNET_DB_QueryStatus DH_PG_insert_history_entry (void *cls, - const uint64_t charity_id, + const unsigned long long charity_id, const struct TALER_Amount *final_amount, const uint64_t donation_year); diff --git a/src/donaudb/pg_insert_issued_receipt.c b/src/donaudb/pg_insert_issued_receipt.c @@ -29,7 +29,7 @@ enum GNUNET_DB_QueryStatus DH_PG_insert_issued_receipt (void *cls, const struct DONAU_CharitySignatureP *charity_sig, - const uint64_t charity_id, + const unsigned long long charity_id, const struct DONAU_DonationReceiptHashP *h_receipt, const struct TALER_Amount *amount) { diff --git a/src/donaudb/pg_insert_issued_receipt.h b/src/donaudb/pg_insert_issued_receipt.h @@ -38,7 +38,7 @@ enum GNUNET_DB_QueryStatus DH_PG_insert_issued_receipt (void *cls, const struct DONAU_CharitySignatureP *charity_sig, - const uint64_t charity_id, + const unsigned long long charity_id, const struct DONAU_DonationReceiptHashP *h_receipt, const struct TALER_Amount *amount); diff --git a/src/donaudb/pg_lookup_charity.c b/src/donaudb/pg_lookup_charity.c @@ -28,7 +28,7 @@ enum GNUNET_DB_QueryStatus DH_PG_lookup_charity ( void *cls, - uint64_t charity_id, + unsigned long long charity_id, struct DONAUDB_CharityMetaData *meta) { struct PostgresClosure *pg = cls; diff --git a/src/donaudb/pg_lookup_charity.h b/src/donaudb/pg_lookup_charity.h @@ -34,7 +34,7 @@ enum GNUNET_DB_QueryStatus DH_PG_lookup_charity ( void *cls, - uint64_t charity_id, + unsigned long long charity_id, struct DONAUDB_CharityMetaData *meta); #endif diff --git a/src/donaudb/plugin_donaudb_postgres.c b/src/donaudb/plugin_donaudb_postgres.c @@ -60,6 +60,7 @@ #include "pg_lookup_charity.h" #include "pg_get_charities.h" #include "pg_insert_charity.h" +#include "pg_do_charity_delete.h" /** * Set to 1 to enable Postgres auto_explain module. This will @@ -76,14 +77,14 @@ * @param conn SQL connection that was used */ #define BREAK_DB_ERR(result,conn) do { \ - GNUNET_break (0); \ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - "Database failure: %s/%s/%s/%s/%s", \ - PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \ - PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \ - PQresultErrorMessage (result), \ - PQresStatus (PQresultStatus (result)), \ - PQerrorMessage (conn)); \ + GNUNET_break (0); \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ + "Database failure: %s/%s/%s/%s/%s", \ + PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \ + PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \ + PQresultErrorMessage (result), \ + PQresStatus (PQresultStatus (result)), \ + PQerrorMessage (conn)); \ } while (0) @@ -275,35 +276,37 @@ libtaler_plugin_donaudb_postgres_init (void *cls) = &DH_PG_event_listen_cancel; plugin->event_notify = &DH_PG_event_notify; - //plugin->get_policy_details + // plugin->get_policy_details // = &DH_PG_get_policy_details; - //plugin->persist_policy_details + // plugin->persist_policy_details // = &DH_PG_persist_policy_details; // plugin->gc // = &DH_PG_gc; plugin->add_donation_unit_key - = &DH_PG_add_donation_unit_key; + = &DH_PG_add_donation_unit_key; plugin->lookup_donation_unit - = &DH_PG_lookup_donation_unit; + = &DH_PG_lookup_donation_unit; plugin->insert_history_entry - = &DH_PG_insert_history_entry; + = &DH_PG_insert_history_entry; plugin->get_history - = &DH_PG_get_history; + = &DH_PG_get_history; plugin->insert_issued_receipt - = &DH_PG_insert_issued_receipt; + = &DH_PG_insert_issued_receipt; plugin->insert_submitted_receipt - = &DH_PG_insert_submitted_receipt; + = &DH_PG_insert_submitted_receipt; plugin->insert_signing_key - = &DH_PG_insert_signing_key; + = &DH_PG_insert_signing_key; plugin->lookup_signing_key - = &DH_PG_lookup_signing_key; + = &DH_PG_lookup_signing_key; plugin->lookup_charity = &DH_PG_lookup_charity; plugin->insert_charity = &DH_PG_insert_charity; plugin->get_charities = &DH_PG_get_charities; + plugin->do_charity_delete + = &DH_PG_do_charity_delete; return plugin; } diff --git a/src/include/donau_service.h b/src/include/donau_service.h @@ -785,7 +785,7 @@ struct DONAU_CharitySummary /** * charity id */ - uint64_t charity_id; + unsigned long long charity_id; /** * charity name @@ -1087,7 +1087,7 @@ struct DONAU_PostCharityResponse /** * charity id */ - uint64_t charity_id; + unsigned long long charity_id; } ok; diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h @@ -199,7 +199,7 @@ typedef void typedef void (*DONAUDB_GetHistoryCallback)( void *cls, - uint64_t charity_id, + unsigned long long charity_id, struct TALER_Amount final_amount, uint64_t donation_year); @@ -384,10 +384,24 @@ struct DONAUDB_Plugin enum GNUNET_DB_QueryStatus (*lookup_charity)( void *cls, - uint64_t charity_id, + unsigned long long charity_id, struct DONAUDB_CharityMetaData *meta); /** + * Delete charity. + * + * @param cls closure + * @param charity_id + * @param[out] found set to true if the purse was found + * (if false, purse could not be deleted) + * @return database transaction status + */ + enum GNUNET_DB_QueryStatus + (*do_charity_delete)( + void *cls, + unsigned long long charity_id); + + /** * Get charities. * * @param cls closure @@ -458,7 +472,7 @@ struct DONAUDB_Plugin enum GNUNET_DB_QueryStatus (*lookup_history_entry)( void *cls, - const uint64_t charity_id, + const unsigned long long charity_id, const struct TALER_Amount *final_amount, const uint64_t donation_year); @@ -502,7 +516,7 @@ struct DONAUDB_Plugin enum GNUNET_DB_QueryStatus (*insert_history_entry) ( void *cls, - const uint64_t charity_id, + const unsigned long long charity_id, const struct TALER_Amount *final_amount, const uint64_t donation_year); @@ -520,7 +534,7 @@ struct DONAUDB_Plugin (*insert_issued_receipt) ( void *cls, const struct DONAU_CharitySignatureP *charity_sig, - const uint64_t charity_id, + const unsigned long long charity_id, const struct DONAU_DonationReceiptHashP *h_receipt, const struct TALER_Amount *amount); diff --git a/src/lib/donau_api_charities_get.c b/src/lib/donau_api_charities_get.c @@ -52,7 +52,7 @@ struct DONAU_CharitiesGetHandle /** * Charity id we are querying. */ - uint64_t charity_id; + unsigned long long charity_id; /** * Closure to pass to @e cb. @@ -72,7 +72,7 @@ struct DONAU_CharitiesGetHandle */ static enum GNUNET_GenericReturnValue handle_charities_get_ok (const json_t *resp_obj, - struct DONAU_CharityGetHandle *cgh) + struct DONAU_CharityGetHandle *cgh) { const json_t *charity_hist_array; const char *name; @@ -87,15 +87,16 @@ handle_charities_get_ok (const json_t *resp_obj, }; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("name", - &name), + &name), GNUNET_JSON_spec_fixed_auto ("charity_pub", &charity_resp.details.ok.charity->charity_pub), TALER_JSON_spec_amount_any ("max_per_year", - &charity_resp.details.ok.charity->max_per_year), + &charity_resp.details.ok.charity->max_per_year), TALER_JSON_spec_amount_any ("receipts_to_date", - &charty_resp.details.ok.charity->receipts_to_date), + &charty_resp.details.ok.charity-> + receipts_to_date), GNUNET_JSON_spec_uint32 ("current_year", - &charity_resp.details.ok.charity->current_year), + &charity_resp.details.ok.charity->current_year), GNUNET_JSON_spec_end () }; @@ -159,11 +160,11 @@ handle_charities_get_ok (const json_t *resp_obj, */ static void handle_charities_get_finished (void *cls, - long response_code, - const void *resp_obj) + long response_code, + const void *resp_obj) { - //struct DONAU_Charity *cd = NULL; - + // struct DONAU_Charity *cd = NULL; + struct DONAU_CharityGetHandle *cgh = cls; const json_t *j = resp_obj; struct DONAU_GetCharityResponse gcresp = { @@ -180,7 +181,7 @@ handle_charities_get_finished (void *cls, case MHD_HTTP_OK: if (GNUNET_OK != handle_charity_get_ok (j, - cgh)) + cgh)) { gcresp.hr.http_status = 0; gcresp.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; @@ -225,12 +226,13 @@ handle_charities_get_finished (void *cls, DONAU_charity_get_cancel (cgh); } + struct DONAU_CharityGetHandle * DONAU_charities_get ( struct GNUNET_CURL_Context *ctx, const char *url, const uint64_t id, - const struct DONAU_BearerToken bearer, //TODO: check authorization + const struct DONAU_BearerToken bearer, // TODO: check authorization struct GNUNET_TIME_Relative timeout, DONAU_GetCharityResponseCallback cb, void *cb_cls) @@ -256,15 +258,15 @@ DONAU_charities_get ( sizeof (id_str)); *end = '\0'; GNUNET_snprintf (timeout_str, - sizeof (timeout_str), - "%llu", - (unsigned long long) - (timeout.rel_value_us - / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); + sizeof (timeout_str), + "%llu", + (unsigned long long) + (timeout.rel_value_us + / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); GNUNET_snprintf (arg_str, - sizeof (arg_str), - "charities/%s", - id_str); + sizeof (arg_str), + "charities/%s", + id_str); cgh->url = TALER_url_join (url, arg_str, NULL); @@ -285,15 +287,16 @@ DONAU_charities_get ( return NULL; } cgh->job = GNUNET_CURL_job_add (ctx, - eh, - &handle_charity_get_finished, - cgh); + eh, + &handle_charity_get_finished, + cgh); return cgh; } + void DONAU_charities_get_cancel ( - struct DONAU_CharityGetHandle *cgh) + struct DONAU_CharityGetHandle *cgh) { if (NULL != cgh->job) { diff --git a/src/lib/donau_api_charity_get.c b/src/lib/donau_api_charity_get.c @@ -52,7 +52,7 @@ struct DONAU_CharityGetHandle /** * Charity id we are querying. */ - uint64_t charity_id; + unsigned long long charity_id; /** * Closure to pass to @e cb. @@ -72,9 +72,9 @@ struct DONAU_CharityGetHandle */ static enum GNUNET_GenericReturnValue handle_charity_get_ok (const json_t *resp_obj, - struct DONAU_CharityGetHandle *cgh) + struct DONAU_CharityGetHandle *cgh) { - //const json_t *charity_hist_array; + // const json_t *charity_hist_array; const char *name; if (JSON_OBJECT != json_typeof (resp_obj)) { @@ -87,15 +87,16 @@ handle_charity_get_ok (const json_t *resp_obj, }; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("name", - &name), + &name), GNUNET_JSON_spec_fixed_auto ("charity_pub", &charity_resp.details.ok.charity->charity_pub), TALER_JSON_spec_amount_any ("max_per_year", - &charity_resp.details.ok.charity->max_per_year), + &charity_resp.details.ok.charity->max_per_year), TALER_JSON_spec_amount_any ("receipts_to_date", - &charity_resp.details.ok.charity->receipts_to_date), + &charity_resp.details.ok.charity-> + receipts_to_date), GNUNET_JSON_spec_uint32 ("current_year", - &charity_resp.details.ok.charity->current_year), + &charity_resp.details.ok.charity->current_year), GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -139,7 +140,7 @@ handle_charity_get_ok (const json_t *resp_obj, // return GNUNET_SYSERR; // } // } - //} + // } cgh->cb (cgh->cb_cls, &charity_resp); @@ -158,11 +159,11 @@ handle_charity_get_ok (const json_t *resp_obj, */ static void handle_charity_get_finished (void *cls, - long response_code, - const void *resp_obj) + long response_code, + const void *resp_obj) { - //struct DONAU_Charity *cd = NULL; - + // struct DONAU_Charity *cd = NULL; + struct DONAU_CharityGetHandle *cgh = cls; const json_t *j = resp_obj; struct DONAU_GetCharityResponse gcresp = { @@ -179,7 +180,7 @@ handle_charity_get_finished (void *cls, case MHD_HTTP_OK: if (GNUNET_OK != handle_charity_get_ok (j, - cgh)) + cgh)) { gcresp.hr.http_status = 0; gcresp.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; @@ -224,12 +225,13 @@ handle_charity_get_finished (void *cls, DONAU_charity_get_cancel (cgh); } + struct DONAU_CharityGetHandle * DONAU_charity_get ( struct GNUNET_CURL_Context *ctx, const char *url, const uint64_t id, - const struct DONAU_BearerToken bearer, //TODO: check authorization + const struct DONAU_BearerToken bearer, // TODO: check authorization struct GNUNET_TIME_Relative timeout, DONAU_GetCharityResponseCallback cb, void *cb_cls) @@ -255,15 +257,15 @@ DONAU_charity_get ( sizeof (id_str)); *end = '\0'; GNUNET_snprintf (timeout_str, - sizeof (timeout_str), - "%llu", - (unsigned long long) - (timeout.rel_value_us - / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); + sizeof (timeout_str), + "%llu", + (unsigned long long) + (timeout.rel_value_us + / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); GNUNET_snprintf (arg_str, - sizeof (arg_str), - "charities/%s", - id_str); + sizeof (arg_str), + "charities/%s", + id_str); cgh->url = TALER_url_join (url, arg_str, NULL); @@ -284,15 +286,16 @@ DONAU_charity_get ( return NULL; } cgh->job = GNUNET_CURL_job_add (ctx, - eh, - &handle_charity_get_finished, - cgh); + eh, + &handle_charity_get_finished, + cgh); return cgh; } + void DONAU_charity_get_cancel ( - struct DONAU_CharityGetHandle *cgh) + struct DONAU_CharityGetHandle *cgh) { if (NULL != cgh->job) {