From 3947ac9a60018f395558731027e26db8953090bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sat, 12 Jun 2021 14:44:30 +0800 Subject: Move all libcurl related stuff to request --- login.h | 48 ++++++++++-------------------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) (limited to 'login.h') diff --git a/login.h b/login.h index 1501993..c11b634 100644 --- a/login.h +++ b/login.h @@ -6,43 +6,15 @@ inline void login(const char *username, const char *password, const char *verify, const char *click, const char *successpage, const char *nextpage, const char *failpage, icclient_handler handler, void *user) { - struct curl_httppost *post, *last = NULL; - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "mv_username", - CURLFORM_PTRCONTENTS, username, - CURLFORM_END); - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "mv_password", - CURLFORM_PTRCONTENTS, password, - CURLFORM_END); - if (verify) - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "mv_verify", - CURLFORM_PTRCONTENTS, verify, - CURLFORM_END); - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "mv_click", - CURLFORM_PTRCONTENTS, click, - CURLFORM_END); - if (successpage) - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "mv_successpage", - CURLFORM_PTRCONTENTS, successpage, - CURLFORM_END); - if (nextpage) - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "mv_nextpage", - CURLFORM_PTRCONTENTS, nextpage, - CURLFORM_END); - if (failpage) - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "mv_failpage", - CURLFORM_PTRCONTENTS, failpage, - CURLFORM_END); - last = NULL; - request(handler, user, post, "%s", "process"); - curl_formfree(post); - post = NULL; + request(handler, user, &(struct icclient_request_data){ 7, { + { "mv_username", username }, + { "mv_password", password }, + { "mv_verify", verify }, + { "mv_click", click }, + { "mv_successpage", successpage }, + { "mv_nextpage", nextpage }, + { "mv_failpage", failpage } + }}, "%s", "process"); } -#endif // ICCLIENT_LOGIN_H +#endif -- cgit v1.2.3