diff --git a/data.c b/data.c index bb12aed..8345001 100644 --- a/data.c +++ b/data.c @@ -1583,6 +1583,13 @@ int unbookmark(snac *user, const char *id) } +xs_list *bookmark_list(snac *user) +/* return the lists of bookmarked posts */ +{ + return object_user_cache_list(user, "bookmark", XS_ALL, 1); +} + + /** pinning **/ int is_pinned(snac *user, const char *id) diff --git a/html.c b/html.c index e68e13b..9e588ca 100644 --- a/html.c +++ b/html.c @@ -2925,6 +2925,21 @@ int html_get_handler(const xs_dict *req, const char *q_path, } } else + if (strcmp(p_path, "list/bookmarks") == 0) { /** list of bookmarked posts **/ + if (!login(&snac, req)) { + *body = xs_dup(uid); + status = HTTP_STATUS_UNAUTHORIZED; + } + else { + xs *list = bookmark_list(&snac); + + *body = html_timeline(&snac, list, 0, skip, show, + 0, L("Bookmarked posts"), "", 0); + *b_size = strlen(*body); + status = HTTP_STATUS_OK; + } + } + else if (xs_startswith(p_path, "list/")) { /** list timelines **/ if (!login(&snac, req)) { *body = xs_dup(uid); diff --git a/snac.h b/snac.h index f428775..a3c28a8 100644 --- a/snac.h +++ b/snac.h @@ -169,6 +169,7 @@ int is_muted(snac *snac, const char *actor); int is_bookmarked(snac *user, const char *id); int bookmark(snac *user, const char *id); int unbookmark(snac *user, const char *id); +xs_list *bookmark_list(snac *user); int pin(snac *user, const char *id); int unpin(snac *user, const char *id);