diff options
| author | 2023-05-01 17:20:49 +0200 | |
|---|---|---|
| committer | 2023-05-01 17:20:49 +0200 | |
| commit | 4595a3685992a8f31b86cca0ecf10e286dec52eb (patch) | |
| tree | 6be6e834c212a9e4676182c26baf4a937d34b6da | |
| parent | New functions index_del_md5(), index_del() and object_unadmire(). (diff) | |
| download | penes-snac2-4595a3685992a8f31b86cca0ecf10e286dec52eb.tar.gz penes-snac2-4595a3685992a8f31b86cca0ecf10e286dec52eb.tar.xz penes-snac2-4595a3685992a8f31b86cca0ecf10e286dec52eb.zip | |
Partial support for mastoapi unfavourite / unreblog.
| -rw-r--r-- | data.c | 2 | ||||
| -rw-r--r-- | mastoapi.c | 9 | ||||
| -rw-r--r-- | snac.h | 1 |
3 files changed, 9 insertions, 3 deletions
| @@ -827,7 +827,7 @@ int object_unadmire(const char *id, const char *actor, int like) | |||
| 827 | 827 | ||
| 828 | status = index_del(fn, actor); | 828 | status = index_del(fn, actor); |
| 829 | 829 | ||
| 830 | srv_debug(1, | 830 | srv_debug(0, |
| 831 | xs_fmt("object_unadmire (%s) %s %s %d", like ? "Like" : "Announce", actor, fn, status)); | 831 | xs_fmt("object_unadmire (%s) %s %s %d", like ? "Like" : "Announce", actor, fn, status)); |
| 832 | 832 | ||
| 833 | return status; | 833 | return status; |
| @@ -1670,7 +1670,11 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1670 | } | 1670 | } |
| 1671 | else | 1671 | else |
| 1672 | if (strcmp(op, "unfavourite") == 0) { | 1672 | if (strcmp(op, "unfavourite") == 0) { |
| 1673 | /* snac does not support Undo+Like */ | 1673 | /* partial support: as the original Like message |
| 1674 | is not stored anywhere here, it's not possible | ||
| 1675 | to send an Undo + Like; the only thing done here | ||
| 1676 | is to delete the actor from the list of likes */ | ||
| 1677 | object_unadmire(id, snac.actor, 1); | ||
| 1674 | } | 1678 | } |
| 1675 | else | 1679 | else |
| 1676 | if (strcmp(op, "reblog") == 0) { | 1680 | if (strcmp(op, "reblog") == 0) { |
| @@ -1685,7 +1689,8 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1685 | } | 1689 | } |
| 1686 | else | 1690 | else |
| 1687 | if (strcmp(op, "unreblog") == 0) { | 1691 | if (strcmp(op, "unreblog") == 0) { |
| 1688 | /* snac does not support Undo+Announce */ | 1692 | /* partial support: see comment in 'unfavourite' */ |
| 1693 | object_unadmire(id, snac.actor, 0); | ||
| 1689 | } | 1694 | } |
| 1690 | else | 1695 | else |
| 1691 | if (strcmp(op, "bookmark") == 0) { | 1696 | if (strcmp(op, "bookmark") == 0) { |
| @@ -83,6 +83,7 @@ int object_del_if_unref(const char *id); | |||
| 83 | double object_ctime_by_md5(const char *md5); | 83 | double object_ctime_by_md5(const char *md5); |
| 84 | double object_ctime(const char *id); | 84 | double object_ctime(const char *id); |
| 85 | int object_admire(const char *id, const char *actor, int like); | 85 | int object_admire(const char *id, const char *actor, int like); |
| 86 | int object_unadmire(const char *id, const char *actor, int like); | ||
| 86 | 87 | ||
| 87 | int object_likes_len(const char *id); | 88 | int object_likes_len(const char *id); |
| 88 | int object_announces_len(const char *id); | 89 | int object_announces_len(const char *id); |