diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-20 08:29:32 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-20 08:29:32 +0800 |
commit | b570e9edb513318d52de43e990f49cfe1da6f14e (patch) | |
tree | 7d8eb87872dfe0d19ca777a15e6925ce4d776520 | |
parent | 58bbe66096bc40cede5ea78442f9f0702c73c6ed (diff) |
Implement user_showid
-rw-r--r-- | user.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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); } |