From e68bd33854140981f0ab9f6e181f39bdb5b06046 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 14 Sep 2018 11:37:17 -0400 Subject: [PATCH] object_in_user() is a master function which calls slave functions fetch_user_bio() and fetch_user_photo(). Fuck political correctness. --- webcit-ng/user_functions.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/webcit-ng/user_functions.c b/webcit-ng/user_functions.c index 7067ec753..b3d360f00 100644 --- a/webcit-ng/user_functions.c +++ b/webcit-ng/user_functions.c @@ -15,6 +15,32 @@ #include "webcit.h" +/* + * Fetch a user photo (avatar) + */ +void fetch_user_photo(struct http_transaction *h, struct ctdlsession *c) +{ + char username[1024]; + + extract_token(username, h->uri, 3, '/', sizeof username); + + do_404(h); // FIXME finish this +} + + +/* + * Fetch a user bio (profile) + */ +void fetch_user_bio(struct http_transaction *h, struct ctdlsession *c) +{ + char username[1024]; + + extract_token(username, h->uri, 3, '/', sizeof username); + + do_404(h); // FIXME finish this +} + + /* * Client requested an object related to a user. */ @@ -26,8 +52,13 @@ void object_in_user(struct http_transaction *h, struct ctdlsession *c) extract_token(buf, h->uri, 4, '/', sizeof buf); - if (!strcasecmp(buf, "userpic")) { // FIXME do this - do_404(h); + if (!strcasecmp(buf, "userpic")) { // user photo (avatar) + fetch_user_photo(h, c); + return; + } + + if (!strcasecmp(buf, "bio")) { // user bio (profile) + fetch_user_bio(h, c); return; } -- 2.30.2