mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
mastoapi: added support for [un]bookmarking.
This commit is contained in:
parent
67f0efa689
commit
54520f0411
15
mastoapi.c
15
mastoapi.c
@ -1061,7 +1061,8 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
|
|||||||
else
|
else
|
||||||
st = xs_dict_append(st, "poll", xs_stock(XSTYPE_NULL));
|
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",
|
st = xs_dict_append(st, "pinned",
|
||||||
(snac && is_pinned(snac, id)) ? xs_stock(XSTYPE_TRUE) : xs_stock(XSTYPE_FALSE));
|
(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
|
else
|
||||||
if (strcmp(op, "bookmark") == 0) { /** **/
|
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
|
else
|
||||||
if (strcmp(op, "unbookmark") == 0) { /** **/
|
if (strcmp(op, "unbookmark") == 0) { /** **/
|
||||||
/* snac does not support bookmarks */
|
/* unbookmark this message */
|
||||||
|
unbookmark(&snac, id);
|
||||||
|
out = mastoapi_status(&snac, msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(op, "pin") == 0) { /** **/
|
if (strcmp(op, "pin") == 0) { /** **/
|
||||||
/* pin this message */
|
/* pin this message */
|
||||||
if (pin(&snac, id))
|
if (pin(&snac, id) == 0)
|
||||||
out = mastoapi_status(&snac, msg);
|
out = mastoapi_status(&snac, msg);
|
||||||
else
|
else
|
||||||
status = HTTP_STATUS_UNPROCESSABLE_CONTENT;
|
status = HTTP_STATUS_UNPROCESSABLE_CONTENT;
|
||||||
|
Loading…
Reference in New Issue
Block a user