From 396df5cd796f7eed89ff5a5acf6f7c714b2cf0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Mon, 23 Sep 2019 08:49:00 +0800 Subject: Admin login and logout functions --- Makefile.am | 2 ++ admin.c | 14 ++++++++++++++ icclient/admin.h | 17 +++++++++++++++++ main.c | 5 +++-- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 admin.c create mode 100644 icclient/admin.h diff --git a/Makefile.am b/Makefile.am index 54d9c15..e603edd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,11 @@ noinst_LIBRARIES = libicclient.a libicclient_a_SOURCES = \ icclient/request.h \ icclient/login.h \ + icclient/admin.h \ icclient/client.h \ request.c \ login.c \ + admin.c \ client.c bin_PROGRAMS = icclienttest diff --git a/admin.c b/admin.c new file mode 100644 index 0000000..60bf583 --- /dev/null +++ b/admin.c @@ -0,0 +1,14 @@ +#include "login.h" +#include "icclient/admin.h" + +void icclient_admin_login(const char *username, const char *password + , const char *successpage, const char *nextpage + , const char *failpage) +{ + login(username, password, NULL, "MMLogin", successpage, nextpage, failpage); +} + +void icclient_admin_logout() +{ + request(NULL, NULL, NULL, "%s", "admin/login"); +} diff --git a/icclient/admin.h b/icclient/admin.h new file mode 100644 index 0000000..e01fdc9 --- /dev/null +++ b/icclient/admin.h @@ -0,0 +1,17 @@ +#ifndef ICCLIENT_ADMIN_H +#define ICCLIENT_ADMIN_H + +#ifdef __cplusplus +extern "C" { +#endif + + void icclient_admin_login(const char *username, const char *password + , const char *successpage, const char *nextpage + , const char *failpage); + void icclient_admin_logout(); + +#ifdef __cplusplus +} +#endif + +#endif // ICCLIENT_ADMIN_H diff --git a/main.c b/main.c index e3f149c..1a26c95 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,7 @@ #include #include #include +#include #include int main(void) @@ -26,10 +27,10 @@ int main(void) icclient_init(url); free(url); - icclient_login(name, pass, NULL, NULL, NULL); + icclient_admin_login(name, pass, NULL, NULL, NULL); free(name); free(pass); - icclient_logout(); + icclient_admin_logout(); icclient_cleanup(); } -- cgit v1.2.3