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) | |||
| 1583 | } | 1583 | } |
| 1584 | 1584 | ||
| 1585 | 1585 | ||
| 1586 | xs_list *bookmark_list(snac *user) | ||
| 1587 | /* return the lists of bookmarked posts */ | ||
| 1588 | { | ||
| 1589 | return object_user_cache_list(user, "bookmark", XS_ALL, 1); | ||
| 1590 | } | ||
| 1591 | |||
| 1592 | |||
| 1586 | /** pinning **/ | 1593 | /** pinning **/ |
| 1587 | 1594 | ||
| 1588 | int is_pinned(snac *user, const char *id) | 1595 | int is_pinned(snac *user, const char *id) |
| @@ -2925,6 +2925,21 @@ int html_get_handler(const xs_dict *req, const char *q_path, | |||
| 2925 | } | 2925 | } |
| 2926 | } | 2926 | } |
| 2927 | else | 2927 | else |
| 2928 | if (strcmp(p_path, "list/bookmarks") == 0) { /** list of bookmarked posts **/ | ||
| 2929 | if (!login(&snac, req)) { | ||
| 2930 | *body = xs_dup(uid); | ||
| 2931 | status = HTTP_STATUS_UNAUTHORIZED; | ||
| 2932 | } | ||
| 2933 | else { | ||
| 2934 | xs *list = bookmark_list(&snac); | ||
| 2935 | |||
| 2936 | *body = html_timeline(&snac, list, 0, skip, show, | ||
| 2937 | 0, L("Bookmarked posts"), "", 0); | ||
| 2938 | *b_size = strlen(*body); | ||
| 2939 | status = HTTP_STATUS_OK; | ||
| 2940 | } | ||
| 2941 | } | ||
| 2942 | else | ||
| 2928 | if (xs_startswith(p_path, "list/")) { /** list timelines **/ | 2943 | if (xs_startswith(p_path, "list/")) { /** list timelines **/ |
| 2929 | if (!login(&snac, req)) { | 2944 | if (!login(&snac, req)) { |
| 2930 | *body = xs_dup(uid); | 2945 | *body = xs_dup(uid); |
| @@ -169,6 +169,7 @@ int is_muted(snac *snac, const char *actor); | |||
| 169 | int is_bookmarked(snac *user, const char *id); | 169 | int is_bookmarked(snac *user, const char *id); |
| 170 | int bookmark(snac *user, const char *id); | 170 | int bookmark(snac *user, const char *id); |
| 171 | int unbookmark(snac *user, const char *id); | 171 | int unbookmark(snac *user, const char *id); |
| 172 | xs_list *bookmark_list(snac *user); | ||
| 172 | 173 | ||
| 173 | int pin(snac *user, const char *id); | 174 | int pin(snac *user, const char *id); |
| 174 | int unpin(snac *user, const char *id); | 175 | int unpin(snac *user, const char *id); |