From b570e9edb513318d52de43e990f49cfe1da6f14e 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: Fri, 20 Sep 2019 08:29:32 +0800 Subject: Implement user_showid --- user.c | 18 +++++++++++++----- 1 file 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); } -- cgit v1.2.3