commit 4595a36

default  ·  2023-05-01 15:20:49 +0000 UTC
parent c21bbd5
Partial support for mastoapi unfavourite / unreblog.
3 files changed,  +9, -3
M data.c
M snac.h
M data.c
+1, -1
1@@ -827,7 +827,7 @@ int object_unadmire(const char *id, const char *actor, int like)
2 
3     status = index_del(fn, actor);
4 
5-    srv_debug(1,
6+    srv_debug(0,
7         xs_fmt("object_unadmire (%s) %s %s %d", like ? "Like" : "Announce", actor, fn, status));
8 
9     return status;
+7, -2
 1@@ -1670,7 +1670,11 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
 2                     }
 3                     else
 4                     if (strcmp(op, "unfavourite") == 0) {
 5-                        /* snac does not support Undo+Like */
 6+                        /* partial support: as the original Like message
 7+                           is not stored anywhere here, it's not possible
 8+                           to send an Undo + Like; the only thing done here
 9+                           is to delete the actor from the list of likes */
10+                        object_unadmire(id, snac.actor, 1);
11                     }
12                     else
13                     if (strcmp(op, "reblog") == 0) {
14@@ -1685,7 +1689,8 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
15                     }
16                     else
17                     if (strcmp(op, "unreblog") == 0) {
18-                        /* snac does not support Undo+Announce */
19+                        /* partial support: see comment in 'unfavourite' */
20+                        object_unadmire(id, snac.actor, 0);
21                     }
22                     else
23                     if (strcmp(op, "bookmark") == 0) {
M snac.h
+1, -0
1@@ -83,6 +83,7 @@ int object_del_if_unref(const char *id);
2 double object_ctime_by_md5(const char *md5);
3 double object_ctime(const char *id);
4 int object_admire(const char *id, const char *actor, int like);
5+int object_unadmire(const char *id, const char *actor, int like);
6 
7 int object_likes_len(const char *id);
8 int object_announces_len(const char *id);