diff options
-rw-r--r-- | data.c | 7 | ||||
-rw-r--r-- | html.c | 15 | ||||
-rw-r--r-- | snac.h | 1 |
3 files changed, 23 insertions, 0 deletions
@@ -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) @@ -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); @@ -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); |