mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 17:45:04 +00:00
mastoapi: added support for [un]bookmarking.
This commit is contained in:
parent
67f0efa689
commit
54520f0411
1 changed files with 11 additions and 4 deletions
15
mastoapi.c
15
mastoapi.c
|
@ -1061,7 +1061,8 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
|
|||
else
|
||||
st = xs_dict_append(st, "poll", xs_stock(XSTYPE_NULL));
|
||||
|
||||
st = xs_dict_append(st, "bookmarked", xs_stock(XSTYPE_FALSE));
|
||||
st = xs_dict_append(st, "bookmarked",
|
||||
(snac && is_bookmarked(snac, id)) ? xs_stock(XSTYPE_TRUE) : xs_stock(XSTYPE_FALSE));
|
||||
|
||||
st = xs_dict_append(st, "pinned",
|
||||
(snac && is_pinned(snac, id)) ? xs_stock(XSTYPE_TRUE) : xs_stock(XSTYPE_FALSE));
|
||||
|
@ -2570,16 +2571,22 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
|
|||
}
|
||||
else
|
||||
if (strcmp(op, "bookmark") == 0) { /** **/
|
||||
/* snac does not support bookmarks */
|
||||
/* bookmark this message */
|
||||
if (bookmark(&snac, id) == 0)
|
||||
out = mastoapi_status(&snac, msg);
|
||||
else
|
||||
status = HTTP_STATUS_UNPROCESSABLE_CONTENT;
|
||||
}
|
||||
else
|
||||
if (strcmp(op, "unbookmark") == 0) { /** **/
|
||||
/* snac does not support bookmarks */
|
||||
/* unbookmark this message */
|
||||
unbookmark(&snac, id);
|
||||
out = mastoapi_status(&snac, msg);
|
||||
}
|
||||
else
|
||||
if (strcmp(op, "pin") == 0) { /** **/
|
||||
/* pin this message */
|
||||
if (pin(&snac, id))
|
||||
if (pin(&snac, id) == 0)
|
||||
out = mastoapi_status(&snac, msg);
|
||||
else
|
||||
status = HTTP_STATUS_UNPROCESSABLE_CONTENT;
|
||||
|
|
Loading…
Reference in a new issue