diff options
| author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-10 13:01:01 +0800 |
|---|---|---|
| committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-10 13:01:01 +0800 |
| commit | 06bea8ae54dd3cd714b231b3d8a8deef77136613 (patch) | |
| tree | 2c74bb8708f3a4cd395a0af25f3c7a60e7b139b8 /client.c | |
| parent | 751d72c5d5c7983e10f0105b95536fc5aac35569 (diff) | |
The client now takes an "on success" callback argument
Diffstat (limited to 'client.c')
| -rw-r--r-- | client.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -37,23 +37,23 @@ bool icclient_init(const char *url, const char *certificate) if (append) strcat(server_url, "/"); } + icclient_catalog_init(); return (bool)curl; #endif } -void icclient_results(const char *prod_group, icclient_handler handler, struct icclient_catalog **catalogptr) +extern size_t icclient_catalog_results(void *, size_t, size_t, void *); + +void icclient_results(const char *prod_group, + void (*callback)(struct icclient_catalog *), struct icclient_catalog **catalog, icclient_handler handler) { char nonspaced[strlen(prod_group) + 1]; strcpy(nonspaced, prod_group); char *space = NULL; while ((space = strchr(nonspaced, ' '))) *space = '-'; - request(handler, (void *)catalogptr, 0, "%s", nonspaced); -} - -void icclient_allproducts(icclient_handler handler, struct icclient_catalog **catalogptr) -{ - request(handler, (void *)catalogptr, 0, "%s", "All-Products"); + request(handler ? handler : icclient_catalog_results, (void *)catalog, 0, "%s", nonspaced); + callback(*catalog); } void icclient_flypage(const char *sku, icclient_handler handler, struct icclient_product **productptr) |