summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--admin.c14
-rw-r--r--icclient/admin.h17
-rw-r--r--main.c5
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
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 <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();
}