summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorGravatar default2023-07-24 20:44:00 +0200
committerGravatar default2023-07-24 20:44:00 +0200
commite428b5786524c5aea625f14cae14e86d6753e5d2 (patch)
tree7d4b4480aab579b214f3e468c0f7472b38b4c2e1 /activitypub.c
parentAdded support for Accept objects that only provide an object id. (diff)
downloadsnac2-e428b5786524c5aea625f14cae14e86d6753e5d2.tar.gz
snac2-e428b5786524c5aea625f14cae14e86d6753e5d2.tar.xz
snac2-e428b5786524c5aea625f14cae14e86d6753e5d2.zip
Improved Accept + implicit Follow code.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c
index 27cf786..2bb94fe 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1512,7 +1512,18 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
1512 } 1512 }
1513 else 1513 else
1514 if (strcmp(type, "Accept") == 0) { /** **/ 1514 if (strcmp(type, "Accept") == 0) { /** **/
1515 if (strcmp(utype, "Follow") == 0 || strcmp(utype, "(null)") == 0) { /** **/ 1515 if (strcmp(utype, "(null)") == 0) {
1516 const char *obj_id = xs_dict_get(msg, "object");
1517
1518 /* if the accepted object id is a string that may
1519 be created by us, it's a follow */
1520 if (xs_type(obj_id) == XSTYPE_STRING &&
1521 xs_startswith(obj_id, srv_baseurl) &&
1522 xs_endswith(obj_id, "/Follow"))
1523 utype = "Follow";
1524 }
1525
1526 if (strcmp(utype, "Follow") == 0) { /** **/
1516 if (following_check(snac, actor)) { 1527 if (following_check(snac, actor)) {
1517 following_add(snac, actor, msg); 1528 following_add(snac, actor, msg);
1518 snac_log(snac, xs_fmt("confirmed follow from %s", actor)); 1529 snac_log(snac, xs_fmt("confirmed follow from %s", actor));