diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-23 08:49:00 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-23 08:49:00 +0800 |
commit | 396df5cd796f7eed89ff5a5acf6f7c714b2cf0a7 (patch) | |
tree | 28bc944646cfc57fdcf6a393b18537245a83d9e1 | |
parent | eb02eaccf2cbfca76dfaac806c6dc880b6e0ccad (diff) |
Admin login and logout functions
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | admin.c | 14 | ||||
-rw-r--r-- | icclient/admin.h | 17 | ||||
-rw-r--r-- | main.c | 5 |
4 files changed, 36 insertions, 2 deletions
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 @@ -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 @@ -2,6 +2,7 @@ #include <stdlib.h> #include <string.h> #include <stdbool.h> +#include <icclient/admin.h> #include <icclient/client.h> 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(); } |