commit bf79c8c
default
·
2023-08-07 04:35:31 +0000 UTC
parent 4d9dfa9
Some fixes to limiting actors.
1 files changed,
+22,
-21
+22,
-21
1@@ -1558,37 +1558,38 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
2 }
3 else
4 if (strcmp(type, "Announce") == 0) { /** **/
5- xs *a_msg = NULL;
6- xs *wrk = NULL;
7+ if (is_limited(snac, actor))
8+ snac_log(snac, xs_fmt("dropped 'Announce' from limited actor %s", actor));
9+ else {
10+ xs *a_msg = NULL;
11+ xs *wrk = NULL;
12
13- if (xs_type(object) == XSTYPE_DICT)
14- object = xs_dict_get(object, "id");
15+ if (xs_type(object) == XSTYPE_DICT)
16+ object = xs_dict_get(object, "id");
17
18- timeline_request(snac, &object, &wrk, 0);
19+ timeline_request(snac, &object, &wrk, 0);
20
21- if (is_limited(snac, actor))
22- snac_log(snac, xs_fmt("dropped 'Announce' from limited actor %s", actor));
23- else
24- if (valid_status(object_get(object, &a_msg))) {
25- const char *who = xs_dict_get(a_msg, "attributedTo");
26+ if (valid_status(object_get(object, &a_msg))) {
27+ const char *who = xs_dict_get(a_msg, "attributedTo");
28
29- if (who && !is_muted(snac, who)) {
30- /* bring the actor */
31- xs *who_o = NULL;
32+ if (who && !is_muted(snac, who)) {
33+ /* bring the actor */
34+ xs *who_o = NULL;
35
36- if (valid_status(actor_request(snac, who, &who_o))) {
37- timeline_admire(snac, object, actor, 0);
38- snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
39- do_notify = 1;
40+ if (valid_status(actor_request(snac, who, &who_o))) {
41+ timeline_admire(snac, object, actor, 0);
42+ snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
43+ do_notify = 1;
44+ }
45+ else
46+ snac_log(snac, xs_fmt("dropped 'Announce' on actor request error %s", who));
47 }
48 else
49- snac_log(snac, xs_fmt("dropped 'Announce' on actor request error %s", who));
50+ snac_log(snac, xs_fmt("ignored 'Announce' about muted actor %s", who));
51 }
52 else
53- snac_log(snac, xs_fmt("ignored 'Announce' about muted actor %s", who));
54+ snac_debug(snac, 1, xs_fmt("error requesting 'Announce' object %s", object));
55 }
56- else
57- snac_debug(snac, 1, xs_fmt("error requesting 'Announce' object %s", object));
58 }
59 else
60 if (strcmp(type, "Update") == 0) { /** **/