From a94e13144f0a971d14d7abef8edf98a0eb9c707e 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, 18 Mar 2023 10:03:47 +0800 Subject: Interface for setting successpage --- admin.c | 8 ++++---- interchange/admin.h | 4 ++-- interchange/member.h | 7 ++++--- login.c | 4 ++-- login.h | 6 ++++-- member.c | 14 ++++++++------ 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/admin.c b/admin.c index 8fe16e4..28f88f6 100644 --- a/admin.c +++ b/admin.c @@ -7,12 +7,12 @@ #include "interchange/admin.h" void interchange_admin_login(const char *username, const char *password, - const char *nextpage, const char *failpage, - void (*handler)(interchange_response *), + const char *nextpage, const char *successpage, + const char *failpage, void (*handler)(interchange_response *), void (*callback)(struct interchange_admin *)) { - login(username, password, NULL, "MMLogin", nextpage, failpage, handler, - (void (*)(void *))callback); + login(username, password, NULL, "MMLogin", nextpage, successpage, + failpage, handler, (void (*)(void *))callback); } void interchange_admin_new_admin(const char *username, const char *password, const char *name, bool super, diff --git a/interchange/admin.h b/interchange/admin.h index d50a1e4..eccace7 100644 --- a/interchange/admin.h +++ b/interchange/admin.h @@ -22,8 +22,8 @@ extern "C" { #endif void interchange_admin_login(const char *username, const char *password, - const char *nextpage, const char *failpage, - void (*handler)(interchange_response *), + const char *nextpage, const char *successpage, + const char *failpage, void (*handler)(interchange_response *), void (*callback)(struct interchange_admin *)); void interchange_admin_new_admin(const char *username, const char *password, const char *name, bool super, enum interchange_admin_group group, void (*handler)(interchange_response *)); diff --git a/interchange/member.h b/interchange/member.h index e4aad8d..117218c 100644 --- a/interchange/member.h +++ b/interchange/member.h @@ -64,12 +64,13 @@ extern "C" { #endif void interchange_member_newaccount(const char *username, const char *password, - const char *verify, const char *nextpage, const char *failpage, + const char *verify, const char *nextpage, + const char *successpage, const char *failpage, void (*handler)(interchange_response *), void (*callback)(struct interchange_member *)); void interchange_member_login(const char *username, const char *password, - const char *nextpage, const char *failpage, - void (*handler)(interchange_response *), + const char *nextpage, const char *successpage, + const char *failpage, void (*handler)(interchange_response *), void (*callback)(struct interchange_member *)); /*! diff --git a/login.c b/login.c index 278055b..37db119 100644 --- a/login.c +++ b/login.c @@ -1,5 +1,5 @@ #include "login.h" extern inline void login(const char *, const char *, const char *, const char *, - const char *, const char *, void (*)(interchange_response *), - void (*)(void *)); + const char *, const char *, const char *, + void (*)(interchange_response *), void (*)(void *)); diff --git a/login.h b/login.h index 856c2d2..6df9b0c 100644 --- a/login.h +++ b/login.h @@ -5,16 +5,18 @@ static inline void login(const char *username, const char *password, const char *verify, const char *click, const char *nextpage, - const char *failpage, void (*handler)(interchange_response *), + const char *successpage, const char *failpage, + void (*handler)(interchange_response *), void (*callback)(void *)) { - request(handler, callback, &(struct body){ 4 + (nextpage ? 1 : 0) + request(handler, callback, &(struct body){ 5 + (successpage ? 1 : 0) + (failpage ? 1 : 0), { { "mv_username", username }, { "mv_password", password }, { "mv_verify", verify }, { "mv_click", click }, { "mv_nextpage", nextpage }, + { "mv_successpage", successpage }, { "mv_failpage", failpage }, }}, "%s", "process"); } diff --git a/member.c b/member.c index 228ebc4..6034c10 100644 --- a/member.c +++ b/member.c @@ -3,22 +3,24 @@ #include "interchange/member.h" void interchange_member_newaccount(const char *username, const char *password, - const char *verify, const char *nextpage, const char *failpage, + const char *verify, const char *nextpage, + const char *successpage, const char *failpage, void (*handler)(interchange_response *), void (*callback)(struct interchange_member *)) { - login(username, password, verify, "NewAccount", - nextpage ? nextpage : "new_account", failpage, handler, + login(username, password, verify, "NewAccount", nextpage ? nextpage + : "new_account", successpage, failpage, handler, (void (*)(void *))callback); } void interchange_member_login(const char *username, const char *password, - const char *nextpage, const char *failpage, - void (*handler)(interchange_response *), + const char *nextpage, const char *successpage, + const char *failpage, void (*handler)(interchange_response *), void (*callback)(struct interchange_member *)) { login(username, password, NULL, "Login", nextpage ? nextpage : "login", - failpage, handler, (void (*)(void *))callback); + successpage, failpage, handler, + (void (*)(void *))callback); } void interchange_member_account(void (*handler)(interchange_response *)) -- cgit v1.2.3