summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-05-01 17:20:49 +0200
committerGravatar default2023-05-01 17:20:49 +0200
commit4595a3685992a8f31b86cca0ecf10e286dec52eb (patch)
tree6be6e834c212a9e4676182c26baf4a937d34b6da
parentNew functions index_del_md5(), index_del() and object_unadmire(). (diff)
downloadpenes-snac2-4595a3685992a8f31b86cca0ecf10e286dec52eb.tar.gz
penes-snac2-4595a3685992a8f31b86cca0ecf10e286dec52eb.tar.xz
penes-snac2-4595a3685992a8f31b86cca0ecf10e286dec52eb.zip
Partial support for mastoapi unfavourite / unreblog.
-rw-r--r--data.c2
-rw-r--r--mastoapi.c9
-rw-r--r--snac.h1
3 files changed, 9 insertions, 3 deletions
diff --git a/data.c b/data.c
index e038f81..67f5751 100644
--- a/data.c
+++ b/data.c
@@ -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;
diff --git a/mastoapi.c b/mastoapi.c
index 3d0a939..72d9579 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -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) {
diff --git a/snac.h b/snac.h
index 10e8c4c..a162618 100644
--- a/snac.h
+++ b/snac.h
@@ -83,6 +83,7 @@ int object_del_if_unref(const char *id);
83double object_ctime_by_md5(const char *md5); 83double object_ctime_by_md5(const char *md5);
84double object_ctime(const char *id); 84double object_ctime(const char *id);
85int object_admire(const char *id, const char *actor, int like); 85int object_admire(const char *id, const char *actor, int like);
86int object_unadmire(const char *id, const char *actor, int like);
86 87
87int object_likes_len(const char *id); 88int object_likes_len(const char *id);
88int object_announces_len(const char *id); 89int object_announces_len(const char *id);