summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-20 08:29:32 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-20 08:29:32 +0800
commitb570e9edb513318d52de43e990f49cfe1da6f14e (patch)
tree7d8eb87872dfe0d19ca777a15e6925ce4d776520
parent58bbe66096bc40cede5ea78442f9f0702c73c6ed (diff)
Implement user_showid
-rw-r--r--user.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/user.c b/user.c
index 4614f6a..804223a 100644
--- a/user.c
+++ b/user.c
@@ -174,11 +174,7 @@ static size_t show_callback(void *contents, size_t size, size_t nmemb
return realsize;
}
-void rtclient_user_showid(rtclient_user **userptr, unsigned int id)
-{
-}
-
-void rtclient_user_showname(rtclient_user **userptr, const char *name)
+static inline void user_init(rtclient_user **userptr)
{
*userptr = malloc(sizeof(rtclient_user));
rtclient_user *user = *userptr;
@@ -207,6 +203,18 @@ void rtclient_user_showname(rtclient_user **userptr, const char *name)
user->timezone = RTCLIENT_TIMEZONE_NONE;
user->privileged = false;
user->disabled = true;
+}
+
+void rtclient_user_showid(rtclient_user **userptr, unsigned int id)
+{
+ user_init(userptr);
+ request(show_callback, (void *)userptr, NULL, "%s%d", "/REST/1.0/user/"
+ , id);
+}
+
+void rtclient_user_showname(rtclient_user **userptr, const char *name)
+{
+ user_init(userptr);
request(show_callback, (void *)userptr, NULL, "%s%s", "/REST/1.0/user/"
, name);
}