diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-12 14:44:30 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-12 14:44:30 +0800 |
commit | 3947ac9a60018f395558731027e26db8953090bb (patch) | |
tree | 0f77a63d06127c43a5fcddd3cad963d4a0f2330d /login.h | |
parent | a7f4dba7c9c0738545c8b41b4185bd5ec9feb099 (diff) |
Move all libcurl related stuff to request
Diffstat (limited to 'login.h')
-rw-r--r-- | login.h | 48 |
1 files changed, 10 insertions, 38 deletions
@@ -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 |