commit e428b57
default
·
2023-07-24 18:44:00 +0000 UTC
parent dc5c1ce
Improved Accept + implicit Follow code.
1 files changed,
+12,
-1
+12,
-1
1@@ -1512,7 +1512,18 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
2 }
3 else
4 if (strcmp(type, "Accept") == 0) { /** **/
5- if (strcmp(utype, "Follow") == 0 || strcmp(utype, "(null)") == 0) { /** **/
6+ if (strcmp(utype, "(null)") == 0) {
7+ const char *obj_id = xs_dict_get(msg, "object");
8+
9+ /* if the accepted object id is a string that may
10+ be created by us, it's a follow */
11+ if (xs_type(obj_id) == XSTYPE_STRING &&
12+ xs_startswith(obj_id, srv_baseurl) &&
13+ xs_endswith(obj_id, "/Follow"))
14+ utype = "Follow";
15+ }
16+
17+ if (strcmp(utype, "Follow") == 0) { /** **/
18 if (following_check(snac, actor)) {
19 following_add(snac, actor, msg);
20 snac_log(snac, xs_fmt("confirmed follow from %s", actor));